Staging: vt6656: use ETH_HLEN macro instead of custom one

Replace custom header length definition U_HEADER_LEN by ETH_HLEN
from <linux/if_ether.h>. Also remove unused U_TYPE_LEN.

Signed-off-by: Charles Clément <caratorn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Charles Clément 2010-05-18 10:08:14 -07:00 committed by Greg Kroah-Hartman
parent 7ec52ed250
commit 21ec51f3df
2 changed files with 12 additions and 14 deletions

View file

@ -1483,7 +1483,7 @@ s_bPacketToWirelessUsb(
cb802_1_H_len = 0; cb802_1_H_len = 0;
} }
cbFrameBodySize = uSkbPacketLen - U_HEADER_LEN + cb802_1_H_len; cbFrameBodySize = uSkbPacketLen - ETH_HLEN + cb802_1_H_len;
//Set packet type //Set packet type
pTxBufHead->wFIFOCtl |= (WORD)(byPktType<<8); pTxBufHead->wFIFOCtl |= (WORD)(byPktType<<8);
@ -1729,13 +1729,13 @@ s_bPacketToWirelessUsb(
if (pPacket != NULL) { if (pPacket != NULL) {
// Copy the Packet into a tx Buffer // Copy the Packet into a tx Buffer
memcpy((pbyPayloadHead + cb802_1_H_len), memcpy((pbyPayloadHead + cb802_1_H_len),
(pPacket + U_HEADER_LEN), (pPacket + ETH_HLEN),
uSkbPacketLen - U_HEADER_LEN uSkbPacketLen - ETH_HLEN
); );
} else { } else {
// while bRelayPacketSend psEthHeader is point to header+payload // while bRelayPacketSend psEthHeader is point to header+payload
memcpy((pbyPayloadHead + cb802_1_H_len), ((PBYTE)psEthHeader)+U_HEADER_LEN, uSkbPacketLen - U_HEADER_LEN); memcpy((pbyPayloadHead + cb802_1_H_len), ((PBYTE)psEthHeader) + ETH_HLEN, uSkbPacketLen - ETH_HLEN);
} }
ASSERT(uLength == cbNdisBodySize); ASSERT(uLength == cbNdisBodySize);
@ -2849,7 +2849,7 @@ nsDMA_tx_packet(
return STATUS_RESOURCES; return STATUS_RESOURCES;
} }
memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(skb->data), U_HEADER_LEN); memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)(skb->data), ETH_HLEN);
//mike add:station mode check eapol-key challenge---> //mike add:station mode check eapol-key challenge--->
{ {
@ -2858,10 +2858,10 @@ nsDMA_tx_packet(
BYTE Descriptor_type; BYTE Descriptor_type;
WORD Key_info; WORD Key_info;
Protocol_Version = skb->data[U_HEADER_LEN]; Protocol_Version = skb->data[ETH_HLEN];
Packet_Type = skb->data[U_HEADER_LEN+1]; Packet_Type = skb->data[ETH_HLEN+1];
Descriptor_type = skb->data[U_HEADER_LEN+1+1+2]; Descriptor_type = skb->data[ETH_HLEN+1+1+2];
Key_info = (skb->data[U_HEADER_LEN+1+1+2+1] << 8)|(skb->data[U_HEADER_LEN+1+1+2+2]); Key_info = (skb->data[ETH_HLEN+1+1+2+1] << 8)|(skb->data[ETH_HLEN+1+1+2+2]);
if (pDevice->sTxEthHeader.wType == TYPE_PKT_802_1x) { if (pDevice->sTxEthHeader.wType == TYPE_PKT_802_1x) {
if(((Protocol_Version==1) ||(Protocol_Version==2)) && if(((Protocol_Version==1) ||(Protocol_Version==2)) &&
(Packet_Type==3)) { //802.1x OR eapol-key challenge frame transfer (Packet_Type==3)) { //802.1x OR eapol-key challenge frame transfer
@ -3195,7 +3195,7 @@ bRelayPacketSend (
return FALSE; return FALSE;
} }
memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)pbySkbData, U_HEADER_LEN); memcpy(pDevice->sTxEthHeader.abyDstAddr, (PBYTE)pbySkbData, ETH_HLEN);
if (pDevice->bEncryptionEnable == TRUE) { if (pDevice->bEncryptionEnable == TRUE) {
bNeedEncryption = TRUE; bNeedEncryption = TRUE;

View file

@ -36,19 +36,17 @@
// //
// constants // constants
// //
#define U_TYPE_LEN 2 //
#define U_CRC_LEN 4 // #define U_CRC_LEN 4 //
#define U_HEADER_LEN (ETH_ALEN * 2 + U_TYPE_LEN)
#define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1) #define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1)
// Ethernet address string length // Ethernet address string length
#define MIN_DATA_LEN 46 // min data length #define MIN_DATA_LEN 46 // min data length
#define MAX_DATA_LEN 1500 // max data length #define MAX_DATA_LEN 1500 // max data length
#define MIN_PACKET_LEN (MIN_DATA_LEN + U_HEADER_LEN) #define MIN_PACKET_LEN (MIN_DATA_LEN + ETH_HLEN)
// 60 // 60
// min total packet length (tx) // min total packet length (tx)
#define MAX_PACKET_LEN (MAX_DATA_LEN + U_HEADER_LEN) #define MAX_PACKET_LEN (MAX_DATA_LEN + ETH_HLEN)
// 1514 // 1514
// max total packet length (tx) // max total packet length (tx)