staging: vt6655: Conversion to mac80211
v2 cover staging: vt6655: Conversion to mac80211
The patches in this series convert the driver to mac80211.
As well as infrastructure mode the driver now operates in IBSS and access point modes.
Host access point is now working with hostapd in nl80211 mode.
The driver continues to operate diversity mode in infrastructure mode.
There is still a lot of work that needs doing particularly remodeling rxtx to something similar to vt6656 driver.
These patches creates huge amount of dead code that will be removed in the next series.
Changes from v1 3 additional patches fixing tsf and rssi issues
Rebased on staging-testing.
Malcolm Priestley (34):
staging: vt6655: mac80211 conversion: add new rx functions
staging: vt6655: mac80211 conversion: add new key functions
staging: vt6655: mac8021 conversion: add new tx functions
staging: vt6655: mac80211 conversion: s_cbFillTxBufHead
staging: vt6655: dead code remove s_vFillFragParameter.
staging: vt6655: mac80211 conversion: s_vFillRTSHead convert to using
struct ieee80211_hdr
staging: vt6655: mac80211 conversion: s_uFillDataHead add power saving
poll
staging: vt6655: mac80211 conversion add main mac80211 functions
staging: vt6655: mac80211 conversion add channel bands
staging: vt6655: mac80211 conversion replace suspend resume functions
staging: vt6655: mac80211 conversion: device_print_info remove
netdevice.
staging: vt6655: mac80211 conversion: changes to device_intr
staging: vt6655: mac80211 conversion: device_tx_srv tx and add report
rates
staging: vt6655: mac80211 conversion: changes to set channel
staging: vt6655: mac80211 conversion: enable power saving
staging: vt6655: mac80211 conversion: changes to CARDbSetPhyParameter
staging: vt6655: mac80211 conversion: card.c use basic_rates
staging: vt6655: CARDbSetPhyParameter replace s_vSetRSPINF with
CARDvSetRSPINF
staging: vt6655: mac80211 conversion: device_init_registers remove
legacy code
staging: vt6655: mac80211 conversion: device_free_info
staging: vt6655: switch driver over to mac80211
staging: vt6655: phy type same as bb type
staging: vt6655: mac80211 conversion: device_error remove legacy
functions
staging: vt6655: vt6655_probe remove management pointers
staging: vt6655: mac80211 conversion: PSbIsNextTBTTWakeUp convert to
mac80211 staging: vt6655: MACvSetDefaultKeyEntry replace WLAN_WEP104_KEYLEN
staging: vt6655: baseband.c replace BIT0 with BIT(0)
staging: vt6655: s_vGenerateTxParameter remove unused cbMACHdLen
staging: vt6655: device_init_registers replace spin lock
staging: vt6655: baseband.c timers replace spin lock
staging: vt6655: fifo & frag control remove big endian values
staging: vt6655: vnt_rx_data: uCurrRSSI should have the value of *rssi
staging: vt6655: don't update bUpdateBBVGA when off channel
staging: vt6655: reset tsf on dissociation
drivers/staging/vt6655/Kconfig | 4 +- drivers/staging/vt6655/baseband.c | 21 +- drivers/staging/vt6655/card.c | 185 +---- drivers/staging/vt6655/card.h | 4 +- drivers/staging/vt6655/channel.c | 152 +++- drivers/staging/vt6655/channel.h | 2 + drivers/staging/vt6655/desc.h | 33 +- drivers/staging/vt6655/device.h | 11 +- drivers/staging/vt6655/device_main.c | 1328 ++++++++++++++++++++-------------- drivers/staging/vt6655/dpc.c | 123 ++++ drivers/staging/vt6655/dpc.h | 2 + drivers/staging/vt6655/key.c | 136 ++++ drivers/staging/vt6655/key.h | 17 + drivers/staging/vt6655/mac.c | 2 +- drivers/staging/vt6655/power.c | 34 +- drivers/staging/vt6655/rxtx.c | 1098 +++++++++++----------------- drivers/staging/vt6655/rxtx.h | 14 + 17 files changed, 1698 insertions(+), 1468 deletions(-)
Signature · 1 line
2.1.0
PATCH v2 1/34 staging: vt6655: mac80211 conversion: add new rx functions
vnt_receive_frame which replaces device_receive_frame
and vnt_rx_data which handles mac80211 rx data
structures ieee80211_hw, ieee80211_vif and variable rx_rate are added in structure vnt_private
--- drivers/staging/vt6655/device.h | 6 +- drivers/staging/vt6655/device_main.c | 13 ++-- drivers/staging/vt6655/dpc.c | 123 +++++++++++++++++++++++++++++++++++ drivers/staging/vt6655/dpc.h | 2 + 4 files changed, 137 insertions(+), 7 deletions(-)
drivers/staging/vt6655/device.h +5 -1
@@ -56,6 +56,7 @@#include <linux/reboot.h> #include <linux/ethtool.h> /* Include Wireless Extension definition and check version - Jean II */ +#include <net/mac80211.h> #include <linux/wireless.h> #include <net/iw_handler.h> /* New driver API */
@@ -319,7 +320,9 @@ typedef struct __device_opt {struct vnt_private {struct pci_dev *pcid; - +/* mac80211 */ +struct ieee80211_hw *hw; +struct ieee80211_vif *vif;/* netdev */ struct net_device *dev;
@@ -378,6 +381,7 @@ struct vnt_private {u32 flags;u32 rx_buf_sz; +u8 rx_rate;int multicast_limit;pid_t MLMEThr_pid;
drivers/staging/vt6655/device_main.c +7 -6
@@ -1336,7 +1336,7 @@ static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx) pRD = pRD->next) {if (works++ >15 )break ; -if (device_receive_frame (pDevice, pRD)) { +if (vnt_receive_frame (pDevice, pRD)) {if (!device_alloc_rx_buf (pDevice, pRD)) {dev_err (&pDevice->pcid->dev,"can not allocate rx buf\n" );
@@ -1344,7 +1344,6 @@ static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx) } } pRD->m_rd0RD0.f1Owner =OWNED_BY_NIC ; - pDevice->dev->last_rx = jiffies; } pDevice->pCurrRD[uIdx] = pRD;
@@ -1360,9 +1359,12 @@ static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pRD)if (pRDInfo->skb ==NULL )return false;ASSERT (pRDInfo->skb); - pRDInfo->skb->dev = pDevice->dev; - pRDInfo->skb_dma =pci_map_single (pDevice->pcid,skb_tail_pointer (pRDInfo->skb), - pDevice->rx_buf_sz,PCI_DMA_FROMDEVICE ); + + pRDInfo->skb_dma = +pci_map_single (pDevice->pcid, +skb_put (pRDInfo->skb,skb_tailroom (pRDInfo->skb)), + pDevice->rx_buf_sz,PCI_DMA_FROMDEVICE ); + *((unsigned int *)&(pRD->m_rd0RD0)) =0 ;/* FIX cast */ pRD->m_rd0RD0.wResCount =cpu_to_le16 (pDevice->rx_buf_sz);
@@ -1380,7 +1382,6 @@ bool device_alloc_frag_buf(struct vnt_private *pDevice,if (pDeF->skb ==NULL )return false;ASSERT (pDeF->skb); - pDeF->skb->dev = pDevice->dev;return true; }
drivers/staging/vt6655/dpc.c +123 -0
126 lines not on this page · raw message
drivers/staging/vt6655/dpc.h +2 -0
@@ -39,4 +39,6 @@ device_receive_frame(PSRxDesc pCurrRD ); +bool vnt_receive_frame (struct vnt_private *priv,PSRxDesc curr_rd); +#endif /* __RXTX_H__ */
Signature · 1 line
2.1.0
PATCH v2 2/34 staging: vt6655: mac80211 conversion: add new key functions
In reply to Malcolm Priestleyvnt_key_init_table to initialize the table
vnt_set_keys to set the keys
--- drivers/staging/vt6655/device.h | 1 + drivers/staging/vt6655/key.c | 136 ++++++++++++++++++++++++++++++++++++++++ drivers/staging/vt6655/key.h | 17 +++++ 3 files changed, 154 insertions(+)
drivers/staging/vt6655/device.h +1 -0
@@ -323,6 +323,7 @@ struct vnt_private {/* mac80211 */ struct ieee80211_hw *hw;struct ieee80211_vif *vif; +unsigned long key_entry_inuse;/* netdev */ struct net_device *dev;
drivers/staging/vt6655/key.c +136 -0
139 lines not on this page · raw message
drivers/staging/vt6655/key.h +17 -0
@@ -30,6 +30,8 @@#ifndef __KEY_H__#define __KEY_H__ +#include <net/mac80211.h> +#include "ttype.h" #include "tether.h" #include "80211mgr.h"
@@ -53,6 +55,14 @@#define KEY_CTL_CCMP 0x03#define KEY_CTL_INVALID 0xFF +#define VNT_KEY_DEFAULTKEY 0x1 +#define VNT_KEY_GROUP_ADDRESS 0x2 +#define VNT_KEY_ALLGROUP 0x4 +#define VNT_KEY_GROUP 0x40 +#define VNT_KEY_PAIRWISE 0x00 +#define VNT_KEY_ONFLY 0x8000 +#define VNT_KEY_ONFLY_ALL 0x4000 + typedef struct tagSKeyItem { bool bKeyValid; unsigned long uKeyLength;
@@ -173,4 +183,11 @@ bool KeybSetAllGroupKey(unsigned char byLocalID ); +struct vnt_private ; + +int vnt_key_init_table (struct vnt_private *); + +int vnt_set_keys (struct ieee80211_hw *hw,struct ieee80211_sta *sta, +struct ieee80211_vif *vif,struct ieee80211_key_conf *key); +#endif // __KEY_H__
Signature · 1 line
2.1.0
PATCH v2 3/34 staging: vt6655: mac8021 conversion: add new tx functions
In reply to Malcolm Priestleyvnt_fill_txkey a mac80211 repacement for s_vFillTxKey
vnt_generate_fifo_header mac80211 replacement for vGenerateFIFOHeader
vnt_beacon_make for making and despatching beacon.
vnt_beacon_enable to enabling beacon
struct vnt_tx_fifo_head is also added to replace typedef struct tagSTxBufHead that will be removed later.
--- drivers/staging/vt6655/desc.h | 1 + drivers/staging/vt6655/rxtx.c | 311 ++++++++++++++++++++++++++++++++++++++++++ drivers/staging/vt6655/rxtx.h | 14 ++ 3 files changed, 326 insertions(+)
drivers/staging/vt6655/desc.h +1 -0
@@ -287,6 +287,7 @@ typedef struct tagTDES1 {STDES1 ; typedef struct tagDEVICE_TD_INFO { + void *mic_hdr; struct sk_buff *skb; unsigned char *buf; dma_addr_t skb_dma;
drivers/staging/vt6655/rxtx.c +311 -0
314 lines not on this page · raw message
drivers/staging/vt6655/rxtx.h +14 -0
@@ -173,6 +173,14 @@ struct vnt_cts_fb {u16 reserved2; } __packed; +struct vnt_tx_fifo_head { +u8 tx_key[WLAN_KEY_LEN_CCMP ]; +__le16 fifo_ctl; +__le16 time_stamp; +__le16 frag_ctl; +__le16 current_rate; +} __packed; +struct vnt_tx_short_buf_head {__le16 fifo_ctl;u16 time_stamp;
@@ -215,4 +223,10 @@ void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb,CMD_STATUS csMgmt_xmit (struct vnt_private *,PSTxMgmtPacket pPacket);CMD_STATUS csBeacon_xmit (struct vnt_private *,PSTxMgmtPacket pPacket); +int vnt_generate_fifo_header (struct vnt_private *,u32 , +PSTxDesc head_td,struct sk_buff *); +int vnt_beacon_make (struct vnt_private *,struct ieee80211_vif *); +int vnt_beacon_enable (struct vnt_private *,struct ieee80211_vif *, +struct ieee80211_bss_conf *); +#endif // __RXTX_H__
Signature · 1 line
2.1.0
PATCH v2 4/34 staging: vt6655: mac80211 conversion: s_cbFillTxBufHead
In reply to Malcolm PriestleyCovert to handle mac80211 sk_buff data removing fragmentation processing via s_vFillFragParameter and calls to vGenerateMACHeader and s_vSWencryption
fragmentation is now handled by mac80211.
There is still more todos with this function when legacy net device code have been remove from driver.
--- drivers/staging/vt6655/rxtx.c | 583 ++++-------------------------------------- 1 file changed, 46 insertions(+), 537 deletions(-)
drivers/staging/vt6655/rxtx.c +46 -537
@@ -144,7 +144,7 @@ s_vGenerateTxParameter(unsigned int cbFrameSize, bool bNeedACK, unsigned int uDMAIdx, - PSEthernetHeader psEthHeader, + void *psEthHeader, unsigned short wCurrentRate );
@@ -1176,7 +1176,7 @@ s_vGenerateTxParameter(unsigned int cbFrameSize, bool bNeedACK, unsigned int uDMAIdx, - PSEthernetHeader psEthHeader, + void *psEthHeader, unsigned short wCurrentRate ) {
@@ -1301,46 +1301,26 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, unsigned int uDMAIdx, PSTxDesc pHeadTD, PSEthernetHeader psEthHeader, unsigned char *pPacket, bool bNeedEncrypt, PSKeyItem pTransmitKey, - unsigned int uNodeIndex, unsigned int *puMACfragNum) + unsigned int is_pspoll, unsigned int *puMACfragNum) { - unsigned int cbMACHdLen; + PDEVICE_TD_INFO td_info = pHeadTD->pTDInfo; +struct sk_buff *skb = td_info->skb; +struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb); +struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; +struct vnt_tx_fifo_head *tx_buffer_head = + (struct vnt_tx_fifo_head *)td_info->buf; +u16 fifo_ctl =le16_to_cpu (tx_buffer_head->fifo_ctl);unsigned int cbFrameSize; -unsigned int cbFragmentSize;//Hdr+(IV)+payoad+(MIC)+(ICV)+FCS -unsigned int cbFragPayloadSize; -unsigned int cbLastFragmentSize;//Hdr+(IV)+payoad+(MIC)+(ICV)+FCS -unsigned int cbLastFragPayloadSize; -unsigned int uFragIdx; -unsigned char *pbyPayloadHead; -unsigned char *pbyIVHead; -unsigned char *pbyMacHdr; -unsigned short wFragType;//00:Non-Frag, 01:Start, 10:Mid, 11:Last __le16 uDuration;unsigned char *pbyBuffer; -unsigned int cbIVlen =0 ; -unsigned int cbICVlen =0 ; -unsigned int cbMIClen =0 ; -unsigned int cbFCSlen =4 ; -unsigned int cb802_1_H_len =0 ;unsigned int uLength =0 ; -unsigned int uTmpLen =0 ;unsigned int cbMICHDR =0 ; -u32 dwMICKey0, dwMICKey1; -u32 dwMIC_Priority; -u32 *pdwMIC_L; -u32 *pdwMIC_R; -u32 dwSafeMIC_L, dwSafeMIC_R;/* Fix "Last Frag Size" < "MIC length". */ -bool bMIC2Frag = false; -unsigned int uMICFragLen =0 ;unsigned int uMACfragNum =1 ;unsigned int uPadding =0 ;unsigned int cbReqCount =0 ; - -bool bNeedACK; -bool bRTS; -bool bIsAdhoc; -unsigned char *pbyType; +bool bNeedACK = (bool )(fifo_ctl &FIFOCTL_NEEDACK ); +bool bRTS = (bool )(fifo_ctl &FIFOCTL_RTS );PSTxDesc ptdCurr; -PSTxBufHead psTxBufHd = (PSTxBufHead ) pbyTxBufferAddr;unsigned int cbHeaderLength =0 ;void *pvRrvTime;struct vnt_mic_hdr *pMICHDR;
@@ -1348,72 +1328,35 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType,void *pvCTS;void *pvTxDataHd;unsigned short wTxBufSize;// FFinfo size -unsigned int uTotalCopyLength =0 ;unsigned char byFBOption =AUTO_FB_NONE ; -bool bIsWEP256 = false; -PSMgmtObject pMgmt = pDevice->pMgmt; pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd =NULL ; -if ((pDevice->op_mode ==NL80211_IFTYPE_ADHOC ) || - (pDevice->op_mode ==NL80211_IFTYPE_AP )) { -if (is_multicast_ether_addr (&(psEthHeader->abyDstAddr[0 ]))) - bNeedACK = false; -else - bNeedACK = true; - bIsAdhoc = true; - }else { -// MSDUs in Infra mode always need ACK - bNeedACK = true; - bIsAdhoc = false; - } - -if (pDevice->bLongHeader) - cbMACHdLen =WLAN_HDR_ADDR3_LEN +6 ; -else - cbMACHdLen =WLAN_HDR_ADDR3_LEN ; + cbFrameSize = skb->len +4 ; -if ((bNeedEncrypt == true) && (pTransmitKey !=NULL )) { -if (pTransmitKey->byCipherSuite ==KEY_CTL_WEP ) { - cbIVlen =4 ; - cbICVlen =4 ; -if (pTransmitKey->uKeyLength ==WLAN_WEP232_KEYLEN ) - bIsWEP256 = true; - } -if (pTransmitKey->byCipherSuite ==KEY_CTL_TKIP ) { - cbIVlen =8 ;//IV+ExtIV - cbMIClen =8 ; - cbICVlen =4 ; - } -if (pTransmitKey->byCipherSuite ==KEY_CTL_CCMP ) { - cbIVlen =8 ;//RSN Header - cbICVlen =8 ;//MIC +if (info->control.hw_key) { +switch (info->control.hw_key->cipher) { +case WLAN_CIPHER_SUITE_CCMP : cbMICHDR =sizeof (struct vnt_mic_hdr ); +default : +break ; } + + cbFrameSize += info->control.hw_key->icv_len; +if (pDevice->byLocalID >REV_ID_VT3253_A1 ) {//MAC Header should be padding 0 to DW alignment. - uPadding =4 - (cbMACHdLen%4 ); + uPadding =4 - (ieee80211_get_hdrlen_from_skb (skb) %4 ); uPadding %=4 ; } } - cbFrameSize = cbMACHdLen + cbIVlen + (cbFrameBodySize + cbMIClen) + cbICVlen + cbFCSlen; - -if ((bNeedACK == false) || - (cbFrameSize < pDevice->wRTSThreshold) || - ((cbFrameSize >= pDevice->wFragmentationThreshold) && (pDevice->wFragmentationThreshold <= pDevice->wRTSThreshold)) -) { - bRTS = false; - }else { - bRTS = true; - psTxBufHd->wFIFOCtl |= (FIFOCTL_RTS |FIFOCTL_LRETRY ); - }// // Use for AUTO FALL BACK // -if (psTxBufHd->wFIFOCtl &FIFOCTL_AUTO_FB_0 ) +if (fifo_ctl &FIFOCTL_AUTO_FB_0 ) byFBOption =AUTO_FB_0 ; -else if (psTxBufHd->wFIFOCtl &FIFOCTL_AUTO_FB_1 ) +else if (fifo_ctl &FIFOCTL_AUTO_FB_1 ) byFBOption =AUTO_FB_1 ;//////////////////////////////////////////////////////
@@ -1507,471 +1450,37 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, } }// Auto Fall Back } -memset ((void *)(pbyTxBufferAddr + wTxBufSize),0 , (cbHeaderLength - wTxBufSize)); - -////////////////////////////////////////////////////////////////// -if ((bNeedEncrypt == true) && (pTransmitKey !=NULL ) && (pTransmitKey->byCipherSuite ==KEY_CTL_TKIP )) { -if (pDevice->pMgmt->eAuthenMode ==WMAC_AUTH_WPANONE ) { - dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16 ]); - dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20 ]); - }else if ((pTransmitKey->dwKeyIndex &AUTHENTICATOR_KEY ) !=0 ) { - dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[16 ]); - dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[20 ]); - }else { - dwMICKey0 = *(u32 *)(&pTransmitKey->abyKey[24 ]); - dwMICKey1 = *(u32 *)(&pTransmitKey->abyKey[28 ]); - } -// DO Software Michael -MIC_vInit (dwMICKey0, dwMICKey1); -MIC_vAppend ((unsigned char *)&(psEthHeader->abyDstAddr[0 ]),12 ); - dwMIC_Priority =0 ; -MIC_vAppend ((unsigned char *)&dwMIC_Priority,4 ); -pr_debug ("MIC KEY: %X, %X\n" , dwMICKey0, dwMICKey1); - } - -/////////////////////////////////////////////////////////////////// - - pbyMacHdr = (unsigned char *)(pbyTxBufferAddr + cbHeaderLength); - pbyPayloadHead = (unsigned char *)(pbyMacHdr + cbMACHdLen + uPadding + cbIVlen); - pbyIVHead = (unsigned char *)(pbyMacHdr + cbMACHdLen + uPadding); - -if ((cbFrameSize > pDevice->wFragmentationThreshold) && (bNeedACK == true) && (bIsWEP256 == false)) { -// Fragmentation -// FragThreshold = Fragment size(Hdr+(IV)+fragment payload+(MIC)+(ICV)+FCS) - cbFragmentSize = pDevice->wFragmentationThreshold; - cbFragPayloadSize = cbFragmentSize - cbMACHdLen - cbIVlen - cbICVlen - cbFCSlen; -//FragNum = (FrameSize-(Hdr+FCS))/(Fragment Size -(Hrd+FCS))) - uMACfragNum = (unsigned short ) ((cbFrameBodySize + cbMIClen) / cbFragPayloadSize); - cbLastFragPayloadSize = (cbFrameBodySize + cbMIClen) % cbFragPayloadSize; -if (cbLastFragPayloadSize ==0 ) - cbLastFragPayloadSize = cbFragPayloadSize; -else - uMACfragNum++; - -//[Hdr+(IV)+last fragment payload+(MIC)+(ICV)+FCS] - cbLastFragmentSize = cbMACHdLen + cbLastFragPayloadSize + cbIVlen + cbICVlen + cbFCSlen; - -for (uFragIdx =0 ; uFragIdx < uMACfragNum; uFragIdx++) { -if (uFragIdx ==0 ) { -//========================= -// Start Fragmentation -//========================= -pr_debug ("Start Fragmentation...\n" ); - wFragType =FRAGCTL_STAFRAG ; - -//Fill FIFO,RrvTime,RTS,and CTS -s_vGenerateTxParameter (pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS, - cbFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate); -//Fill DataHead - uDuration =s_uFillDataHead (pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK, - uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate); -// Generate TX MAC Header -vGenerateMACHeader (pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt, - wFragType, uDMAIdx, uFragIdx); - -if (bNeedEncrypt == true) { -//Fill TXKEY -s_vFillTxKey (pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey, - pbyMacHdr, (unsigned short )cbFragPayloadSize, (unsigned char *)pMICHDR); -//Fill IV(ExtIV,RSNHDR) -if (pDevice->bEnableHostWEP) { - pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; - pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0; - } - } - -// 802.1H -if (ntohs (psEthHeader->wType) >ETH_DATA_LEN ) { -if ((psEthHeader->wType ==TYPE_PKT_IPX ) || - (psEthHeader->wType ==cpu_to_le16 (0xF380 ))) { -memcpy ((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0 ],6 ); - }else { -memcpy ((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_RFC1042[0 ],6 ); - } - pbyType = (unsigned char *)(pbyPayloadHead +6 ); -memcpy (pbyType, &(psEthHeader->wType),sizeof (unsigned short )); - cb802_1_H_len =8 ; - } - cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbFragPayloadSize; -//--------------------------- -// S/W or H/W Encryption -//--------------------------- - pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf; + td_info->mic_hdr = pMICHDR; - uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cb802_1_H_len; -//copy TxBufferHeader + MacHeader to desc -memcpy (pbyBuffer, (void *)psTxBufHd, uLength); - -// Copy the Packet into a tx Buffer -memcpy ((pbyBuffer + uLength), (pPacket +14 ), (cbFragPayloadSize - cb802_1_H_len)); - - uTotalCopyLength += cbFragPayloadSize - cb802_1_H_len; - -if ((bNeedEncrypt == true) && (pTransmitKey !=NULL ) && (pTransmitKey->byCipherSuite ==KEY_CTL_TKIP )) { -pr_debug ("Start MIC: %d\n" , - cbFragPayloadSize); -MIC_vAppend ((pbyBuffer + uLength - cb802_1_H_len), cbFragPayloadSize); - - } - -//--------------------------- -// S/W Encryption -//--------------------------- -if ((pDevice->byLocalID <=REV_ID_VT3253_A1 )) { -if (bNeedEncrypt) { -s_vSWencryption (pDevice, pTransmitKey, (pbyBuffer + uLength - cb802_1_H_len), (unsigned short )cbFragPayloadSize); - cbReqCount += cbICVlen; - } - } - - ptdCurr = (PSTxDesc )pHeadTD; -//-------------------- -//1.Set TSR1 & ReqCount in TxDescHead -//2.Set FragCtl in TxBufferHead -//3.Set Frame Control -//4.Set Sequence Control -//5.Get S/W generate FCS -//-------------------- -s_vFillFragParameter (pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount); - - ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding; - ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; - ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; - ptdCurr->buff_addr =cpu_to_le32 (ptdCurr->pTDInfo->skb_dma); - pDevice->iTDUsed[uDMAIdx]++; - pHeadTD = ptdCurr->next; - }else if (uFragIdx == (uMACfragNum-1 )) { -//========================= -// Last Fragmentation -//========================= -pr_debug ("Last Fragmentation...\n" ); - - wFragType =FRAGCTL_ENDFRAG ; - -//Fill FIFO,RrvTime,RTS,and CTS -s_vGenerateTxParameter (pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS, - cbLastFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate); -//Fill DataHead - uDuration =s_uFillDataHead (pDevice, byPktType, pvTxDataHd, cbLastFragmentSize, uDMAIdx, bNeedACK, - uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate); - -// Generate TX MAC Header -vGenerateMACHeader (pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt, - wFragType, uDMAIdx, uFragIdx); - -if (bNeedEncrypt == true) { -//Fill TXKEY -s_vFillTxKey (pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey, - pbyMacHdr, (unsigned short )cbLastFragPayloadSize, (unsigned char *)pMICHDR); - -if (pDevice->bEnableHostWEP) { - pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; - pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0; - } - - } - - cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbLastFragPayloadSize; -//--------------------------- -// S/W or H/W Encryption -//--------------------------- - - pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf; - - uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen; - -//copy TxBufferHeader + MacHeader to desc -memcpy (pbyBuffer, (void *)psTxBufHd, uLength); - -// Copy the Packet into a tx Buffer -if (bMIC2Frag == false) { -memcpy ((pbyBuffer + uLength), - (pPacket +14 + uTotalCopyLength), - (cbLastFragPayloadSize - cbMIClen) -); -//TODO check uTmpLen ! - uTmpLen = cbLastFragPayloadSize - cbMIClen; - - } -if ((bNeedEncrypt == true) && (pTransmitKey !=NULL ) && (pTransmitKey->byCipherSuite ==KEY_CTL_TKIP )) { -pr_debug ("LAST: uMICFragLen:%d, cbLastFragPayloadSize:%d, uTmpLen:%d\n" , - uMICFragLen, - cbLastFragPayloadSize, - uTmpLen); - -if (bMIC2Frag == false) { -if (uTmpLen !=0 ) -MIC_vAppend ((pbyBuffer + uLength), uTmpLen); - pdwMIC_L = (u32 *)(pbyBuffer + uLength + uTmpLen); - pdwMIC_R = (u32 *)(pbyBuffer + uLength + uTmpLen +4 ); -MIC_vGetMIC (pdwMIC_L, pdwMIC_R); -pr_debug ("Last MIC:%X, %X\n" , - *pdwMIC_L, *pdwMIC_R); - }else { -if (uMICFragLen >=4 ) { -memcpy ((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_R + (uMICFragLen -4 )), - (cbMIClen - uMICFragLen)); -pr_debug ("LAST: uMICFragLen >= 4: %X, %d\n" , - *(unsigned char *)((unsigned char *)&dwSafeMIC_R + (uMICFragLen -4 )), - (cbMIClen - uMICFragLen)); - - }else { -memcpy ((pbyBuffer + uLength), ((unsigned char *)&dwSafeMIC_L + uMICFragLen), - (4 - uMICFragLen)); -memcpy ((pbyBuffer + uLength + (4 - uMICFragLen)), &dwSafeMIC_R,4 ); -pr_debug ("LAST: uMICFragLen < 4: %X, %d\n" , - *(unsigned char *)((unsigned char *)&dwSafeMIC_R + uMICFragLen -4 ), - (cbMIClen - uMICFragLen)); - } - } -MIC_vUnInit (); - }else { -ASSERT (uTmpLen == (cbLastFragPayloadSize - cbMIClen)); - } - -//--------------------------- -// S/W Encryption -//--------------------------- -if ((pDevice->byLocalID <=REV_ID_VT3253_A1 )) { -if (bNeedEncrypt) { -s_vSWencryption (pDevice, pTransmitKey, (pbyBuffer + uLength), (unsigned short )cbLastFragPayloadSize); - cbReqCount += cbICVlen; - } - } - - ptdCurr = (PSTxDesc )pHeadTD; - -//-------------------- -//1.Set TSR1 & ReqCount in TxDescHead -//2.Set FragCtl in TxBufferHead -//3.Set Frame Control -//4.Set Sequence Control -//5.Get S/W generate FCS -//-------------------- - -s_vFillFragParameter (pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount); - - ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding; - ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; - ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; - ptdCurr->buff_addr =cpu_to_le32 (ptdCurr->pTDInfo->skb_dma); - pDevice->iTDUsed[uDMAIdx]++; - pHeadTD = ptdCurr->next; - - }else { -//========================= -// Middle Fragmentation -//========================= -pr_debug ("Middle Fragmentation...\n" ); - - wFragType =FRAGCTL_MIDFRAG ; - -//Fill FIFO,RrvTime,RTS,and CTS -s_vGenerateTxParameter (pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS, - cbFragmentSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate); -//Fill DataHead - uDuration =s_uFillDataHead (pDevice, byPktType, pvTxDataHd, cbFragmentSize, uDMAIdx, bNeedACK, - uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption, pDevice->wCurrentRate); - -// Generate TX MAC Header -vGenerateMACHeader (pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt, - wFragType, uDMAIdx, uFragIdx); - -if (bNeedEncrypt == true) { -//Fill TXKEY -s_vFillTxKey (pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey, - pbyMacHdr, (unsigned short )cbFragPayloadSize, (unsigned char *)pMICHDR); - -if (pDevice->bEnableHostWEP) { - pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; - pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0; - } - } - - cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cbFragPayloadSize; -//--------------------------- -// S/W or H/W Encryption -//--------------------------- - - pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf; - uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen; - -//copy TxBufferHeader + MacHeader to desc -memcpy (pbyBuffer, (void *)psTxBufHd, uLength); - -// Copy the Packet into a tx Buffer -memcpy ((pbyBuffer + uLength), - (pPacket +14 + uTotalCopyLength), - cbFragPayloadSize -); - uTmpLen = cbFragPayloadSize; - - uTotalCopyLength += uTmpLen; - -if ((bNeedEncrypt == true) && (pTransmitKey !=NULL ) && (pTransmitKey->byCipherSuite ==KEY_CTL_TKIP )) { -MIC_vAppend ((pbyBuffer + uLength), uTmpLen); - -if (uTmpLen < cbFragPayloadSize) { - bMIC2Frag = true; - uMICFragLen = cbFragPayloadSize - uTmpLen; -ASSERT (uMICFragLen < cbMIClen); - - pdwMIC_L = (u32 *)(pbyBuffer + uLength + uTmpLen); - pdwMIC_R = (u32 *)(pbyBuffer + uLength + uTmpLen +4 ); -MIC_vGetMIC (pdwMIC_L, pdwMIC_R); - dwSafeMIC_L = *pdwMIC_L; - dwSafeMIC_R = *pdwMIC_R; - -pr_debug ("MIDDLE: uMICFragLen:%d, cbFragPayloadSize:%d, uTmpLen:%d\n" , - uMICFragLen, - cbFragPayloadSize, - uTmpLen); -pr_debug ("Fill MIC in Middle frag [%d]\n" , - uMICFragLen); -pr_debug ("Get MIC:%X, %X\n" , - *pdwMIC_L, *pdwMIC_R); - } -pr_debug ("Middle frag len: %d\n" , - uTmpLen); - - }else { -ASSERT (uTmpLen == (cbFragPayloadSize)); - } - -if ((pDevice->byLocalID <=REV_ID_VT3253_A1 )) { -if (bNeedEncrypt) { -s_vSWencryption (pDevice, pTransmitKey, (pbyBuffer + uLength), (unsigned short )cbFragPayloadSize); - cbReqCount += cbICVlen; - } - } - - ptdCurr = (PSTxDesc )pHeadTD; - -//-------------------- -//1.Set TSR1 & ReqCount in TxDescHead -//2.Set FragCtl in TxBufferHead -//3.Set Frame Control -//4.Set Sequence Control -//5.Get S/W generate FCS -//-------------------- - -s_vFillFragParameter (pDevice, pbyBuffer, uDMAIdx, (void *)ptdCurr, wFragType, cbReqCount); - - ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding; - ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; - ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; - ptdCurr->buff_addr =cpu_to_le32 (ptdCurr->pTDInfo->skb_dma); - pDevice->iTDUsed[uDMAIdx]++; - pHeadTD = ptdCurr->next; - } - }// for (uMACfragNum) - }else { -//========================= -// No Fragmentation -//========================= - wFragType =FRAGCTL_NONFRAG ; - -//Set FragCtl in TxBufferHead - psTxBufHd->wFragCtl |= (unsigned short )wFragType; - -//Fill FIFO,RrvTime,RTS,and CTS -s_vGenerateTxParameter (pDevice, byPktType, (void *)psTxBufHd, pvRrvTime, pvRTS, pvCTS, - cbFrameSize, bNeedACK, uDMAIdx, psEthHeader, pDevice->wCurrentRate); -//Fill DataHead - uDuration =s_uFillDataHead (pDevice, byPktType, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK, -0 ,0 , uMACfragNum, byFBOption, pDevice->wCurrentRate); - -// Generate TX MAC Header -vGenerateMACHeader (pDevice, pbyMacHdr, uDuration, psEthHeader, bNeedEncrypt, - wFragType, uDMAIdx,0 ); - -if (bNeedEncrypt == true) { -//Fill TXKEY -s_vFillTxKey (pDevice, (unsigned char *)(psTxBufHd->adwTxKey), pbyIVHead, pTransmitKey, - pbyMacHdr, (unsigned short )cbFrameBodySize, (unsigned char *)pMICHDR); - -if (pDevice->bEnableHostWEP) { - pMgmt->sNodeDBTable[uNodeIndex].dwTSC47_16 = pTransmitKey->dwTSC47_16; - pMgmt->sNodeDBTable[uNodeIndex].wTSC15_0 = pTransmitKey->wTSC15_0; - } - } - -// 802.1H -if (ntohs (psEthHeader->wType) >ETH_DATA_LEN ) { -if ((psEthHeader->wType ==TYPE_PKT_IPX ) || - (psEthHeader->wType ==cpu_to_le16 (0xF380 ))) { -memcpy ((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_Bridgetunnel[0 ],6 ); - }else { -memcpy ((unsigned char *)(pbyPayloadHead), &pDevice->abySNAP_RFC1042[0 ],6 ); - } - pbyType = (unsigned char *)(pbyPayloadHead +6 ); -memcpy (pbyType, &(psEthHeader->wType),sizeof (unsigned short )); - cb802_1_H_len =8 ; - } - - cbReqCount = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + (cbFrameBodySize + cbMIClen); -//--------------------------- -// S/W or H/W Encryption -//--------------------------- - pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf; - uLength = cbHeaderLength + cbMACHdLen + uPadding + cbIVlen + cb802_1_H_len; - -//copy TxBufferHeader + MacHeader to desc -memcpy (pbyBuffer, (void *)psTxBufHd, uLength); - -// Copy the Packet into a tx Buffer -memcpy ((pbyBuffer + uLength), - (pPacket +14 ), - cbFrameBodySize - cb802_1_H_len -); - -if ((bNeedEncrypt == true) && (pTransmitKey !=NULL ) && (pTransmitKey->byCipherSuite ==KEY_CTL_TKIP )) { -pr_debug ("Length:%d, %d\n" , - cbFrameBodySize - cb802_1_H_len, uLength); - -MIC_vAppend ((pbyBuffer + uLength - cb802_1_H_len), cbFrameBodySize); - - pdwMIC_L = (u32 *)(pbyBuffer + uLength - cb802_1_H_len + cbFrameBodySize); - pdwMIC_R = (u32 *)(pbyBuffer + uLength - cb802_1_H_len + cbFrameBodySize +4 ); - -MIC_vGetMIC (pdwMIC_L, pdwMIC_R); -MIC_vUnInit (); - -if (pDevice->bTxMICFail == true) { - *pdwMIC_L =0 ; - *pdwMIC_R =0 ; - pDevice->bTxMICFail = false; - } +memset ((void *)(pbyTxBufferAddr + wTxBufSize),0 , (cbHeaderLength - wTxBufSize)); -pr_debug ("uLength: %d, %d\n" , uLength, cbFrameBodySize); -pr_debug ("cbReqCount:%d, %d, %d, %d\n" , - cbReqCount, cbHeaderLength, uPadding, cbIVlen); -pr_debug ("MIC:%x, %x\n" , *pdwMIC_L, *pdwMIC_R); +/* Fill FIFO,RrvTime,RTS,and CTS */ +s_vGenerateTxParameter (pDevice, byPktType, tx_buffer_head, pvRrvTime, pvRTS, pvCTS, + cbFrameSize, bNeedACK, uDMAIdx, hdr, pDevice->wCurrentRate); +/* Fill DataHead */ + uDuration =s_uFillDataHead (pDevice, byPktType, pvTxDataHd, cbFrameSize, uDMAIdx, bNeedACK, +0 ,0 , uMACfragNum, byFBOption, pDevice->wCurrentRate); - } + hdr->duration_id = uDuration; -if ((pDevice->byLocalID <=REV_ID_VT3253_A1 )) { -if (bNeedEncrypt) { -s_vSWencryption (pDevice, pTransmitKey, (pbyBuffer + uLength - cb802_1_H_len), - (unsigned short )(cbFrameBodySize + cbMIClen)); - cbReqCount += cbICVlen; - } - } + cbReqCount = cbHeaderLength + uPadding + cbFrameBodySize; + pbyBuffer = (unsigned char *)pHeadTD->pTDInfo->buf; + uLength = cbHeaderLength + uPadding; - ptdCurr = (PSTxDesc )pHeadTD; +/* Copy the Packet into a tx Buffer */ +memcpy ((pbyBuffer + uLength), pPacket, cbFrameBodySize); - ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding; - ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; - ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; - ptdCurr->buff_addr =cpu_to_le32 (ptdCurr->pTDInfo->skb_dma); -//Set TSR1 & ReqCount in TxDescHead - ptdCurr->m_td1TD1.byTCR |= (TCR_STP |TCR_EDP |EDMSDU ); - ptdCurr->m_td1TD1.wReqCount =cpu_to_le16 ((unsigned short )(cbReqCount)); + ptdCurr = (PSTxDesc )pHeadTD; - pDevice->iTDUsed[uDMAIdx]++; + ptdCurr->pTDInfo->dwReqCount = cbReqCount - uPadding; + ptdCurr->pTDInfo->dwHeaderLength = cbHeaderLength; + ptdCurr->pTDInfo->skb_dma = ptdCurr->pTDInfo->buf_dma; + ptdCurr->buff_addr =cpu_to_le32 (ptdCurr->pTDInfo->skb_dma); +/* Set TSR1 & ReqCount in TxDescHead */ + ptdCurr->m_td1TD1.byTCR |= (TCR_STP |TCR_EDP |EDMSDU ); + ptdCurr->m_td1TD1.wReqCount =cpu_to_le16 ((unsigned short )(cbReqCount)); - } *puMACfragNum = uMACfragNum;return cbHeaderLength;
Signature · 1 line
2.1.0
PATCH v2 5/34 staging: vt6655: dead code remove s_vFillFragParameter.
In reply to Malcolm Priestleys_vFillFragParameter is nolonger used.
--- drivers/staging/vt6655/rxtx.c | 47 ------------------------------------------- 1 file changed, 47 deletions(-)
drivers/staging/vt6655/rxtx.c +0 -47
@@ -148,15 +148,6 @@ s_vGenerateTxParameter(unsigned short wCurrentRate ); -static void s_vFillFragParameter ( -struct vnt_private *pDevice, -unsigned char *pbyBuffer, -unsigned int uTxType, -void *pvtdCurr, -unsigned short wFragType, -unsigned int cbReqCount -); - static unsigned int s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr, unsigned int cbFrameBodySize,
@@ -1257,44 +1248,6 @@ s_vGenerateTxParameter( } } -static -void -s_vFillFragParameter ( -struct vnt_private *pDevice, -unsigned char *pbyBuffer, -unsigned int uTxType, -void *pvtdCurr, -unsigned short wFragType, -unsigned int cbReqCount -) -{ -PSTxBufHead pTxBufHead = (PSTxBufHead ) pbyBuffer; - -if (uTxType ==TYPE_SYNCDMA ) { -PSTxSyncDesc ptdCurr = (PSTxSyncDesc )pvtdCurr; - -//Set FIFOCtl & TimeStamp in TxSyncDesc - ptdCurr->m_wFIFOCtl = pTxBufHead->wFIFOCtl; - ptdCurr->m_wTimeStamp = pTxBufHead->wTimeStamp; -//Set TSR1 & ReqCount in TxDescHead - ptdCurr->m_td1TD1.wReqCount =cpu_to_le16 ((unsigned short )(cbReqCount)); -if (wFragType ==FRAGCTL_ENDFRAG )//Last Fragmentation - ptdCurr->m_td1TD1.byTCR |= (TCR_STP |TCR_EDP |EDMSDU ); -else - ptdCurr->m_td1TD1.byTCR |= (TCR_STP |TCR_EDP ); - }else { -PSTxDesc ptdCurr = (PSTxDesc )pvtdCurr; -//Set TSR1 & ReqCount in TxDescHead - ptdCurr->m_td1TD1.wReqCount =cpu_to_le16 ((unsigned short )(cbReqCount)); -if (wFragType ==FRAGCTL_ENDFRAG )//Last Fragmentation - ptdCurr->m_td1TD1.byTCR |= (TCR_STP |TCR_EDP |EDMSDU ); -else - ptdCurr->m_td1TD1.byTCR |= (TCR_STP |TCR_EDP ); - } - - pTxBufHead->wFragCtl |= (unsigned short )wFragType;//0x0001; //0000 0000 0000 0001 -} - static unsigned int s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, unsigned char *pbyTxBufferAddr, unsigned int cbFrameBodySize,
Signature · 1 line
2.1.0
PATCH v2 6/34 staging: vt6655: mac80211 conversion: s_vFillRTSHead convert to using struct ieee80211_hdr
In reply to Malcolm PriestleyRemoving PSEthernetHeader
--- drivers/staging/vt6655/rxtx.c | 91 ++++++------------------------------------- 1 file changed, 12 insertions(+), 79 deletions(-)
drivers/staging/vt6655/rxtx.c +12 -79
@@ -127,7 +127,7 @@ s_vFillRTSHead(unsigned int cbFrameLength, bool bNeedAck, bool bDisCRC, - PSEthernetHeader psEthHeader, + struct ieee80211_hdr *hdr, unsigned short wCurrentRate, unsigned char byFBOption );
@@ -789,7 +789,7 @@ s_vFillRTSHead(unsigned int cbFrameLength, bool bNeedAck, bool bDisCRC, - PSEthernetHeader psEthHeader, + struct ieee80211_hdr *hdr, unsigned short wCurrentRate, unsigned char byFBOption )
@@ -841,22 +841,8 @@ s_vFillRTSHead(cpu_to_le16 (IEEE80211_FTYPE_CTL |IEEE80211_STYPE_RTS ); - -if ((pDevice->op_mode ==NL80211_IFTYPE_ADHOC ) || - (pDevice->op_mode ==NL80211_IFTYPE_AP )) { -ether_addr_copy (buf->data.ra, - psEthHeader->abyDstAddr); - }else { -ether_addr_copy (buf->data.ra, - pDevice->abyBSSID); - } -if (pDevice->op_mode ==NL80211_IFTYPE_AP ) -ether_addr_copy (buf->data.ta, - pDevice->abyBSSID); -else -ether_addr_copy (buf->data.ta, - psEthHeader->abySrcAddr); - +ether_addr_copy (buf->data.ra, hdr->addr1); +ether_addr_copy (buf->data.ta, hdr->addr2); }else {struct vnt_rts_g_fb *buf = pvRTS;/* Get SignalField, ServiceField & Length */
@@ -909,23 +895,8 @@ s_vFillRTSHead(cpu_to_le16 (IEEE80211_FTYPE_CTL |IEEE80211_STYPE_RTS ); - -if ((pDevice->op_mode ==NL80211_IFTYPE_ADHOC ) || - (pDevice->op_mode ==NL80211_IFTYPE_AP )) { -ether_addr_copy (buf->data.ra, - psEthHeader->abyDstAddr); - }else { -ether_addr_copy (buf->data.ra, - pDevice->abyBSSID); - } - -if (pDevice->op_mode ==NL80211_IFTYPE_AP ) -ether_addr_copy (buf->data.ta, - pDevice->abyBSSID); -else -ether_addr_copy (buf->data.ta, - psEthHeader->abySrcAddr); - +ether_addr_copy (buf->data.ra, hdr->addr1); +ether_addr_copy (buf->data.ta, hdr->addr2); }// if (byFBOption == AUTO_FB_NONE) }else if (byPktType ==PK_TYPE_11A ) {if (byFBOption ==AUTO_FB_NONE ) {
@@ -946,23 +917,8 @@ s_vFillRTSHead(cpu_to_le16 (IEEE80211_FTYPE_CTL |IEEE80211_STYPE_RTS ); - -if ((pDevice->op_mode ==NL80211_IFTYPE_ADHOC ) || - (pDevice->op_mode ==NL80211_IFTYPE_AP )) { -ether_addr_copy (buf->data.ra, - psEthHeader->abyDstAddr); - }else { -ether_addr_copy (buf->data.ra, - pDevice->abyBSSID); - } - -if (pDevice->op_mode ==NL80211_IFTYPE_AP ) -ether_addr_copy (buf->data.ta, - pDevice->abyBSSID); -else -ether_addr_copy (buf->data.ta, - psEthHeader->abySrcAddr); - +ether_addr_copy (buf->data.ra, hdr->addr1); +ether_addr_copy (buf->data.ta, hdr->addr2); }else {struct vnt_rts_a_fb *buf = pvRTS;/* Get SignalField, ServiceField & Length */
@@ -991,20 +947,8 @@ s_vFillRTSHead(cpu_to_le16 (IEEE80211_FTYPE_CTL |IEEE80211_STYPE_RTS ); -if ((pDevice->op_mode ==NL80211_IFTYPE_ADHOC ) || - (pDevice->op_mode ==NL80211_IFTYPE_AP )) { -ether_addr_copy (buf->data.ra, - psEthHeader->abyDstAddr); - }else { -ether_addr_copy (buf->data.ra, - pDevice->abyBSSID); - } -if (pDevice->op_mode ==NL80211_IFTYPE_AP ) -ether_addr_copy (buf->data.ta, - pDevice->abyBSSID); -else -ether_addr_copy (buf->data.ta, - psEthHeader->abySrcAddr); +ether_addr_copy (buf->data.ra, hdr->addr1); +ether_addr_copy (buf->data.ta, hdr->addr2); } }else if (byPktType ==PK_TYPE_11B ) {struct vnt_rts_ab *buf = pvRTS;
@@ -1023,19 +967,8 @@ s_vFillRTSHead( buf->data.frame_control =cpu_to_le16 (IEEE80211_FTYPE_CTL |IEEE80211_STYPE_RTS ); -if ((pDevice->op_mode ==NL80211_IFTYPE_ADHOC ) || - (pDevice->op_mode ==NL80211_IFTYPE_AP )) { -ether_addr_copy (buf->data.ra, - psEthHeader->abyDstAddr); - }else { -ether_addr_copy (buf->data.ra, pDevice->abyBSSID); - } - -if (pDevice->op_mode ==NL80211_IFTYPE_AP ) -ether_addr_copy (buf->data.ta, pDevice->abyBSSID); -else -ether_addr_copy (buf->data.ta, - psEthHeader->abySrcAddr); +ether_addr_copy (buf->data.ra, hdr->addr1); +ether_addr_copy (buf->data.ta, hdr->addr2); } }
Signature · 1 line
2.1.0
PATCH v2 7/34 staging: vt6655: mac80211 conversion: s_uFillDataHead add power saving poll
In reply to Malcolm PriestleyReplace variable wCurrentRate with is_pspoll.
add current_aid to structure vnt_private which is to be used by mac80211 operations.
--- drivers/staging/vt6655/device.h | 1 + drivers/staging/vt6655/rxtx.c | 64 +++++++++++++++++++++++++++++------------ 2 files changed, 47 insertions(+), 18 deletions(-)
drivers/staging/vt6655/device.h +1 -0
@@ -324,6 +324,7 @@ struct vnt_private {struct ieee80211_hw *hw;struct ieee80211_vif *vif;unsigned long key_entry_inuse; +u16 current_aid;/* netdev */ struct net_device *dev;
drivers/staging/vt6655/rxtx.c +46 -18
124 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v2 8/34 staging: vt6655: mac80211 conversion add main mac80211 functions
In reply to Malcolm PriestleyReplace existing vt6655_probe with one converted to mac80211 with the following operations
vnt_tx_80211vnt_startvnt_stopvnt_add_interfacevnt_remove_interfacevnt_configvnt_bss_info_changedvnt_prepare_multicastvnt_configurevnt_set_keyvnt_get_tsfvnt_set_tsfvnt_reset_tsf
The following variables are also added.basic_ratesmc_list_countmac_hw
--- drivers/staging/vt6655/device.h | 3 + drivers/staging/vt6655/device_main.c | 754 ++++++++++++++++++++++++++++------- 2 files changed, 621 insertions(+), 136 deletions(-)
drivers/staging/vt6655/device.h +3 -0
@@ -324,7 +324,10 @@ struct vnt_private {struct ieee80211_hw *hw;struct ieee80211_vif *vif;unsigned long key_entry_inuse; +u32 basic_rates;u16 current_aid; +int mc_list_count; +u8 mac_hw;/* netdev */ struct net_device *dev;
drivers/staging/vt6655/device_main.c +618 -136
766 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH v2 9/34 staging: vt6655: mac80211 conversion add channel bands
In reply to Malcolm PriestleyAdd rates and channels according to rf type for vnt_init_bands which is a mac80211 replacement for init_channel_table.
--- drivers/staging/vt6655/channel.c | 140 +++++++++++++++++++++++++++++++++++ drivers/staging/vt6655/channel.h | 2 + drivers/staging/vt6655/device_main.c | 2 + 3 files changed, 144 insertions(+)
drivers/staging/vt6655/channel.c +140 -0
@@ -352,6 +352,146 @@ static struct/*--------------------- Export Functions --------------------------*/ +static struct ieee80211_rate vnt_rates_bg[] = { + { .bitrate =10 , .hw_value =RATE_1M }, + { .bitrate =20 , .hw_value =RATE_2M }, + { .bitrate =55 , .hw_value =RATE_5M }, + { .bitrate =110 , .hw_value =RATE_11M }, + { .bitrate =60 , .hw_value =RATE_6M }, + { .bitrate =90 , .hw_value =RATE_9M }, + { .bitrate =120 , .hw_value =RATE_12M }, + { .bitrate =180 , .hw_value =RATE_18M }, + { .bitrate =240 , .hw_value =RATE_24M }, + { .bitrate =360 , .hw_value =RATE_36M }, + { .bitrate =480 , .hw_value =RATE_48M }, + { .bitrate =540 , .hw_value =RATE_54M }, +}; + +static struct ieee80211_rate vnt_rates_a[] = { + { .bitrate =60 , .hw_value =RATE_6M }, + { .bitrate =90 , .hw_value =RATE_9M }, + { .bitrate =120 , .hw_value =RATE_12M }, + { .bitrate =180 , .hw_value =RATE_18M }, + { .bitrate =240 , .hw_value =RATE_24M }, + { .bitrate =360 , .hw_value =RATE_36M }, + { .bitrate =480 , .hw_value =RATE_48M }, + { .bitrate =540 , .hw_value =RATE_54M }, +}; + +static struct ieee80211_channel vnt_channels_2ghz[] = { + { .center_freq =2412 , .hw_value =1 }, + { .center_freq =2417 , .hw_value =2 }, + { .center_freq =2422 , .hw_value =3 }, + { .center_freq =2427 , .hw_value =4 }, + { .center_freq =2432 , .hw_value =5 }, + { .center_freq =2437 , .hw_value =6 }, + { .center_freq =2442 , .hw_value =7 }, + { .center_freq =2447 , .hw_value =8 }, + { .center_freq =2452 , .hw_value =9 }, + { .center_freq =2457 , .hw_value =10 }, + { .center_freq =2462 , .hw_value =11 }, + { .center_freq =2467 , .hw_value =12 }, + { .center_freq =2472 , .hw_value =13 }, + { .center_freq =2484 , .hw_value =14 } +}; + +static struct ieee80211_channel vnt_channels_5ghz[] = { + { .center_freq =4915 , .hw_value =15 }, + { .center_freq =4920 , .hw_value =16 }, + { .center_freq =4925 , .hw_value =17 }, + { .center_freq =4935 , .hw_value =18 }, + { .center_freq =4940 , .hw_value =19 }, + { .center_freq =4945 , .hw_value =20 }, + { .center_freq =4960 , .hw_value =21 }, + { .center_freq =4980 , .hw_value =22 }, + { .center_freq =5035 , .hw_value =23 }, + { .center_freq =5040 , .hw_value =24 }, + { .center_freq =5045 , .hw_value =25 }, + { .center_freq =5055 , .hw_value =26 }, + { .center_freq =5060 , .hw_value =27 }, + { .center_freq =5080 , .hw_value =28 }, + { .center_freq =5170 , .hw_value =29 }, + { .center_freq =5180 , .hw_value =30 }, + { .center_freq =5190 , .hw_value =31 }, + { .center_freq =5200 , .hw_value =32 }, + { .center_freq =5210 , .hw_value =33 }, + { .center_freq =5220 , .hw_value =34 }, + { .center_freq =5230 , .hw_value =35 }, + { .center_freq =5240 , .hw_value =36 }, + { .center_freq =5260 , .hw_value =37 }, + { .center_freq =5280 , .hw_value =38 }, + { .center_freq =5300 , .hw_value =39 }, + { .center_freq =5320 , .hw_value =40 }, + { .center_freq =5500 , .hw_value =41 }, + { .center_freq =5520 , .hw_value =42 }, + { .center_freq =5540 , .hw_value =43 }, + { .center_freq =5560 , .hw_value =44 }, + { .center_freq =5580 , .hw_value =45 }, + { .center_freq =5600 , .hw_value =46 }, + { .center_freq =5620 , .hw_value =47 }, + { .center_freq =5640 , .hw_value =48 }, + { .center_freq =5660 , .hw_value =49 }, + { .center_freq =5680 , .hw_value =50 }, + { .center_freq =5700 , .hw_value =51 }, + { .center_freq =5745 , .hw_value =52 }, + { .center_freq =5765 , .hw_value =53 }, + { .center_freq =5785 , .hw_value =54 }, + { .center_freq =5805 , .hw_value =55 }, + { .center_freq =5825 , .hw_value =56 } +}; + +static struct ieee80211_supported_band vnt_supported_2ghz_band = { + .channels = vnt_channels_2ghz, + .n_channels =ARRAY_SIZE (vnt_channels_2ghz), + .bitrates = vnt_rates_bg, + .n_bitrates =ARRAY_SIZE (vnt_rates_bg), +}; + +static struct ieee80211_supported_band vnt_supported_5ghz_band = { + .channels = vnt_channels_5ghz, + .n_channels =ARRAY_SIZE (vnt_channels_5ghz), + .bitrates = vnt_rates_a, + .n_bitrates =ARRAY_SIZE (vnt_rates_a), +}; + +void vnt_init_bands (struct vnt_private *priv) +{ +struct ieee80211_channel *ch; +int i; + +switch (priv->byRFType) { +case RF_AIROHA7230 : +case RF_UW2452 : +case RF_NOTHING : +default : + ch = vnt_channels_5ghz; + +for (i =0 ; i <ARRAY_SIZE (vnt_channels_5ghz); i++) { + ch[i].max_power =0x3f ; + ch[i].flags =IEEE80211_CHAN_NO_HT40 ; + } + + priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ ] = + &vnt_supported_5ghz_band; +/* fallthrough */ +case RF_RFMD2959 : +case RF_AIROHA : +case RF_AL2230S : +case RF_UW2451 : +case RF_VT3226 : + ch = vnt_channels_2ghz; + +for (i =0 ; i <ARRAY_SIZE (vnt_channels_2ghz); i++) { + ch[i].max_power =0x3f ; + ch[i].flags =IEEE80211_CHAN_NO_HT40 ; + } + + priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ ] = + &vnt_supported_2ghz_band; +break ; + } +} +/** * is_channel_valid() - Is Country Channel Valid * @ChanneIndex: defined as VT3253 MAC channel:
drivers/staging/vt6655/channel.h +2 -0
@@ -33,6 +33,8 @@ typedef struct tagSChannelTblElement {unsigned char byMAP; } SChannelTblElement, *PSChannelTblElement; +void vnt_init_bands (struct vnt_private *); +bool is_channel_valid (unsigned int CountryCode);void init_channel_table (void *pDeviceHandler);unsigned char get_channel_mapping (void *pDeviceHandler,unsigned char byChannelNumber,CARD_PHY_TYPE ePhyType);
drivers/staging/vt6655/device_main.c +2 -0
@@ -3320,6 +3320,8 @@ int vnt_init(struct vnt_private *priv) {SET_IEEE80211_PERM_ADDR (priv->hw, priv->abyCurrentNetAddr); +vnt_init_bands (priv); +if (ieee80211_register_hw (priv->hw))return -ENODEV ;
Signature · 1 line
2.1.0
PATCH v2 10/34 staging: vt6655: mac80211 conversion replace suspend resume functions
In reply to Malcolm Priestleyadd vt6655_suspend and vt6655_resume
remove viawget_suspend and viawget_resume.
--- drivers/staging/vt6655/device_main.c | 104 ++++++++++++----------------------- 1 file changed, 34 insertions(+), 70 deletions(-)
drivers/staging/vt6655/device_main.c +34 -70
@@ -274,8 +274,6 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);#ifdef CONFIG_PM static int device_notify_reboot (struct notifier_block *,unsigned long event,void *ptr); -static int viawget_suspend (struct pci_dev *pcid,pm_message_t state); -static int viawget_resume (struct pci_dev *pcid);static struct notifier_block device_notifier = { .notifier_call = device_notify_reboot, .next = NULL,
@@ -3482,6 +3480,37 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)/*------------------------------------------------------------------*/ +#ifdef CONFIG_PM +static int vt6655_suspend (struct pci_dev *pcid,pm_message_t state) +{ +struct vnt_private *priv =pci_get_drvdata (pcid); +unsigned long flags; + +spin_lock_irqsave (&priv->lock, flags); + +pci_save_state (pcid); + +MACbShutdown (priv->PortOffset); + +pci_disable_device (pcid); +pci_set_power_state (pcid,pci_choose_state (pcid, state)); + +spin_unlock_irqrestore (&priv->lock, flags); + +return 0 ; +} + +static int vt6655_resume (struct pci_dev *pcid) +{ + +pci_set_power_state (pcid,PCI_D0 ); +pci_enable_wake (pcid,PCI_D0 ,0 ); +pci_restore_state (pcid); + +return 0 ; +} +#endif +MODULE_DEVICE_TABLE (pci, vt6655_pci_id_table);static struct pci_driver device_driver = {
@@ -3490,8 +3519,8 @@ static struct pci_driver device_driver = { .probe = vt6655_probe, .remove = vt6655_remove, #ifdef CONFIG_PM - .suspend = viawget_suspend, - .resume = viawget_resume, + .suspend = vt6655_suspend, + .resume = vt6655_resume,#endif };
@@ -3532,75 +3561,10 @@ device_notify_reboot(struct notifier_block *nb, unsigned long event, void *p)for_each_pci_dev (pdev) {if (pci_dev_driver (pdev) == &device_driver) {if (pci_get_drvdata (pdev)) -viawget_suspend (pdev,PMSG_HIBERNATE ); +vt6655_suspend (pdev,PMSG_HIBERNATE ); } } }return NOTIFY_DONE ; } - -static int -viawget_suspend (struct pci_dev *pcid,pm_message_t state) -{ -int power_status;// to silence the compiler - -struct vnt_private *pDevice =pci_get_drvdata (pcid); -PSMgmtObject pMgmt = pDevice->pMgmt; - -netif_stop_queue (pDevice->dev); -spin_lock_irq (&pDevice->lock); -pci_save_state (pcid); -del_timer (&pDevice->sTimerCommand); -del_timer (&pMgmt->sTimerSecondCallback); - pDevice->cbFreeCmdQueue =CMD_Q_SIZE ; - pDevice->uCmdDequeueIdx =0 ; - pDevice->uCmdEnqueueIdx =0 ; - pDevice->bCmdRunning = false; -MACbShutdown (pDevice->PortOffset); -MACvSaveContext (pDevice->PortOffset, pDevice->abyMacContext); - pDevice->bLinkPass = false; -memset (pMgmt->abyCurrBSSID,0 ,6 ); - pMgmt->eCurrState =WMAC_STATE_IDLE ; -pci_disable_device (pcid); - power_status =pci_set_power_state (pcid,pci_choose_state (pcid, state)); -spin_unlock_irq (&pDevice->lock); -return 0 ; -} - -static int -viawget_resume (struct pci_dev *pcid) -{ -struct vnt_private *pDevice =pci_get_drvdata (pcid); -PSMgmtObject pMgmt = pDevice->pMgmt; -int power_status;// to silence the compiler - - power_status =pci_set_power_state (pcid,PCI_D0 ); - power_status =pci_enable_wake (pcid,PCI_D0 ,0 ); -pci_restore_state (pcid); -if (netif_running (pDevice->dev)) { -spin_lock_irq (&pDevice->lock); -MACvRestoreContext (pDevice->PortOffset, pDevice->abyMacContext); -device_init_registers (pDevice); -if (pMgmt->sNodeDBTable[0 ].bActive) {// Assoc with BSS - pMgmt->sNodeDBTable[0 ].bActive = false; - pDevice->bLinkPass = false; -if (pMgmt->eCurrMode ==WMAC_MODE_IBSS_STA ) { -// In Adhoc, BSS state set back to started. - pMgmt->eCurrState =WMAC_STATE_STARTED ; - }else { - pMgmt->eCurrMode =WMAC_MODE_STANDBY ; - pMgmt->eCurrState =WMAC_STATE_IDLE ; - } - } -init_timer (&pMgmt->sTimerSecondCallback); -init_timer (&pDevice->sTimerCommand); -MACvIntEnable (pDevice->PortOffset,IMR_MASK_VALUE ); -BSSvClearBSSList ((void *)pDevice, pDevice->bLinkPass); -bScheduleCommand ((void *)pDevice,WLAN_CMD_BSSID_SCAN ,NULL ); -bScheduleCommand ((void *)pDevice,WLAN_CMD_SSID ,NULL ); -spin_unlock_irq (&pDevice->lock); - } -return 0 ; -} -#endif
Signature · 1 line
2.1.0
PATCH v2 11/34 staging: vt6655: mac80211 conversion: device_print_info remove netdevice.
In reply to Malcolm Priestleyuse dev_info for device name and pcid->irq for irq number.
--- drivers/staging/vt6655/device_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/staging/vt6655/device_main.c +4 -5
@@ -809,12 +809,11 @@ static const struct net_device_ops device_netdev_ops = {static void device_print_info (struct vnt_private *pDevice) { -struct net_device *dev = pDevice->dev; +dev_info (&pDevice->pcid->dev,"%s\n" ,get_chip_name (pDevice->chip_id)); -pr_info ("%s: %s\n" , dev->name,get_chip_name (pDevice->chip_id)); -pr_info ("%s: MAC=%pM IO=0x%lx Mem=0x%lx IRQ=%d\n" , - dev->name, dev->dev_addr, (unsigned long )pDevice->ioaddr, - (unsigned long )pDevice->PortOffset, pDevice->dev->irq); +dev_info (&pDevice->pcid->dev,"MAC=%pM IO=0x%lx Mem=0x%lx IRQ=%d\n" , + pDevice->abyCurrentNetAddr, (unsigned long )pDevice->ioaddr, + (unsigned long )pDevice->PortOffset, pDevice->pcid->irq); } static void vt6655_init_info(struct pci_dev *pcid,
Signature · 1 line
2.1.0
PATCH v2 12/34 staging: vt6655: mac80211 conversion: changes to device_intr
In reply to Malcolm PriestleyRemove net device code.
Remove current measure code and function s_vCompleteCurrentMeasure and switch code which are now handled by mac80211
Change beaconing to mac80211.
--- drivers/staging/vt6655/device_main.c | 175 ++--------------------------------- 1 file changed, 8 insertions(+), 167 deletions(-)
drivers/staging/vt6655/device_main.c +8 -167
@@ -400,45 +400,6 @@ device_set_options(struct vnt_private *pDevice) (int)pDevice->bDiversityRegCtlON); } -static void s_vCompleteCurrentMeasure (struct vnt_private *pDevice, -unsigned char byResult) -{ -unsigned int ii; -unsigned long dwDuration =0 ; -unsigned char byRPI0 =0 ; - -for (ii =1 ; ii <8 ; ii++) { - pDevice->dwRPIs[ii] *=255 ; - dwDuration |= *((unsigned short *)(pDevice->pCurrMeasureEID->sReq.abyDuration)); - dwDuration <<=10 ; - pDevice->dwRPIs[ii] /= dwDuration; - pDevice->abyRPIs[ii] = (unsigned char )pDevice->dwRPIs[ii]; - byRPI0 += pDevice->abyRPIs[ii]; - } - pDevice->abyRPIs[0 ] = (0xFF - byRPI0); - -if (pDevice->uNumOfMeasureEIDs ==0 ) { -VNTWIFIbMeasureReport (pDevice->pMgmt, - true, - pDevice->pCurrMeasureEID, - byResult, - pDevice->byBasicMap, - pDevice->byCCAFraction, - pDevice->abyRPIs - ); - }else { -VNTWIFIbMeasureReport (pDevice->pMgmt, - false, - pDevice->pCurrMeasureEID, - byResult, - pDevice->byBasicMap, - pDevice->byCCAFraction, - pDevice->abyRPIs - ); -CARDbStartMeasure (pDevice, pDevice->pCurrMeasureEID++, pDevice->uNumOfMeasureEIDs); - } -} -// // Initialisation of MAC & BBP registers //
@@ -2056,14 +2017,11 @@ static int device_xmit(struct sk_buff *skb, struct net_device *dev) {static irqreturn_t device_intr (int irq,void *dev_instance) { -struct net_device *dev = dev_instance; -struct vnt_private *pDevice =netdev_priv (dev); +struct vnt_private *pDevice = dev_instance;int max_count =0 ;unsigned long dwMIBCounter =0 ; -PSMgmtObject pMgmt = pDevice->pMgmt;unsigned char byOrgPageSel =0 ;int handled =0 ; -unsigned char byData =0 ;int ii =0 ;unsigned long flags;
@@ -2106,94 +2064,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance)device_error (pDevice, pDevice->dwIsr); } -if (pDevice->byLocalID >REV_ID_VT3253_B1 ) { -if (pDevice->dwIsr &ISR_MEASURESTART ) { -// 802.11h measure start - pDevice->byOrgChannel = pDevice->byCurrentCh; -VNSvInPortB (pDevice->PortOffset +MAC_REG_RCR , &(pDevice->byOrgRCR)); -VNSvOutPortB (pDevice->PortOffset +MAC_REG_RCR , (RCR_RXALLTYPE |RCR_UNICAST |RCR_BROADCAST |RCR_MULTICAST |RCR_WPAERR )); -MACvSelectPage1 (pDevice->PortOffset); -VNSvInPortD (pDevice->PortOffset +MAC_REG_MAR0 , &(pDevice->dwOrgMAR0)); -VNSvInPortD (pDevice->PortOffset +MAC_REG_MAR4 , &(pDevice->dwOrgMAR4)); -MACvSelectPage0 (pDevice->PortOffset); -//xxxx -if (set_channel (pDevice, pDevice->pCurrMeasureEID->sReq.byChannel)) { - pDevice->bMeasureInProgress = true; -MACvSelectPage1 (pDevice->PortOffset); -MACvRegBitsOn (pDevice->PortOffset,MAC_REG_MSRCTL ,MSRCTL_READY ); -MACvSelectPage0 (pDevice->PortOffset); - pDevice->byBasicMap =0 ; - pDevice->byCCAFraction =0 ; -for (ii =0 ; ii <8 ; ii++) - pDevice->dwRPIs[ii] =0 ; - - }else { -// can not measure because set channel fail -// clear measure control -MACvRegBitsOff (pDevice->PortOffset,MAC_REG_MSRCTL ,MSRCTL_EN ); -s_vCompleteCurrentMeasure (pDevice,MEASURE_MODE_INCAPABLE ); -MACvSelectPage1 (pDevice->PortOffset); -MACvRegBitsOn (pDevice->PortOffset,MAC_REG_MSRCTL +1 ,MSRCTL1_TXPAUSE ); -MACvSelectPage0 (pDevice->PortOffset); - } - } -if (pDevice->dwIsr &ISR_MEASUREEND ) { -// 802.11h measure end - pDevice->bMeasureInProgress = false; -VNSvOutPortB (pDevice->PortOffset +MAC_REG_RCR , pDevice->byOrgRCR); -MACvSelectPage1 (pDevice->PortOffset); -VNSvOutPortD (pDevice->PortOffset +MAC_REG_MAR0 , pDevice->dwOrgMAR0); -VNSvOutPortD (pDevice->PortOffset +MAC_REG_MAR4 , pDevice->dwOrgMAR4); -VNSvInPortB (pDevice->PortOffset +MAC_REG_MSRBBSTS , &byData); - pDevice->byBasicMap |= (byData >>4 ); -VNSvInPortB (pDevice->PortOffset +MAC_REG_CCAFRACTION , &pDevice->byCCAFraction); -VNSvInPortB (pDevice->PortOffset +MAC_REG_MSRCTL , &byData); -// clear measure control -MACvRegBitsOff (pDevice->PortOffset,MAC_REG_MSRCTL ,MSRCTL_EN ); -MACvSelectPage0 (pDevice->PortOffset); -set_channel (pDevice, pDevice->byOrgChannel); -MACvSelectPage1 (pDevice->PortOffset); -MACvRegBitsOn (pDevice->PortOffset,MAC_REG_MSRCTL +1 ,MSRCTL1_TXPAUSE ); -MACvSelectPage0 (pDevice->PortOffset); -if (byData &MSRCTL_FINISH ) { -// measure success -s_vCompleteCurrentMeasure (pDevice,0 ); - }else { -// can not measure because not ready before end of measure time -s_vCompleteCurrentMeasure (pDevice,MEASURE_MODE_LATE ); - } - } -if (pDevice->dwIsr &ISR_QUIETSTART ) { -do { - ; - }while (!CARDbStartQuiet (pDevice)); - } - } -if (pDevice->dwIsr &ISR_TBTT ) { -if (pDevice->bEnableFirstQuiet) { - pDevice->byQuietStartCount--; -if (pDevice->byQuietStartCount ==0 ) { - pDevice->bEnableFirstQuiet = false; -MACvSelectPage1 (pDevice->PortOffset); -MACvRegBitsOn (pDevice->PortOffset,MAC_REG_MSRCTL , (MSRCTL_QUIETTXCHK |MSRCTL_QUIETEN )); -MACvSelectPage0 (pDevice->PortOffset); - } - } -if (pDevice->bChannelSwitch && - (pDevice->op_mode ==NL80211_IFTYPE_STATION )) { - pDevice->byChannelSwitchCount--; -if (pDevice->byChannelSwitchCount ==0 ) { - pDevice->bChannelSwitch = false; -set_channel (pDevice, pDevice->byNewChannel); -VNTWIFIbChannelSwitch (pDevice->pMgmt, pDevice->byNewChannel); -MACvSelectPage1 (pDevice->PortOffset); -MACvRegBitsOn (pDevice->PortOffset,MAC_REG_MSRCTL +1 ,MSRCTL1_TXPAUSE ); -MACvSelectPage0 (pDevice->PortOffset); -CARDbStartTxPacket (pDevice,PKT_TYPE_802_11_ALL ); - - } - }if (pDevice->op_mode !=NL80211_IFTYPE_ADHOC ) {if ((pDevice->bUpdateBBVGA) && pDevice->bLinkPass && (pDevice->uCurrRSSI !=0 )) {long ldBm;
@@ -2234,10 +2105,11 @@ static irqreturn_t device_intr(int irq, void *dev_instance)if (pDevice->bEnablePSMode)PSbIsNextTBTTWakeUp ((void *)pDevice); -if ((pDevice->op_mode ==NL80211_IFTYPE_AP ) || - (pDevice->op_mode ==NL80211_IFTYPE_ADHOC )) { +if ((pDevice->op_mode ==NL80211_IFTYPE_AP || + pDevice->op_mode ==NL80211_IFTYPE_ADHOC ) && + pDevice->vif->bss_conf.enable_beacon) {MACvOneShotTimer1MicroSec (pDevice->PortOffset, - (pMgmt->wIBSSBeaconPeriod -MAKE_BEACON_RESERVED ) <<10 ); + (pDevice->vif->bss_conf.beacon_int -MAKE_BEACON_RESERVED ) <<10 ); }/* TODO: adhoc PS mode */
@@ -2250,34 +2122,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance) pDevice->cbBeaconBufReadySetCnt =0 ; } -if (pDevice->op_mode ==NL80211_IFTYPE_AP ) { -if (pMgmt->byDTIMCount >0 ) { - pMgmt->byDTIMCount--; - pMgmt->sNodeDBTable[0 ].bRxPSPoll = false; - }else { -if (pMgmt->byDTIMCount ==0 ) { -// check if mutltcast tx bufferring - pMgmt->byDTIMCount = pMgmt->byDTIMPeriod -1 ; - pMgmt->sNodeDBTable[0 ].bRxPSPoll = true; -bScheduleCommand ((void *)pDevice,WLAN_CMD_RX_PSPOLL ,NULL ); - } - } - } pDevice->bBeaconSent = true; - -if (pDevice->bChannelSwitch) { - pDevice->byChannelSwitchCount--; -if (pDevice->byChannelSwitchCount ==0 ) { - pDevice->bChannelSwitch = false; -set_channel (pDevice, pDevice->byNewChannel); -VNTWIFIbChannelSwitch (pDevice->pMgmt, pDevice->byNewChannel); -MACvSelectPage1 (pDevice->PortOffset); -MACvRegBitsOn (pDevice->PortOffset,MAC_REG_MSRCTL +1 ,MSRCTL1_TXPAUSE ); -MACvSelectPage0 (pDevice->PortOffset); -CARDbStartTxPacket (pDevice,PKT_TYPE_802_11_ALL ); - } - } - }if (pDevice->dwIsr &ISR_RXDMA0 )
@@ -2293,14 +2138,10 @@ static irqreturn_t device_intr(int irq, void *dev_instance) max_count +=device_tx_srv (pDevice,TYPE_AC0DMA );if (pDevice->dwIsr &ISR_SOFTTIMER1 ) { -if (pDevice->op_mode ==NL80211_IFTYPE_AP ) { -if (pDevice->bShortSlotTime) - pMgmt->wCurrCapInfo |=WLAN_SET_CAP_INFO_SHORTSLOTTIME (1 ); -else - pMgmt->wCurrCapInfo &= ~(WLAN_SET_CAP_INFO_SHORTSLOTTIME (1 )); +if (pDevice->vif) { +if (pDevice->vif->bss_conf.enable_beacon) +vnt_beacon_make (pDevice, pDevice->vif); } -bMgrPrepareBeaconToSend (pDevice, pMgmt); - pDevice->byCntMeasure =0 ; }MACvReadISR (pDevice->PortOffset, &pDevice->dwIsr);
Signature · 1 line
2.1.0
PATCH v2 13/34 staging: vt6655: mac80211 conversion: device_tx_srv tx and add report rates
In reply to Malcolm Priestleyvnt_int_report_rate reports backs tx rate and is replacment for STAvUpdateTDStatCounter and BSSvUpdateNodeTxCounter.
Replacing existing code.
--- drivers/staging/vt6655/device_main.c | 166 ++++++++++++++++++----------------- 1 file changed, 85 insertions(+), 81 deletions(-)
drivers/staging/vt6655/device_main.c +85 -81
@@ -1208,19 +1208,84 @@ bool device_alloc_frag_buf(struct vnt_private *pDevice,return true; } +static const u8 fallback_rate0[5 ][5 ] = { + {RATE_18M ,RATE_18M ,RATE_12M ,RATE_12M ,RATE_12M }, + {RATE_24M ,RATE_24M ,RATE_18M ,RATE_12M ,RATE_12M }, + {RATE_36M ,RATE_36M ,RATE_24M ,RATE_18M ,RATE_18M }, + {RATE_48M ,RATE_48M ,RATE_36M ,RATE_24M ,RATE_24M }, + {RATE_54M ,RATE_54M ,RATE_48M ,RATE_36M ,RATE_36M } +}; + +static const u8 fallback_rate1[5 ][5 ] = { + {RATE_18M ,RATE_18M ,RATE_12M ,RATE_6M ,RATE_6M }, + {RATE_24M ,RATE_24M ,RATE_18M ,RATE_6M ,RATE_6M }, + {RATE_36M ,RATE_36M ,RATE_24M ,RATE_12M ,RATE_12M }, + {RATE_48M ,RATE_48M ,RATE_24M ,RATE_12M ,RATE_12M }, + {RATE_54M ,RATE_54M ,RATE_36M ,RATE_18M ,RATE_18M } +}; + +static int vnt_int_report_rate (struct vnt_private *priv, +PDEVICE_TD_INFO context,u8 tsr0,u8 tsr1) +{ +struct vnt_tx_fifo_head *fifo_head; +struct ieee80211_tx_info *info; +struct ieee80211_rate *rate; +u16 fb_option; +u8 tx_retry = (tsr0 &TSR0_NCR ); +s8 idx; + +if (!context) +return -ENOMEM ; + +if (!context->skb) +return -EINVAL ; + + fifo_head = (struct vnt_tx_fifo_head *)context->buf; + fb_option = (le16_to_cpu (fifo_head->fifo_ctl) & + (FIFOCTL_AUTO_FB_0 |FIFOCTL_AUTO_FB_1 )); + + info =IEEE80211_SKB_CB (context->skb); + idx = info->control.rates[0 ].idx; + +if (fb_option && !(tsr1 &TSR1_TERR )) { +u8 tx_rate; +u8 retry = tx_retry; + + rate =ieee80211_get_tx_rate (priv->hw, info); + tx_rate = rate->hw_value -RATE_18M ; + +if (retry >4 ) + retry =4 ; + +if (fb_option &FIFOCTL_AUTO_FB_0 ) + tx_rate = fallback_rate0[tx_rate][retry]; +else if (fb_option &FIFOCTL_AUTO_FB_1 ) + tx_rate = fallback_rate1[tx_rate][retry]; + +if (info->band ==IEEE80211_BAND_5GHZ ) + idx = tx_rate -RATE_6M ; +else + idx = tx_rate; + } + +ieee80211_tx_info_clear_status (info); + + info->status.rates[0 ].count = tx_retry; + +if (!(tsr1 &TSR1_TERR )) { + info->status.rates[0 ].idx = idx; + info->flags |=IEEE80211_TX_STAT_ACK ; + } + +return 0 ; +} +static int device_tx_srv (struct vnt_private *pDevice,unsigned int uIdx) {PSTxDesc pTD; -bool bFull = false;int works =0 ;unsigned char byTsr0;unsigned char byTsr1; -unsigned int uFrameSize, uFIFOHeaderSize; -PSTxBufHead pTxBufHead; -struct net_device_stats *pStats = &pDevice->dev->stats; -struct sk_buff *skb; -unsigned int uNodeIndex; -PSMgmtObject pMgmt = pDevice->pMgmt;for (pTD = pDevice->apTailTD[uIdx]; pDevice->iTDUsed[uIdx] >0 ; pTD = pTD->next) {if (pTD->m_td0TD0.f1Owner ==OWNED_BY_NIC )
@@ -1234,22 +1299,8 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx)//Only the status of first TD in the chain is correct if (pTD->m_td1TD1.byTCR &TCR_STP ) {if ((pTD->pTDInfo->byFlags &TD_FLAGS_NETIF_SKB ) !=0 ) { - uFIFOHeaderSize = pTD->pTDInfo->dwHeaderLength; - uFrameSize = pTD->pTDInfo->dwReqCount - uFIFOHeaderSize; - pTxBufHead = (PSTxBufHead) (pTD->pTDInfo->buf); -// Update the statistics based on the Transmit status -// now, we DONT check TSR0_CDH - -STAvUpdateTDStatCounter (&pDevice->scStatistic, - byTsr0, byTsr1, - (unsigned char *)(pTD->pTDInfo->buf + uFIFOHeaderSize), - uFrameSize, uIdx); - -BSSvUpdateNodeTxCounter (pDevice, - byTsr0, byTsr1, - (unsigned char *)(pTD->pTDInfo->buf), - uFIFOHeaderSize - ); + +vnt_int_report_rate (pDevice, pTD->pTDInfo, byTsr0, byTsr1);if (!(byTsr1 &TSR1_TERR )) {if (byTsr0 !=0 ) {
@@ -1257,28 +1308,9 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx) (int )uIdx, byTsr1, byTsr0); } -if ((pTxBufHead->wFragCtl &FRAGCTL_ENDFRAG ) !=FRAGCTL_NONFRAG ) - pDevice->s802_11Counter.TransmittedFragmentCount++; - - pStats->tx_packets++; - pStats->tx_bytes += pTD->pTDInfo->skb->len; }else {pr_debug (" Tx[%d] dropped & tsr1[%02X] tsr0[%02X]\n" , (int )uIdx, byTsr1, byTsr0); - pStats->tx_errors++; - pStats->tx_dropped++; - } - } - -if ((pTD->pTDInfo->byFlags &TD_FLAGS_PRIV_SKB ) !=0 ) { -if (pDevice->bEnableHostapd) { -pr_debug ("tx call back netif..\n" ); - skb = pTD->pTDInfo->skb; - skb->dev = pDevice->apdev; -skb_reset_mac_header (skb); - skb->pkt_type =PACKET_OTHERHOST ; -memset (skb->cb,0 ,sizeof (skb->cb)); -netif_rx (skb); } }
@@ -1287,47 +1319,14 @@ static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx)pr_debug (" Tx[%d] fail has error. tsr1[%02X] tsr0[%02X]\n" , (int )uIdx, byTsr1, byTsr0); } - - -if ((pMgmt->eCurrMode ==WMAC_MODE_ESS_AP ) && - (pTD->pTDInfo->byFlags &TD_FLAGS_NETIF_SKB )) { -unsigned short wAID; -unsigned char byMask[8 ] = {1 ,2 ,4 ,8 ,0x10 ,0x20 ,0x40 ,0x80 }; - - skb = pTD->pTDInfo->skb; -if (BSSDBbIsSTAInNodeDB (pMgmt, (unsigned char *)(skb->data), &uNodeIndex)) { -if (pMgmt->sNodeDBTable[uNodeIndex].bPSEnable) { -skb_queue_tail (&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue, skb); - pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt++; -// set tx map - wAID = pMgmt->sNodeDBTable[uNodeIndex].wAID; - pMgmt->abyPSTxMap[wAID >>3 ] |= byMask[wAID &7 ]; - pTD->pTDInfo->byFlags &= ~(TD_FLAGS_NETIF_SKB ); -pr_debug ("tx_srv:tx fail re-queue sta index= %d, QueCnt= %d\n" , - (int )uNodeIndex, - pMgmt->sNodeDBTable[uNodeIndex].wEnQueueCnt); - pStats->tx_errors--; - pStats->tx_dropped--; - } - } - } }device_free_tx_buf (pDevice, pTD); pDevice->iTDUsed[uIdx]--; - } - } - -if (uIdx ==TYPE_AC0DMA ) { -// RESERV_AC0DMA reserved for relay -if (AVAIL_TD (pDevice, uIdx) <RESERV_AC0DMA ) { - bFull = true; -pr_debug (" AC0DMA is Full = %d\n" , - pDevice->iTDUsed[uIdx]); +/* Make sure queue is available */ +if (AVAIL_TD (pDevice, uIdx)) +ieee80211_wake_queues (pDevice->hw); } -if (netif_queue_stopped (pDevice->dev) && !bFull) -netif_wake_queue (pDevice->dev); - } pDevice->apTailTD[uIdx] = pTD;
@@ -1360,7 +1359,9 @@ static void device_free_tx_buf(struct vnt_private *pDevice, PSTxDesc pDesc) PCI_DMA_TODEVICE); } -if ((pTDInfo->byFlags &TD_FLAGS_NETIF_SKB ) !=0 ) +if (pTDInfo->byFlags &TD_FLAGS_NETIF_SKB ) +ieee80211_tx_status_irqsafe (pDevice->hw, skb); +else dev_kfree_skb_irq (skb); pTDInfo->skb_dma =0 ;
@@ -2065,8 +2066,11 @@ static irqreturn_t device_intr(int irq, void *dev_instance) }if (pDevice->dwIsr &ISR_TBTT ) { -if (pDevice->op_mode !=NL80211_IFTYPE_ADHOC ) { -if ((pDevice->bUpdateBBVGA) && pDevice->bLinkPass && (pDevice->uCurrRSSI !=0 )) { +if (pDevice->vif && + pDevice->op_mode !=NL80211_IFTYPE_ADHOC ) { +if (pDevice->bUpdateBBVGA && + pDevice->vif->bss_conf.assoc && + pDevice->uCurrRSSI) {long ldBm;RFvRSSITodBm (pDevice, (unsigned char ) pDevice->uCurrRSSI, &ldBm);
Signature · 1 line
2.1.0
PATCH v2 14/34 staging: vt6655: mac80211 conversion: changes to set channel
In reply to Malcolm PriestleyRemove call to sChannelTbl, the channel under mac80211 is always valid.
CARDbSetPhyParameter is nolonger set here.
RFbSetPower is now set on byBBType
--- drivers/staging/vt6655/channel.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/staging/vt6655/channel.c +1 -11
@@ -665,16 +665,6 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)if (pDevice->byCurrentCh == uConnectionChannel)return bResult; -if (!sChannelTbl[uConnectionChannel].bValid) -return false; - -if ((uConnectionChannel >CB_MAX_CHANNEL_24G ) && - (pDevice->eCurrentPHYType !=PHY_TYPE_11A )) { -CARDbSetPhyParameter (pDevice,PHY_TYPE_11A ,0 ,0 ,NULL ,NULL ); - }else if ((uConnectionChannel <=CB_MAX_CHANNEL_24G ) && - (pDevice->eCurrentPHYType ==PHY_TYPE_11A )) { -CARDbSetPhyParameter (pDevice,PHY_TYPE_11G ,0 ,0 ,NULL ,NULL ); - }/* clear NAV */ MACvRegBitsOn (pDevice->PortOffset,MAC_REG_MACCR ,MACCR_CLRNAV );
@@ -702,7 +692,7 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)MACvSelectPage0 (pDevice->PortOffset); } -if (pDevice->eCurrentPHYType ==PHY_TYPE_11B ) +if (pDevice->byBBType ==BB_TYPE_11B )RFbSetPower (pDevice,RATE_1M , pDevice->byCurrentCh);else RFbSetPower (pDevice,RATE_6M , pDevice->byCurrentCh);
Signature · 1 line
2.1.0
PATCH v2 15/34 staging: vt6655: mac80211 conversion: enable power saving
In reply to Malcolm PriestleyConvert PSvEnablePowerSaving and PSvEnablePowerSaving
Remove mgmt->wCurrAID and use pDevice->current_aid
We nolonger send the PSbSendNullPacket.
--- drivers/staging/vt6655/power.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/staging/vt6655/power.c +3 -12
@@ -73,8 +73,7 @@ PSvEnablePowerSaving( ) {struct vnt_private *pDevice = hDeviceContext; -PSMgmtObject pMgmt = pDevice->pMgmt; -unsigned short wAID = pMgmt->wCurrAID |BIT14 |BIT15 ; +u16 wAID = pDevice->current_aid |BIT (14 ) |BIT (15 );// set period of power up before TBTT VNSvOutPortW (pDevice->PortOffset +MAC_REG_PWBT ,C_PWBT );
@@ -83,7 +82,9 @@ PSvEnablePowerSaving(VNSvOutPortW (pDevice->PortOffset +MAC_REG_AIDATIM , wAID); }else {// set ATIM Window +#if 0 /* TODO atim window */ MACvWriteATIMW (pDevice->PortOffset, pMgmt->wCurrATIMWindow); +#endif }// Set AutoSleep MACvRegBitsOn (pDevice->PortOffset,MAC_REG_PSCFG ,PSCFG_AUTOSLEEP );
@@ -95,22 +96,15 @@ PSvEnablePowerSaving(MACvRegBitsOff (pDevice->PortOffset,MAC_REG_PSCTL ,PSCTL_ALBCN );// first time set listen next beacon MACvRegBitsOn (pDevice->PortOffset,MAC_REG_PSCTL ,PSCTL_LNBCN ); - pMgmt->wCountToWakeUp = wListenInterval; }else {// always listen beacon MACvRegBitsOn (pDevice->PortOffset,MAC_REG_PSCTL ,PSCTL_ALBCN ); - pMgmt->wCountToWakeUp =0 ; }// enable power saving hw function MACvRegBitsOn (pDevice->PortOffset,MAC_REG_PSCTL ,PSCTL_PSEN ); pDevice->bEnablePSMode = true; -/* We don't send null pkt in ad hoc mode since beacon will handle this. */ -if (pDevice->op_mode !=NL80211_IFTYPE_ADHOC && - pDevice->op_mode ==NL80211_IFTYPE_STATION ) -PSbSendNullPacket (pDevice); - pDevice->bPWBitOn = true;pr_debug ("PS:Power Saving Mode Enable...\n" ); }
@@ -143,9 +137,6 @@ PSvDisablePowerSaving( pDevice->bEnablePSMode = false; -if (pDevice->op_mode ==NL80211_IFTYPE_STATION ) -PSbSendNullPacket (pDevice); - pDevice->bPWBitOn = false; }
Signature · 1 line
2.1.0
PATCH v2 16/34 staging: vt6655: mac80211 conversion: changes to CARDbSetPhyParameter
In reply to Malcolm PriestleyCARDbSetPhyParameter appears to use two different strutures to find supported rates.
Remove PWLAN_IE_SUPP_RATES and use basic_rates to find rates supported.
mac80211 now sets bShortSlotTime, bBarkerPreambleMd and byPreambleType remove these.
--- drivers/staging/vt6655/card.c | 61 ++++++++----------------------------------- 1 file changed, 11 insertions(+), 50 deletions(-)
drivers/staging/vt6655/card.c +11 -50
@@ -74,15 +74,6 @@#define WAIT_BEACON_TX_DOWN_TMO 3/* Times */ -/* 1M, 2M, 5M, 11M, 18M, 24M, 36M, 54M */ -static unsigned char abyDefaultSuppRatesG[] = {WLAN_EID_SUPP_RATES ,8 ,0x02 ,0x04 ,0x0B ,0x16 ,0x24 ,0x30 ,0x48 ,0x6C }; -/* 6M, 9M, 12M, 48M */ -static unsigned char abyDefaultExtSuppRatesG[] = {WLAN_EID_EXTSUPP_RATES ,4 ,0x0C ,0x12 ,0x18 ,0x60 }; -/* 6M, 9M, 12M, 18M, 24M, 36M, 48M, 54M */ -static unsigned char abyDefaultSuppRatesA[] = {WLAN_EID_SUPP_RATES ,8 ,0x0C ,0x12 ,0x18 ,0x24 ,0x30 ,0x48 ,0x60 ,0x6C }; -/* 1M, 2M, 5M, 11M, */ -static unsigned char abyDefaultSuppRatesB[] = {WLAN_EID_SUPP_RATES ,4 ,0x02 ,0x04 ,0x0B ,0x16 }; -/*--------------------- Static Variables --------------------------*/ static const unsigned short cwRXBCNTSFOff[MAX_RATE] =
@@ -384,14 +375,10 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,unsigned char bySIFS =0 ;unsigned char byDIFS =0 ;unsigned char byData; -PWLAN_IE_SUPP_RATES pSupportRates = (PWLAN_IE_SUPP_RATES ) pvSupportRateIEs; -PWLAN_IE_SUPP_RATES pExtSupportRates = (PWLAN_IE_SUPP_RATES ) pvExtSupportRateIEs; +int i;/* Set SIFS, DIFS, EIFS, SlotTime, CwMin */ if (ePHYType ==PHY_TYPE_11A ) { -if (pSupportRates ==NULL ) - pSupportRates = (PWLAN_IE_SUPP_RATES ) abyDefaultSuppRatesA; -if (pDevice->byRFType ==RF_AIROHA7230 ) {/* AL7230 use single PAPE and connect to PAPE_2.4G */ MACvSetBBType (pDevice->PortOffset,BB_TYPE_11G );
@@ -419,9 +406,6 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType, byDIFS =C_SIFS_A +2 *C_SLOT_SHORT ; byCWMaxMin =0xA4 ; }else if (ePHYType ==PHY_TYPE_11B ) { -if (pSupportRates ==NULL ) - pSupportRates = (PWLAN_IE_SUPP_RATES ) abyDefaultSuppRatesB; -MACvSetBBType (pDevice->PortOffset,BB_TYPE_11B );if (pDevice->byRFType ==RF_AIROHA7230 ) { pDevice->abyBBVGA[0 ] =0x1C ;
@@ -445,10 +429,6 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType, byDIFS =C_SIFS_BG +2 *C_SLOT_LONG ; byCWMaxMin =0xA5 ; }else {/* PK_TYPE_11GA & PK_TYPE_11GB */ -if (pSupportRates ==NULL ) { - pSupportRates = (PWLAN_IE_SUPP_RATES ) abyDefaultSuppRatesG; - pExtSupportRates = (PWLAN_IE_SUPP_RATES ) abyDefaultExtSuppRatesG; - }MACvSetBBType (pDevice->PortOffset,BB_TYPE_11G );if (pDevice->byRFType ==RF_AIROHA7230 ) { pDevice->abyBBVGA[0 ] =0x1C ;
@@ -468,32 +448,22 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType, }BBbWriteEmbedded (pDevice->PortOffset,0x88 ,0x08 ); bySIFS =C_SIFS_BG ; -if (VNTWIFIbIsShortSlotTime (wCapInfo)) { + +if (pDevice->bShortSlotTime) { bySlot =C_SLOT_SHORT ; byDIFS =C_SIFS_BG +2 *C_SLOT_SHORT ; }else { bySlot =C_SLOT_LONG ; byDIFS =C_SIFS_BG +2 *C_SLOT_LONG ; } -if (VNTWIFIbyGetMaxSupportRate (pSupportRates, pExtSupportRates) >RATE_11M ) - byCWMaxMin =0xA4 ; -else - byCWMaxMin =0xA5 ; -if (pDevice->bProtectMode !=VNTWIFIbIsProtectMode (byERPField)) { - pDevice->bProtectMode =VNTWIFIbIsProtectMode (byERPField); -if (pDevice->bProtectMode) -MACvEnableProtectMD (pDevice->PortOffset); -else -MACvDisableProtectMD (pDevice->PortOffset); + byCWMaxMin =0xa4 ; - } -if (pDevice->bBarkerPreambleMd !=VNTWIFIbIsBarkerMode (byERPField)) { - pDevice->bBarkerPreambleMd =VNTWIFIbIsBarkerMode (byERPField); -if (pDevice->bBarkerPreambleMd) -MACvEnableBarkerPreambleMd (pDevice->PortOffset); -else -MACvDisableBarkerPreambleMd (pDevice->PortOffset); +for (i =RATE_54M ; i >=RATE_6M ; i--) { +if (pDevice->basic_rates & ((u32)(0x1 << i))) { + byCWMaxMin |=0x1 ; +break ; + } } }
@@ -526,10 +496,6 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,if (pDevice->bySlot != bySlot) { pDevice->bySlot = bySlot;VNSvOutPortB (pDevice->PortOffset +MAC_REG_SLOT , pDevice->bySlot); -if (pDevice->bySlot ==C_SLOT_SHORT ) - pDevice->bShortSlotTime = true; -else - pDevice->bShortSlotTime = false;BBvSetShortSlotTime (pDevice); }
@@ -537,14 +503,9 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType, pDevice->byCWMaxMin = byCWMaxMin;VNSvOutPortB (pDevice->PortOffset +MAC_REG_CWMAXMIN0 , pDevice->byCWMaxMin); } -if (VNTWIFIbIsShortPreamble (wCapInfo)) - pDevice->byPreambleType = pDevice->byShortPreamble; -else - pDevice->byPreambleType =0 ; -s_vSetRSPINF (pDevice, ePHYType, pSupportRates, pExtSupportRates); - pDevice->eCurrentPHYType = ePHYType; -/* set for NDIS OID_802_11SUPPORTED_RATES */ +s_vSetRSPINF (pDevice, ePHYType,NULL ,NULL ); +return true; }
Signature · 1 line
2.1.0
PATCH v2 17/34 staging: vt6655: mac80211 conversion: card.c use basic_rates
In reply to Malcolm PriestleyUse basic_rates to find cck and ofdm rates.
wBasicRate will be removed later.
--- drivers/staging/vt6655/card.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/vt6655/card.c +3 -3
@@ -1457,7 +1457,7 @@ static unsigned short CARDwGetCCKControlRate(struct vnt_private *pDevice,unsigned int ui = (unsigned int ) wRateIdx;while (ui >RATE_1M ) { -if (pDevice->wBasicRate & ((unsigned short )1 << ui)) +if (pDevice->basic_rates & ((u32 )0x1 << ui))return (unsigned short )ui; ui--;
@@ -1482,7 +1482,7 @@ static unsigned short CARDwGetOFDMControlRate(struct vnt_private *pDevice, {unsigned int ui = (unsigned int ) wRateIdx; -pr_debug ("BASIC RATE: %X\n" , pDevice->wBasicRate); +pr_debug ("BASIC RATE: %X\n" , pDevice->basic_rates);if (!CARDbIsOFDMinBasicRate ((void *)pDevice)) {pr_debug ("CARDwGetOFDMControlRate:(NO OFDM) %d\n" , wRateIdx);
@@ -1491,7 +1491,7 @@ static unsigned short CARDwGetOFDMControlRate(struct vnt_private *pDevice,return wRateIdx; }while (ui >RATE_11M ) { -if (pDevice->wBasicRate & ((unsigned short )1 << ui)) { +if (pDevice->basic_rates & ((u32 )0x1 << ui)) {pr_debug ("CARDwGetOFDMControlRate : %d\n" , ui);return (unsigned short )ui; }
Signature · 1 line
2.1.0
PATCH v2 18/34 staging: vt6655: CARDbSetPhyParameter replace s_vSetRSPINF with CARDvSetRSPINF
In reply to Malcolm PriestleyRemoving s_vSetRSPINF
--- drivers/staging/vt6655/card.c | 120 +----------------------------------------- 1 file changed, 1 insertion(+), 119 deletions(-)
drivers/staging/vt6655/card.c +1 -119
@@ -198,124 +198,6 @@ s_vCalculateOFDMRParameter( } } -/* -* Description: Set RSPINF -* -* Parameters: -* In: -* pDevice - The adapter to be set -* Out: -* none -* -* Return Value: None. -*/ -static -void -s_vSetRSPINF (struct vnt_private *pDevice,CARD_PHY_TYPE ePHYType, -void *pvSupportRateIEs,void *pvExtSupportRateIEs) -{ -union vnt_phy_field_swap phy; -unsigned char byTxRate =0 , byRsvTime =0 ;/* For OFDM */ - -/* Set to Page1 */ -MACvSelectPage1 (pDevice->PortOffset); - -/* RSPINF_b_1 */ -vnt_get_phy_field (pDevice, -14 , -VNTWIFIbyGetACKTxRate (RATE_1M , pvSupportRateIEs, pvExtSupportRateIEs), -PK_TYPE_11B , - &phy.field_read); - -/* swap over to get correct write order */ -swap (phy.swap[0 ], phy.swap[1 ]); - -VNSvOutPortD (pDevice->PortOffset +MAC_REG_RSPINF_B_1 , phy.field_write); - -/* RSPINF_b_2 */ -vnt_get_phy_field (pDevice,14 , -VNTWIFIbyGetACKTxRate (RATE_2M , pvSupportRateIEs, pvExtSupportRateIEs), -PK_TYPE_11B , &phy.field_read); - -swap (phy.swap[0 ], phy.swap[1 ]); - -VNSvOutPortD (pDevice->PortOffset +MAC_REG_RSPINF_B_2 , phy.field_write); - -/* RSPINF_b_5 */ -vnt_get_phy_field (pDevice,14 , -VNTWIFIbyGetACKTxRate (RATE_5M , pvSupportRateIEs, pvExtSupportRateIEs), -PK_TYPE_11B , &phy.field_read); - -swap (phy.swap[0 ], phy.swap[1 ]); - -VNSvOutPortD (pDevice->PortOffset +MAC_REG_RSPINF_B_5 , phy.field_write); - -/* RSPINF_b_11 */ -vnt_get_phy_field (pDevice,14 , -VNTWIFIbyGetACKTxRate (RATE_11M , pvSupportRateIEs, pvExtSupportRateIEs), -PK_TYPE_11B , &phy.field_read); - -swap (phy.swap[0 ], phy.swap[1 ]); - -VNSvOutPortD (pDevice->PortOffset +MAC_REG_RSPINF_B_11 , phy.field_write); - -/* RSPINF_a_6 */ -s_vCalculateOFDMRParameter (RATE_6M , - ePHYType, - &byTxRate, - &byRsvTime); -VNSvOutPortW (pDevice->PortOffset +MAC_REG_RSPINF_A_6 ,MAKEWORD (byTxRate, byRsvTime)); -/* RSPINF_a_9 */ -s_vCalculateOFDMRParameter (RATE_9M , - ePHYType, - &byTxRate, - &byRsvTime); -VNSvOutPortW (pDevice->PortOffset +MAC_REG_RSPINF_A_9 ,MAKEWORD (byTxRate, byRsvTime)); -/* RSPINF_a_12 */ -s_vCalculateOFDMRParameter (RATE_12M , - ePHYType, - &byTxRate, - &byRsvTime); -VNSvOutPortW (pDevice->PortOffset +MAC_REG_RSPINF_A_12 ,MAKEWORD (byTxRate, byRsvTime)); -/* RSPINF_a_18 */ -s_vCalculateOFDMRParameter (RATE_18M , - ePHYType, - &byTxRate, - &byRsvTime); -VNSvOutPortW (pDevice->PortOffset +MAC_REG_RSPINF_A_18 ,MAKEWORD (byTxRate, byRsvTime)); -/* RSPINF_a_24 */ -s_vCalculateOFDMRParameter (RATE_24M , - ePHYType, - &byTxRate, - &byRsvTime); -VNSvOutPortW (pDevice->PortOffset +MAC_REG_RSPINF_A_24 ,MAKEWORD (byTxRate, byRsvTime)); -/* RSPINF_a_36 */ -s_vCalculateOFDMRParameter ( -VNTWIFIbyGetACKTxRate (RATE_36M , pvSupportRateIEs, pvExtSupportRateIEs), - ePHYType, - &byTxRate, - &byRsvTime); -VNSvOutPortW (pDevice->PortOffset +MAC_REG_RSPINF_A_36 ,MAKEWORD (byTxRate, byRsvTime)); -/* RSPINF_a_48 */ -s_vCalculateOFDMRParameter ( -VNTWIFIbyGetACKTxRate (RATE_48M , pvSupportRateIEs, pvExtSupportRateIEs), - ePHYType, - &byTxRate, - &byRsvTime); -VNSvOutPortW (pDevice->PortOffset +MAC_REG_RSPINF_A_48 ,MAKEWORD (byTxRate, byRsvTime)); -/* RSPINF_a_54 */ -s_vCalculateOFDMRParameter ( -VNTWIFIbyGetACKTxRate (RATE_54M , pvSupportRateIEs, pvExtSupportRateIEs), - ePHYType, - &byTxRate, - &byRsvTime); -VNSvOutPortW (pDevice->PortOffset +MAC_REG_RSPINF_A_54 ,MAKEWORD (byTxRate, byRsvTime)); -/* RSPINF_a_72 */ -VNSvOutPortW (pDevice->PortOffset +MAC_REG_RSPINF_A_72 ,MAKEWORD (byTxRate, byRsvTime)); -/* Set to Page0 */ -MACvSelectPage0 (pDevice->PortOffset); -} -/*--------------------- Export Functions --------------------------*/ /*
@@ -504,7 +386,7 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,VNSvOutPortB (pDevice->PortOffset +MAC_REG_CWMAXMIN0 , pDevice->byCWMaxMin); } -s_vSetRSPINF (pDevice, ePHYType,NULL ,NULL ); +CARDvSetRSPINF (pDevice, ePHYType);return true; }
Signature · 1 line
2.1.0
PATCH v2 19/34 staging: vt6655: mac80211 conversion: device_init_registers remove legacy code
In reply to Malcolm PriestleyRemove pMgmt, byCurrentCh, VNTWIFIbConfigPhyMode, eEncryptionStatus and netif_stop_queue.
--- drivers/staging/vt6655/device_main.c | 15 --------------- 1 file changed, 15 deletions(-)
drivers/staging/vt6655/device_main.c +0 -15
@@ -412,7 +412,6 @@ static void device_init_registers(struct vnt_private *pDevice)unsigned char byCCKPwrdBm =0 ;unsigned char byOFDMPwrdBm =0 ;int zonetype =0 ; -PSMgmtObject pMgmt = &(pDevice->sMgmtObj);MACbShutdown (pDevice->PortOffset);BBvSoftwareReset (pDevice->PortOffset);
@@ -616,8 +615,6 @@ static void device_init_registers(struct vnt_private *pDevice) (unsigned char)(ii + EEP_OFS_OFDMA_PWR_dBm)); } -init_channel_table ((void *)pDevice); -if (pDevice->byLocalID >REV_ID_VT3253_B1 ) {MACvSelectPage1 (pDevice->PortOffset);
@@ -652,8 +649,6 @@ static void device_init_registers(struct vnt_private *pDevice)BBvSetRxAntennaMode (pDevice->PortOffset, pDevice->byRxAntennaMode);BBvSetTxAntennaMode (pDevice->PortOffset, pDevice->byTxAntennaMode); - pDevice->byCurrentCh =0 ; -/* Set BB and packet type at the same time. */ /* Set Short Slot Time, xIFS, and RSPINF. */ if (pDevice->uConnectionRate ==RATE_AUTO )
@@ -661,10 +656,6 @@ static void device_init_registers(struct vnt_private *pDevice)else pDevice->wCurrentRate = (unsigned short )pDevice->uConnectionRate; -/* default G Mode */ -VNTWIFIbConfigPhyMode (pDevice->pMgmt,PHY_TYPE_11G ); -VNTWIFIbConfigPhyMode (pDevice->pMgmt,PHY_TYPE_AUTO ); - pDevice->bRadioOff = false; pDevice->byRadioCtl = SROMbyReadEmbedded(pDevice->PortOffset,
@@ -685,8 +676,6 @@ static void device_init_registers(struct vnt_private *pDevice)if (pDevice->bHWRadioOff || pDevice->bRadioControlOff)CARDbRadioPowerOff (pDevice); - pMgmt->eScanType =WMAC_SCAN_PASSIVE ; -/* get Permanent network address */ SROMvReadEtherAddress (pDevice->PortOffset, pDevice->abyCurrentNetAddr);pr_debug ("Network address = %pM\n" , pDevice->abyCurrentNetAddr);
@@ -699,16 +688,12 @@ static void device_init_registers(struct vnt_private *pDevice)if (pDevice->byLocalID <=REV_ID_VT3253_A1 )MACvRegBitsOn (pDevice->PortOffset,MAC_REG_RCR ,RCR_WPAERR ); - pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled; -/* Turn On Rx DMA */ MACvReceive0 (pDevice->PortOffset);MACvReceive1 (pDevice->PortOffset);/* start the adapter */ MACvStart (pDevice->PortOffset); - -netif_stop_queue (pDevice->dev); }static void device_init_diversity_timer (struct vnt_private *pDevice)
Signature · 1 line
2.1.0
PATCH v2 20/34 staging: vt6655: mac80211 conversion: device_free_info
In reply to Malcolm PriestleyRemove net device code and add mac80211 unregister code.
--- drivers/staging/vt6655/device_main.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
drivers/staging/vt6655/device_main.c +7 -18
@@ -806,31 +806,20 @@ static bool device_get_pci_info(struct vnt_private *pDevice,static void device_free_info (struct vnt_private *pDevice) { -struct net_device *dev = pDevice->dev; - -ASSERT (pDevice); -//2008-0714-01<Add>by chester -device_release_WPADEV (pDevice); - -//2008-07-21-01<Add>by MikeLiu -//unregister wpadev -if (wpa_set_wpadev (pDevice,0 ) !=0 ) -pr_err ("unregister wpadev fail?\n" ); +if (!pDevice) +return ; -#ifdef HOSTAP -if (dev) -vt6655_hostap_set_hostapd (pDevice,0 ,0 ); -#endif -if (dev) -unregister_netdev (dev); +if (pDevice->mac_hw) +ieee80211_unregister_hw (pDevice->hw);if (pDevice->PortOffset)iounmap (pDevice->PortOffset);if (pDevice->pcid)pci_release_regions (pDevice->pcid); -if (dev) -free_netdev (dev); + +if (pDevice->hw) +ieee80211_free_hw (pDevice->hw); }static bool device_init_rings (struct vnt_private *pDevice)
Signature · 1 line
2.1.0
PATCH v2 21/34 staging: vt6655: switch driver over to mac80211
In reply to Malcolm Priestley--- drivers/staging/vt6655/Kconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/vt6655/Kconfig +1 -3
@@ -1,8 +1,6 @@ config VT6655 tristate "VIA Technologies VT6655 support" - depends on PCI && WLAN && m - select WIRELESS_EXT - select WEXT_PRIV + depends on PCI && MAC80211 && m ---help--- This is a vendor-written driver for VIA VT6655.
Signature · 1 line
2.1.0
PATCH v2 22/34 staging: vt6655: phy type same as bb type
In reply to Malcolm PriestleyTo maintain functionality
typedef enum _CARD_PHY_TYPE should have the same values as typedef enum _VIA_PKT_TYPE
TODO both these types need merging.
--- drivers/staging/vt6655/card.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vt6655/card.h +2 -2
@@ -52,10 +52,10 @@#define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G)typedef enum _CARD_PHY_TYPE { -PHY_TYPE_AUTO , +PHY_TYPE_11A =0 ,PHY_TYPE_11B ,PHY_TYPE_11G , -PHY_TYPE_11A +PHY_TYPE_AUTO }CARD_PHY_TYPE , *PCARD_PHY_TYPE ; typedef enum _CARD_PKT_TYPE {
Signature · 1 line
2.1.0
PATCH v2 23/34 staging: vt6655: mac80211 conversion: device_error remove legacy functions
In reply to Malcolm PriestleyRemove netif_stop_queue, bCmdRunning and timer functions
--- drivers/staging/vt6655/device_main.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/staging/vt6655/device_main.c +0 -4
@@ -1313,10 +1313,6 @@ static void device_error(struct vnt_private *pDevice, unsigned short status)if (status &ISR_FETALERR ) {dev_err (&pDevice->pcid->dev,"Hardware fatal error\n" ); -netif_stop_queue (pDevice->dev); -del_timer (&pDevice->sTimerCommand); -del_timer (&(pDevice->pMgmt->sTimerSecondCallback)); - pDevice->bCmdRunning = false;MACbShutdown (pDevice->PortOffset);return ; }
Signature · 1 line
2.1.0
PATCH v2 24/34 staging: vt6655: vt6655_probe remove management pointers
In reply to Malcolm PriestleyAll these pointers are now dead.
--- drivers/staging/vt6655/device_main.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/vt6655/device_main.c +0 -2
@@ -3266,8 +3266,6 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)/* Enable the chip specified capabilities */ priv->flags = priv->sOpts.flags | (pChip_info->flags &0xff000000UL ); priv->tx_80211 = device_dma0_tx_80211; - priv->sMgmtObj.pAdapter = (void *)priv; - priv->pMgmt = &(priv->sMgmtObj); wiphy = priv->hw->wiphy;
Signature · 1 line
2.1.0
PATCH v2 25/34 staging: vt6655: mac80211 conversion: PSbIsNextTBTTWakeUp convert to mac80211
In reply to Malcolm PriestleyWake up to listen to next beacon when struct ieee80211_conf -> listen_interval == 1
--- drivers/staging/vt6655/power.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
drivers/staging/vt6655/power.c +6 -13
@@ -327,21 +327,14 @@ PSbIsNextTBTTWakeUp( ) {struct vnt_private *pDevice = hDeviceContext; -PSMgmtObject pMgmt = pDevice->pMgmt; +struct ieee80211_hw *hw = pDevice->hw; +struct ieee80211_conf *conf = &hw->conf;bool bWakeUp = false; -if (pMgmt->wListenInterval >=2 ) { -if (pMgmt->wCountToWakeUp ==0 ) - pMgmt->wCountToWakeUp = pMgmt->wListenInterval; - - pMgmt->wCountToWakeUp--; - -if (pMgmt->wCountToWakeUp ==1 ) { -// Turn on wake up to listen next beacon -MACvRegBitsOn (pDevice->PortOffset,MAC_REG_PSCTL ,PSCTL_LNBCN ); - bWakeUp = true; - } - +if (conf->listen_interval ==1 ) { +/* Turn on wake up to listen next beacon */ +MACvRegBitsOn (pDevice->PortOffset,MAC_REG_PSCTL ,PSCTL_LNBCN ); + bWakeUp = true; }return bWakeUp;
Signature · 1 line
2.1.0
PATCH v2 26/34 staging: vt6655: MACvSetDefaultKeyEntry replace WLAN_WEP104_KEYLEN
In reply to Malcolm Priestleywith WLAN_KEY_LEN_WEP40
--- drivers/staging/vt6655/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/mac.c +1 -1
@@ -1526,7 +1526,7 @@ void MACvSetDefaultKeyEntry(void __iomem *dwIoBase, unsigned int uKeyLen,VNSvOutPortW (dwIoBase +MAC_REG_MISCFFCTL ,MISCFFCTL_WRITE ); } dwData = *pdwKey; -if (uKeyLen ==WLAN_WEP104_KEYLEN ) +if (uKeyLen ==WLAN_KEY_LEN_WEP40 ) dwData |=0x80000000 ;VNSvOutPortW (dwIoBase +MAC_REG_MISCFFNDEX , wOffset+3 );
Signature · 1 line
2.1.0
PATCH v2 27/34 staging: vt6655: baseband.c replace BIT0 with BIT(0)
In reply to Malcolm Priestley--- drivers/staging/vt6655/baseband.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6655/baseband.c +4 -4
@@ -2116,7 +2116,7 @@ bool BBbVT3253Init(struct vnt_private *pDevice) bResult &=BBbWriteEmbedded (dwIoBase, byVT3253B0_AGC4_RFMD2959[ii][0 ], byVT3253B0_AGC4_RFMD2959[ii][1 ]);VNSvOutPortD (dwIoBase +MAC_REG_ITRTMSET ,0x23 ); -MACvRegBitsOn (dwIoBase,MAC_REG_PAPEDELAY ,BIT0 ); +MACvRegBitsOn (dwIoBase,MAC_REG_PAPEDELAY ,BIT (0 )); } pDevice->abyBBVGA[0 ] =0x18 ; pDevice->abyBBVGA[1 ] =0x0A ;
@@ -2149,7 +2149,7 @@ bool BBbVT3253Init(struct vnt_private *pDevice) bResult &=BBbWriteEmbedded (dwIoBase, byVT3253B0_AGC[ii][0 ], byVT3253B0_AGC[ii][1 ]);VNSvOutPortB (dwIoBase +MAC_REG_ITRTMSET ,0x23 ); -MACvRegBitsOn (dwIoBase,MAC_REG_PAPEDELAY ,BIT0 ); +MACvRegBitsOn (dwIoBase,MAC_REG_PAPEDELAY ,BIT (0 )); pDevice->abyBBVGA[0 ] =0x14 ; pDevice->abyBBVGA[1 ] =0x0A ;
@@ -2455,7 +2455,7 @@ BBvPowerSaveModeON(void __iomem *dwIoBase)unsigned char byOrgData;BBbReadEmbedded (dwIoBase,0x0D , &byOrgData); - byOrgData |=BIT0 ; + byOrgData |=BIT (0 );BBbWriteEmbedded (dwIoBase,0x0D , byOrgData); }
@@ -2477,7 +2477,7 @@ BBvPowerSaveModeOFF(void __iomem *dwIoBase)unsigned char byOrgData;BBbReadEmbedded (dwIoBase,0x0D , &byOrgData); - byOrgData &= ~(BIT0 ); + byOrgData &= ~(BIT (0 ));BBbWriteEmbedded (dwIoBase,0x0D , byOrgData); }
Signature · 1 line
2.1.0
PATCH v2 28/34 staging: vt6655: s_vGenerateTxParameter remove unused cbMACHdLen
In reply to Malcolm Priestley--- drivers/staging/vt6655/rxtx.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/staging/vt6655/rxtx.c +0 -4
@@ -1132,7 +1132,6 @@ s_vGenerateTxParameter(unsigned short wCurrentRate ) { -unsigned int cbMACHdLen =WLAN_HDR_ADDR3_LEN ;//24 unsigned short wFifoCtl;bool bDisCRC = false;unsigned char byFBOption =AUTO_FB_NONE ;
@@ -1150,9 +1149,6 @@ s_vGenerateTxParameter(else if (wFifoCtl &FIFOCTL_AUTO_FB_1 ) byFBOption =AUTO_FB_1 ; -if (pDevice->bLongHeader) - cbMACHdLen =WLAN_HDR_ADDR3_LEN +6 ; -if (!pvRrvTime)return ;
Signature · 1 line
2.1.0
PATCH v2 29/34 staging: vt6655: device_init_registers replace spin lock
In reply to Malcolm PriestleyUse spin_lock_irqsave and spin_unlock_irqrestore.
--- drivers/staging/vt6655/device_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/staging/vt6655/device_main.c +3 -2
@@ -406,6 +406,7 @@ device_set_options(struct vnt_private *pDevice)static void device_init_registers (struct vnt_private *pDevice) { +unsigned long flags;unsigned int ii;unsigned char byValue;unsigned char byValue1;
@@ -439,11 +440,11 @@ static void device_init_registers(struct vnt_private *pDevice)/* Get Local ID */ VNSvInPortB (pDevice->PortOffset +MAC_REG_LOCALID , &pDevice->byLocalID); -spin_lock_irq (&pDevice->lock); +spin_lock_irqsave (&pDevice->lock, flags);SROMvReadAllContents (pDevice->PortOffset, pDevice->abyEEPROM); -spin_unlock_irq (&pDevice->lock); +spin_unlock_irqrestore (&pDevice->lock, flags);/* Get Channel range */ pDevice->byMinChannel =1 ;
Signature · 1 line
2.1.0
PATCH v2 30/34 staging: vt6655: baseband.c timers replace spin lock
In reply to Malcolm PriestleyUse spin_lock_irqsave and spin_unlock_irqrestore
in functions TimerSQ3CallBack and TimerState1CallBack
--- drivers/staging/vt6655/baseband.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/staging/vt6655/baseband.c +9 -4
@@ -2786,9 +2786,11 @@ TimerSQ3CallBack( ) {struct vnt_private *pDevice = hDeviceContext; +unsigned long flags;pr_debug ("TimerSQ3CallBack...\n" ); -spin_lock_irq (&pDevice->lock); + +spin_lock_irqsave (&pDevice->lock, flags); pr_debug("3.[%08x][%08x], %d\n", (int)pDevice->ulRatio_State0, (int)pDevice->ulRatio_State1,
@@ -2803,7 +2805,7 @@ TimerSQ3CallBack(add_timer (&pDevice->TimerSQ3Tmax3);add_timer (&pDevice->TimerSQ3Tmax2); -spin_unlock_irq (&pDevice->lock); +spin_unlock_irqrestore (&pDevice->lock, flags); }/*+
@@ -2830,10 +2832,12 @@ TimerState1CallBack( ) {struct vnt_private *pDevice = hDeviceContext; +unsigned long flags;pr_debug ("TimerState1CallBack...\n" ); -spin_lock_irq (&pDevice->lock); +spin_lock_irqsave (&pDevice->lock, flags); +if (pDevice->uDiversityCnt < pDevice->ulDiversityMValue/100 ) {s_vChangeAntenna (pDevice); pDevice->TimerSQ3Tmax3.expires =RUN_AT (pDevice->byTMax3 *HZ );
@@ -2864,5 +2868,6 @@ TimerState1CallBack( } pDevice->byAntennaState =0 ;BBvClearAntDivSQ3Value (pDevice); -spin_unlock_irq (&pDevice->lock); + +spin_unlock_irqrestore (&pDevice->lock, flags); }
Signature · 1 line
2.1.0
PATCH v2 31/34 staging: vt6655: fifo & frag control remove big endian values
In reply to Malcolm PriestleyEndian conversion now happens at run time only little endian values are valid.
--- drivers/staging/vt6655/desc.h | 32 -------------------------------- 1 file changed, 32 deletions(-)
drivers/staging/vt6655/desc.h +0 -32
@@ -118,37 +118,7 @@*/ #define CB_MAX_TX_ABORT_RETRY 3 -#ifdef __BIG_ENDIAN -/* WMAC definition FIFO Control */ -#define FIFOCTL_AUTO_FB_1 0x0010 -#define FIFOCTL_AUTO_FB_0 0x0008 -#define FIFOCTL_GRPACK 0x0004 -#define FIFOCTL_11GA 0x0003 -#define FIFOCTL_11GB 0x0002 -#define FIFOCTL_11B 0x0001 -#define FIFOCTL_11A 0x0000 -#define FIFOCTL_RTS 0x8000 -#define FIFOCTL_ISDMA0 0x4000 -#define FIFOCTL_GENINT 0x2000 -#define FIFOCTL_TMOEN 0x1000 -#define FIFOCTL_LRETRY 0x0800 -#define FIFOCTL_CRCDIS 0x0400 -#define FIFOCTL_NEEDACK 0x0200 -#define FIFOCTL_LHEAD 0x0100 - -/* WMAC definition Frag Control */ -#define FRAGCTL_AES 0x0003 -#define FRAGCTL_TKIP 0x0002 -#define FRAGCTL_LEGACY 0x0001 -#define FRAGCTL_NONENCRYPT 0x0000 -#define FRAGCTL_ENDFRAG 0x0300 -#define FRAGCTL_MIDFRAG 0x0200 -#define FRAGCTL_STAFRAG 0x0100 -#define FRAGCTL_NONFRAG 0x0000 - -#else -#define FIFOCTL_AUTO_FB_1 0x1000#define FIFOCTL_AUTO_FB_0 0x0800#define FIFOCTL_GRPACK 0x0400
@@ -175,8 +145,6 @@#define FRAGCTL_STAFRAG 0x0001#define FRAGCTL_NONFRAG 0x0000 -#endif -#define TYPE_TXDMA0 0#define TYPE_AC0DMA 1#define TYPE_ATIMDMA 2
Signature · 1 line
2.1.0
PATCH v2 32/34 staging: vt6655: vnt_rx_data: uCurrRSSI should have the value of *rssi
In reply to Malcolm PriestleyFixes issue of byBBVGANew is wrong in device_intr
--- drivers/staging/vt6655/dpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/dpc.c +1 -1
@@ -1382,7 +1382,7 @@ static bool vnt_rx_data(struct vnt_private *priv, struct sk_buff *skb,RFvRSSITodBm (priv, *rssi, &rx_dbm); priv->byBBPreEDRSSI = (u8 )rx_dbm +1 ; - priv->uCurrRSSI = priv->byBBPreEDRSSI; + priv->uCurrRSSI = *rssi;skb_pull (skb,4 );skb_trim (skb, frame_size);
Signature · 1 line
2.1.0
PATCH v2 33/34 staging: vt6655: don't update bUpdateBBVGA when off channel
In reply to Malcolm PriestleyCheck flag conf IEEE80211_CONF_OFFCHANNEL so that RSSI doesn't swing wildly on scanning.
--- drivers/staging/vt6655/device_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/vt6655/device_main.c +1 -0
@@ -2040,6 +2040,7 @@ static irqreturn_t device_intr(int irq, void *dev_instance)if (pDevice->vif && pDevice->op_mode !=NL80211_IFTYPE_ADHOC ) {if (pDevice->bUpdateBBVGA && + !(pDevice->hw->conf.flags &IEEE80211_CONF_OFFCHANNEL ) && pDevice->vif->bss_conf.assoc && pDevice->uCurrRSSI) {long ldBm;
Signature · 1 line
2.1.0
PATCH v2 34/34 staging: vt6655: reset tsf on dissociation
In reply to Malcolm PriestleyEnsuring that tsf counter does not run while idle.
--- drivers/staging/vt6655/device_main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/staging/vt6655/device_main.c +5 -0
@@ -2980,6 +2980,11 @@ static void vnt_bss_info_changed(struct ieee80211_hw *hw,CARDvSetFirstNextTBTT (priv->PortOffset, conf->beacon_int); + }else { +VNSvOutPortB (priv->PortOffset +MAC_REG_TFTCTL , +TFTCTL_TSFCNTRST ); +VNSvOutPortB (priv->PortOffset +MAC_REG_TFTCTL , +TFTCTL_TSFCNTREN ); } } }
Signature · 1 line
2.1.0
Greg KH
maintainerQuoted 12 lines · Malcolm Priestley
The patches in this series convert the driver to mac80211.
As well as infrastructure mode the driver now operates in IBSS and access point modes.
Host access point is now working with hostapd in nl80211 mode.
The driver continues to operate diversity mode in infrastructure mode.
There is still a lot of work that needs doing particularly remodeling rxtx to something similar to vt6656 driver.
Quoted 6 lines
These patches creates huge amount of dead code that will be removed in the next series.
Changes from v1 3 additional patches fixing tsf and rssi issues
Rebased on staging-testing.
All now applied, very nice work.
greg k-h