Staging: rt2870: prepare for rt{28,30}70/sta/*.[ch] merge
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Sun, 26 Apr 2009 14:06:23 +0000 (16:06 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 19 Jun 2009 18:00:50 +0000 (11:00 -0700)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/rt2870/sta/assoc.c
drivers/staging/rt2870/sta/connect.c
drivers/staging/rt2870/sta/rtmp_data.c
drivers/staging/rt2870/sta/sync.c
drivers/staging/rt2870/sta/wpa.c

index 1523f6c513baa3775c4d0764e3a7066844995471..d23dd05f79b89507fce4851f9555636429977bc2 100644 (file)
@@ -454,6 +454,11 @@ VOID MlmeAssocReqAction(
                                RSNIe = IE_WPA2;
                        }
 
+#ifdef RT30xx
+#ifdef SIOCSIWGENIE
+                       if (pAd->StaCfg.WpaSupplicantUP != 1)
+#endif // SIOCSIWGENIE //
+#endif
                RTMPMakeRSNIE(pAd, pAd->StaCfg.AuthMode, pAd->StaCfg.WepStatus, BSS0);
 
             // Check for WPA PMK cache list
@@ -480,6 +485,17 @@ VOID MlmeAssocReqAction(
                                }
                        }
 
+#ifdef RT30xx
+#ifdef SIOCSIWGENIE
+                       if (pAd->StaCfg.WpaSupplicantUP == 1)
+                       {
+                               MakeOutgoingFrame(pOutBuffer + FrameLen,                &tmp,
+                                               pAd->StaCfg.RSNIE_Len,                  pAd->StaCfg.RSN_IE,
+                                               END_OF_ARGS);
+                       }
+                       else
+#endif
+#endif
                        {
                                MakeOutgoingFrame(pOutBuffer + FrameLen,                &tmp,
                                                        1,                              &RSNIe,
@@ -490,6 +506,11 @@ VOID MlmeAssocReqAction(
 
                        FrameLen += tmp;
 
+#ifdef RT30xx
+#ifdef SIOCSIWGENIE
+                       if (pAd->StaCfg.WpaSupplicantUP != 1)
+#endif
+#endif
                        {
                    // Append Variable IE
                    NdisMoveMemory(pAd->StaCfg.ReqVarIEs + VarIesOffset, &RSNIe, 1);
index 3fae7ce3f281fd90e7f0b443d8456f80af576f6b..75ff2f1539888e05feb56e5be041adbfebbdb375 100644 (file)
@@ -1133,6 +1133,20 @@ VOID LinkUp(
                OPSTATUS_SET_FLAG(pAd, fOP_STATUS_ADHOC_ON);
                OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_INFRA_ON);
 
+#ifdef RT30xx
+               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;
+               }
+#endif
+
                if (pAd->CommonCfg.PhyMode >= PHY_11ABGN_MIXED)
                        AdhocTurnOnQos(pAd);
 
@@ -1514,6 +1528,9 @@ VOID LinkUp(
                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;
+#ifdef RT30xx
+               pAd->MacTab.Content[BSSID_WCID].AuthMode = pAd->StaCfg.AuthMode;
+#endif
                pAd->MacTab.Content[BSSID_WCID].WepStatus = pAd->StaCfg.WepStatus;
         NdisReleaseSpinLock(&pAd->MacTabLock);
 
@@ -1637,8 +1654,15 @@ 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.
+#ifdef RT30xx
+       if (!((pAd->CommonCfg.RxStream == 1)&&(pAd->CommonCfg.TxStream == 1)) &&
+               (((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))))
+#endif
+#ifndef RT30xx
        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)))
+#endif
        {
                RTMP_IO_READ32(pAd, EDCA_AC0_CFG, &Data);
                Data  &= 0xFFFFFF00;
@@ -1977,6 +2001,22 @@ VOID LinkDown(
                memset(wrqu.ap_addr.sa_data, 0, MAC_ADDR_LEN);
                wireless_send_event(pAd->net_dev, SIOCGIWAP, &wrqu, NULL);
        }
+
+#ifdef RT30xx
+       if (IS_RT3090(pAd))
+       {
+               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);
+       }
+#endif // RT30xx //
 }
 
 /*
index d615d0ab2bbf75f4aabcfc28d5aba3ff73f51806..10cb64daba4457a56115fef42dcbc59d95fda928 100644 (file)
@@ -559,7 +559,13 @@ VOID STAHandleRxMgmtFrame(
        {
 
                // We should collect RSSI not only U2M data but also my beacon
+#ifdef RT30xx
+               if ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2))
+                       && (pAd->RxAnt.EvaluatePeriod == 0))
+#endif
+#ifndef RT30xx
                if ((pHeader->FC.SubType == SUBTYPE_BEACON) && (MAC_ADDR_EQUAL(&pAd->CommonCfg.Bssid, &pHeader->Addr2)))
+#endif
                {
                        Update_Rssi_Sample(pAd, &pAd->StaCfg.RssiSample, pRxWI);
 
@@ -567,6 +573,18 @@ VOID STAHandleRxMgmtFrame(
                        pAd->StaCfg.LastSNR1 = (UCHAR)(pRxWI->SNR1);
                }
 
+#ifdef RT30xx
+               // 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 // RT30xx //
+
                // First check the size, it MUST not exceed the mlme queue size
                if (pRxWI->MPDUtotalByteCount > MGMT_DMA_BUFFER_SIZE)
                {
index b0f9ddd1ac2f6823ee2fe8ee9b01f1dde67f3321..da26e0511607dd5116a1715f5a005a28755f7301 100644 (file)
@@ -1061,6 +1061,10 @@ VOID PeerBeacon(
                        // Add the safeguard against the mismatch of adhoc wep status
                        if (pAd->StaCfg.WepStatus != pAd->ScanTab.BssEntry[Bssidx].WepStatus)
                        {
+#ifdef RT30xx
+                               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));
+#endif
                                return;
                        }
 
index c906eea163d38557d277c5ca61bbd4fbe598e6ae..58274364d78cac1a0d7481b6382409dcdf9489e1 100644 (file)
@@ -1384,10 +1384,12 @@ VOID    WpaGroupMsg1Action(
                        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;
+#ifndef RT30xx
                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;
+#endif
 
        //hex_dump("Group Key :", pAd->SharedKey[BSS0][pAd->StaCfg.DefaultKeyId].Key, LEN_TKIP_EK);
        }
@@ -1764,7 +1766,12 @@ BOOLEAN ParseKeyData(
        // Get GTK length - refer to IEEE 802.11i-2004 p.82
        GTKLEN = pKDE->Len -6;
 
+#ifdef RT30xx
+       if (GTKLEN < LEN_AES_KEY)
+#endif
+#ifndef RT30xx
        if (GTKLEN < MIN_LEN_OF_GTK)
+#endif
        {
                DBGPRINT(RT_DEBUG_ERROR, ("ERROR: GTK Key length is too short (%d) \n", GTKLEN));
         return FALSE;
@@ -1790,10 +1797,12 @@ BOOLEAN ParseKeyData(
                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;
+#ifndef RT30xx
        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;
+#endif
 
        return TRUE;