Commit 1cac4a4b authored by Andres More's avatar Andres More Committed by Greg Kroah-Hartman

staging: vt6656: removed custom 802.11 header usage

Removed struct tagS802_11Header, switching to struct ieee80211_hdr instead.
Checkpatch warnings and errors were not resolved.
Signed-off-by: default avatarAndres More <more.andres@gmail.com>
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ceb8c5da
......@@ -243,7 +243,7 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize)
u8 abyPlainText[16];
u8 abyLastCipher[16];
PS802_11Header pMACHeader = (PS802_11Header) pbyFrame;
struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *) pbyFrame;
u8 * pbyIV;
u8 * pbyPayload;
u16 wHLen = 22;
......@@ -265,7 +265,7 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize)
pbyPayload = pbyIV + 8; /* IV-length */
abyNonce[0] = 0x00; /* now is 0, if Qos here will be priority */
memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN);
memcpy(&(abyNonce[1]), pMACHeader->addr2, ETH_ALEN);
abyNonce[7] = pbyIV[7];
abyNonce[8] = pbyIV[6];
abyNonce[9] = pbyIV[5];
......@@ -282,22 +282,22 @@ bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize)
/* MIC_HDR1 */
MIC_HDR1[0] = (u8)(wHLen >> 8);
MIC_HDR1[1] = (u8)(wHLen & 0xff);
byTmp = (u8)(pMACHeader->wFrameCtl & 0xff);
byTmp = (u8)(pMACHeader->frame_control & 0xff);
MIC_HDR1[2] = byTmp & 0x8f;
byTmp = (u8)(pMACHeader->wFrameCtl >> 8);
byTmp = (u8)(pMACHeader->frame_control >> 8);
byTmp &= 0x87;
MIC_HDR1[3] = byTmp | 0x40;
memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN);
memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN);
memcpy(&(MIC_HDR1[4]), pMACHeader->addr1, ETH_ALEN);
memcpy(&(MIC_HDR1[10]), pMACHeader->addr2, ETH_ALEN);
/* MIC_HDR2 */
memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN);
byTmp = (u8)(pMACHeader->wSeqCtl & 0xff);
memcpy(&(MIC_HDR2[0]), pMACHeader->addr3, ETH_ALEN);
byTmp = (u8)(pMACHeader->seq_ctrl & 0xff);
MIC_HDR2[6] = byTmp & 0x0f;
MIC_HDR2[7] = 0;
if (bA4) {
memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, ETH_ALEN);
memcpy(&(MIC_HDR2[8]), pMACHeader->addr4, ETH_ALEN);
} else {
MIC_HDR2[8] = 0x00;
MIC_HDR2[9] = 0x00;
......
This diff is collapsed.
......@@ -157,7 +157,7 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
u8 * pbyBuffer, unsigned int cbFrameLength)
{
/* need change */
PS802_11Header pHeader = (PS802_11Header)pbyBuffer;
struct ieee80211_hdr *pHeader = (struct ieee80211_hdr *)pbyBuffer;
if (byRSR & RSR_ADDROK)
pStatistic->dwRsrADDROk++;
......@@ -343,7 +343,7 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic,
else
pStatistic->dwRsrDirected++;
if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl))
if (WLAN_GET_FC_MOREFRAG(pHeader->frame_control))
pStatistic->dwRsrRxFragment++;
if (cbFrameLength < ETH_ZLEN + 4) {
......
This diff is collapsed.
......@@ -43,11 +43,6 @@
#define TYPE_MGMT_PROBE_RSP 0x5000
//
// wFrameCtl field in the S802_11Header
//
// NOTE....
// in network byte order, high byte is going first
#define FC_TODS 0x0001
#define FC_FROMDS 0x0002
#define FC_MOREFRAG 0x0004
......@@ -81,11 +76,6 @@
#define TYPE_MGMT_PROBE_RSP 0x0050
//
// wFrameCtl field in the S802_11Header
//
// NOTE....
// in network byte order, high byte is going first
#define FC_TODS 0x0100
#define FC_FROMDS 0x0200
#define FC_MOREFRAG 0x0400
......@@ -124,20 +114,6 @@ typedef struct tagS802_3Header {
} __attribute__ ((__packed__))
S802_3Header, *PS802_3Header;
//
// 802_11 packet
//
typedef struct tagS802_11Header {
u16 wFrameCtl;
u16 wDurationID;
u8 abyAddr1[ETH_ALEN];
u8 abyAddr2[ETH_ALEN];
u8 abyAddr3[ETH_ALEN];
u16 wSeqCtl;
u8 abyAddr4[ETH_ALEN];
} __attribute__ ((__packed__))
S802_11Header, *PS802_11Header;
/*--------------------- Export Macros ------------------------------*/
/*--------------------- Export Classes ----------------------------*/
......
......@@ -67,7 +67,7 @@
*
*/
bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
bool WCTLbIsDuplicate (PSCache pCache, struct ieee80211_hdr *pMACHeader)
{
unsigned int uIndex;
unsigned int ii;
......@@ -78,10 +78,10 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
uIndex = pCache->uInPtr;
for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) {
pCacheEntry = &(pCache->asCacheEntry[uIndex]);
if ((pCacheEntry->wFmSequence == pMACHeader->wSeqCtl) &&
if ((pCacheEntry->wFmSequence == pMACHeader->seq_ctrl) &&
(!compare_ether_addr(&(pCacheEntry->abyAddr2[0]),
&(pMACHeader->abyAddr2[0]))) &&
(LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->wFrameCtl))
&(pMACHeader->addr2[0]))) &&
(LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->frame_control))
) {
/* Duplicate match */
return true;
......@@ -91,9 +91,9 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
}
/* Not found in cache - insert */
pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr];
pCacheEntry->wFmSequence = pMACHeader->wSeqCtl;
memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN);
pCacheEntry->wFrameCtl = pMACHeader->wFrameCtl;
pCacheEntry->wFmSequence = pMACHeader->seq_ctrl;
memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->addr2[0]), ETH_ALEN);
pCacheEntry->wFrameCtl = pMACHeader->frame_control;
ADD_ONE_WITH_WRAP_AROUND(pCache->uInPtr, DUPLICATE_RX_CACHE_LENGTH);
return false;
}
......@@ -114,14 +114,14 @@ bool WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
*/
unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice,
PS802_11Header pMACHeader)
struct ieee80211_hdr *pMACHeader)
{
unsigned int ii;
for (ii = 0; ii < pDevice->cbDFCB; ii++) {
if ((pDevice->sRxDFCB[ii].bInUse == true) &&
(!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]),
&(pMACHeader->abyAddr2[0])))) {
&(pMACHeader->addr2[0])))) {
return ii;
}
}
......@@ -143,7 +143,7 @@ unsigned int WCTLuSearchDFCB(struct vnt_private *pDevice,
*
*/
unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice,
PS802_11Header pMACHeader)
struct ieee80211_hdr *pMACHeader)
{
unsigned int ii;
......@@ -154,10 +154,10 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice,
pDevice->cbFreeDFCB--;
pDevice->sRxDFCB[ii].uLifetime = pDevice->dwMaxReceiveLifetime;
pDevice->sRxDFCB[ii].bInUse = true;
pDevice->sRxDFCB[ii].wSequence = (pMACHeader->wSeqCtl >> 4);
pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F);
pDevice->sRxDFCB[ii].wSequence = (pMACHeader->seq_ctrl >> 4);
pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->seq_ctrl & 0x000F);
memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]),
&(pMACHeader->abyAddr2[0]),
&(pMACHeader->addr2[0]),
ETH_ALEN);
return(ii);
}
......@@ -182,8 +182,7 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice,
* Return Value: true if it is valid fragment packet and we have resource to defragment; otherwise false
*
*/
bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader,
unsigned int cbFrameLength, bool bWEP, bool bExtIV)
bool WCTLbHandleFragment(struct vnt_private *pDevice, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV)
{
unsigned int uHeaderSize;
......@@ -203,8 +202,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader,
if (pDevice->uCurrentDFCBIdx < pDevice->cbDFCB) {
// duplicate, we must flush previous DCB
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].uLifetime = pDevice->dwMaxReceiveLifetime;
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence = (pMACHeader->wSeqCtl >> 4);
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->wSeqCtl & 0x000F);
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence = (pMACHeader->seq_ctrl >> 4);
pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum = (pMACHeader->seq_ctrl & 0x000F);
}
else {
pDevice->uCurrentDFCBIdx = WCTLuInsertDFCB(pDevice, pMACHeader);
......@@ -225,8 +224,8 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, PS802_11Header pMACHeader,
else {
pDevice->uCurrentDFCBIdx = WCTLuSearchDFCB(pDevice, pMACHeader);
if (pDevice->uCurrentDFCBIdx != pDevice->cbDFCB) {
if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->wSeqCtl >> 4)) &&
(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->wSeqCtl & 0x000F)) &&
if ((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wSequence == (pMACHeader->seq_ctrl >> 4)) &&
(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].wFragNum == (pMACHeader->seq_ctrl & 0x000F)) &&
((pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].cbFrameLength + cbFrameLength - uHeaderSize) < 2346)) {
memcpy(pDevice->sRxDFCB[pDevice->uCurrentDFCBIdx].pbyRxBuffer, ((u8 *) (pMACHeader) + uHeaderSize), (cbFrameLength - uHeaderSize));
......
......@@ -35,51 +35,51 @@
/*--------------------- Export Definitions -------------------------*/
#define IS_TYPE_DATA(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_DATA)
((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_DATA)
#define IS_TYPE_MGMT(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_MGMT)
((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_MGMT)
#define IS_TYPE_CONTROL(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_802_11_MASK) == TYPE_802_11_CTL)
((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_CTL)
#define IS_FC_MOREDATA(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREDATA) == FC_MOREDATA)
((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREDATA) == FC_MOREDATA)
#define IS_FC_POWERMGT(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & FC_POWERMGT) == FC_POWERMGT)
((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_POWERMGT) == FC_POWERMGT)
#define IS_FC_RETRY(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & FC_RETRY) == FC_RETRY)
((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_RETRY) == FC_RETRY)
#define IS_FC_WEP(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & FC_WEP) == FC_WEP)
((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_WEP) == FC_WEP)
#ifdef __BIG_ENDIAN
#define IS_FRAGMENT_PKT(pMACHeader) \
(((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \
((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) != 0))
(((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \
((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) != 0))
#define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
((((PS802_11Header) pMACHeader)->wSeqCtl & 0x0F00) == 0)
((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x0F00) == 0)
#else
#define IS_FRAGMENT_PKT(pMACHeader) \
(((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) != 0) | \
((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) != 0))
(((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) != 0) | \
((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) != 0))
#define IS_FIRST_FRAGMENT_PKT(pMACHeader) \
((((PS802_11Header) pMACHeader)->wSeqCtl & 0x000F) == 0)
((((struct ieee80211_hdr *) pMACHeader)->seq_ctrl & 0x000F) == 0)
#endif//#ifdef __BIG_ENDIAN
#define IS_LAST_FRAGMENT_PKT(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & FC_MOREFRAG) == 0)
((((struct ieee80211_hdr *) pMACHeader)->frame_control & FC_MOREFRAG) == 0)
#define IS_CTL_PSPOLL(pMACHeader) \
((((PS802_11Header) pMACHeader)->wFrameCtl & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL)
((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL)
#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
......@@ -95,10 +95,9 @@
/*--------------------- Export Functions --------------------------*/
bool WCTLbIsDuplicate(PSCache pCache, PS802_11Header pMACHeader);
bool WCTLbHandleFragment(struct vnt_private *, PS802_11Header pMACHeader,
unsigned int cbFrameLength, bool bWEP, bool bExtIV);
unsigned int WCTLuSearchDFCB(struct vnt_private *, PS802_11Header pMACHeader);
unsigned int WCTLuInsertDFCB(struct vnt_private *, PS802_11Header pMACHeader);
bool WCTLbIsDuplicate(PSCache pCache, struct ieee80211_hdr *pMACHeader);
bool WCTLbHandleFragment(struct vnt_private *, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV);
unsigned int WCTLuSearchDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader);
unsigned int WCTLuInsertDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader);
#endif /* __WCTL_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment