~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to drivers/staging/vt6655/tether.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#ifndef __TETHER_H__
30
30
#define __TETHER_H__
31
31
 
 
32
#include <linux/etherdevice.h>
32
33
#include "ttype.h"
33
34
 
34
35
/*---------------------  Export Definitions -------------------------*/
35
36
//
36
37
// constants
37
38
//
38
 
#define U_ETHER_ADDR_LEN    6           // Ethernet address length
39
 
#define U_TYPE_LEN          2           //
40
 
#define U_CRC_LEN           4           //
41
 
#define U_HEADER_LEN        (U_ETHER_ADDR_LEN * 2 + U_TYPE_LEN)
42
 
#define U_ETHER_ADDR_STR_LEN (U_ETHER_ADDR_LEN * 2 + 1)
 
39
#define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1)
43
40
                                        // Ethernet address string length
44
41
 
45
 
#define MIN_DATA_LEN        46          // min data length
46
 
#define MAX_DATA_LEN        1500        // max data length
47
 
 
48
 
#define MIN_PACKET_LEN      (MIN_DATA_LEN + U_HEADER_LEN)
49
 
                                        // 60
50
 
                                        // min total packet length (tx)
51
 
#define MAX_PACKET_LEN      (MAX_DATA_LEN + U_HEADER_LEN)
52
 
                                        // 1514
53
 
                                        // max total packet length (tx)
54
 
 
55
 
#define MAX_LOOKAHEAD_SIZE  MAX_PACKET_LEN
 
42
#define MAX_LOOKAHEAD_SIZE  ETH_FRAME_LEN
56
43
 
57
44
#define U_MULTI_ADDR_LEN    8           // multicast address length
58
45
 
167
154
// Ethernet packet
168
155
//
169
156
typedef struct tagSEthernetHeader {
170
 
    BYTE    abyDstAddr[U_ETHER_ADDR_LEN];
171
 
    BYTE    abySrcAddr[U_ETHER_ADDR_LEN];
172
 
    WORD    wType;
 
157
    unsigned char abyDstAddr[ETH_ALEN];
 
158
    unsigned char abySrcAddr[ETH_ALEN];
 
159
    unsigned short wType;
173
160
}__attribute__ ((__packed__))
174
161
SEthernetHeader, *PSEthernetHeader;
175
162
 
178
165
// 802_3 packet
179
166
//
180
167
typedef struct tagS802_3Header {
181
 
    BYTE    abyDstAddr[U_ETHER_ADDR_LEN];
182
 
    BYTE    abySrcAddr[U_ETHER_ADDR_LEN];
183
 
    WORD    wLen;
 
168
    unsigned char abyDstAddr[ETH_ALEN];
 
169
    unsigned char abySrcAddr[ETH_ALEN];
 
170
    unsigned short wLen;
184
171
}__attribute__ ((__packed__))
185
172
S802_3Header, *PS802_3Header;
186
173
 
188
175
// 802_11 packet
189
176
//
190
177
typedef struct tagS802_11Header {
191
 
    WORD    wFrameCtl;
192
 
    WORD    wDurationID;
193
 
    BYTE    abyAddr1[U_ETHER_ADDR_LEN];
194
 
    BYTE    abyAddr2[U_ETHER_ADDR_LEN];
195
 
    BYTE    abyAddr3[U_ETHER_ADDR_LEN];
196
 
    WORD    wSeqCtl;
197
 
    BYTE    abyAddr4[U_ETHER_ADDR_LEN];
 
178
    unsigned short wFrameCtl;
 
179
    unsigned short wDurationID;
 
180
    unsigned char abyAddr1[ETH_ALEN];
 
181
    unsigned char abyAddr2[ETH_ALEN];
 
182
    unsigned char abyAddr3[ETH_ALEN];
 
183
    unsigned short wSeqCtl;
 
184
    unsigned char abyAddr4[ETH_ALEN];
198
185
}__attribute__ ((__packed__))
199
186
S802_11Header, *PS802_11Header;
200
187
 
201
188
/*---------------------  Export Macros ------------------------------*/
202
 
// Frame type macro
203
 
 
204
 
#define IS_MULTICAST_ADDRESS(pbyEtherAddr)          \
205
 
    ((*(PBYTE)(pbyEtherAddr) & 0x01) == 1)
206
 
 
207
 
#define IS_BROADCAST_ADDRESS(pbyEtherAddr) (        \
208
 
    (*(PDWORD)(pbyEtherAddr) == 0xFFFFFFFFL) &&     \
209
 
    (*(PWORD)((PBYTE)(pbyEtherAddr) + 4) == 0xFFFF) \
210
 
)
211
 
 
212
 
#define IS_NULL_ADDRESS(pbyEtherAddr) (             \
213
 
    (*(PDWORD)(pbyEtherAddr) == 0L) &&              \
214
 
    (*(PWORD)((PBYTE)(pbyEtherAddr) + 4) == 0)      \
215
 
)
216
 
 
217
 
#define IS_ETH_ADDRESS_EQUAL(pbyAddr1, pbyAddr2) (  \
218
 
    (*(PDWORD)(pbyAddr1) == *(PDWORD)(pbyAddr2)) && \
219
 
    (*(PWORD)((PBYTE)(pbyAddr1) + 4) ==             \
220
 
    *(PWORD)((PBYTE)(pbyAddr2) + 4))                \
221
 
)
222
189
 
223
190
/*---------------------  Export Classes  ----------------------------*/
224
191
 
226
193
 
227
194
/*---------------------  Export Functions  --------------------------*/
228
195
 
229
 
BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr);
230
 
//BYTE ETHbyGetHashIndexByCrc(PBYTE pbyMultiAddr);
231
 
BOOL ETHbIsBufferCrc32Ok(PBYTE pbyBuffer, UINT cbFrameLength);
 
196
unsigned char ETHbyGetHashIndexByCrc32(unsigned char *pbyMultiAddr);
 
197
//unsigned char ETHbyGetHashIndexByCrc(unsigned char *pbyMultiAddr);
 
198
bool ETHbIsBufferCrc32Ok(unsigned char *pbyBuffer, unsigned int cbFrameLength);
232
199
 
233
200
#endif // __TETHER_H__
234
201