blob: 42291eed33d6bc355a8bcfcb44a52546a87bb3c8 [file] [log] [blame]
Stephen Hemmingerf8942e02010-09-08 14:46:36 -07001/***********************************
2* Adapter.h
3************************************/
4#ifndef __ADAPTER_H__
5#define __ADAPTER_H__
6
7#define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256
8#include "Debug.h"
9
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040010struct _LEADER {
Kevin McKinney90942142012-05-18 08:50:55 -040011 USHORT Vcid;
12 USHORT PLength;
13 UCHAR Status;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070014 UCHAR Unused[3];
Kevin McKinney90942142012-05-18 08:50:55 -040015} __attribute__((packed));
16typedef struct _LEADER LEADER, *PLEADER;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070017
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040018struct _PACKETTOSEND {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070019 LEADER Leader;
20 UCHAR ucPayload;
Kevin McKinney90942142012-05-18 08:50:55 -040021} __attribute__((packed));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070022typedef struct _PACKETTOSEND PACKETTOSEND, *PPACKETTOSEND;
23
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040024struct _CONTROL_PACKET {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070025 PVOID ControlBuff;
26 UINT ControlBuffLen;
Kevin McKinney90942142012-05-18 08:50:55 -040027 struct _CONTROL_PACKET *next;
28} __attribute__((packed));
29typedef struct _CONTROL_PACKET CONTROL_PACKET, *PCONTROL_PACKET;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070030
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040031struct link_request {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070032 LEADER Leader;
33 UCHAR szData[4];
Kevin McKinney90942142012-05-18 08:50:55 -040034} __attribute__((packed));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070035typedef struct link_request LINK_REQUEST, *PLINK_REQUEST;
36
Kevin McKinney5db647a2012-05-18 08:50:56 -040037/* classification extension is added */
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040038typedef struct _ADD_CONNECTION {
Kevin McKinney90942142012-05-18 08:50:55 -040039 ULONG SrcIpAddressCount;
40 ULONG SrcIpAddress[MAX_CONNECTIONS];
41 ULONG SrcIpMask[MAX_CONNECTIONS];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070042
Kevin McKinney90942142012-05-18 08:50:55 -040043 ULONG DestIpAddressCount;
44 ULONG DestIpAddress[MAX_CONNECTIONS];
45 ULONG DestIpMask[MAX_CONNECTIONS];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070046
Kevin McKinney90942142012-05-18 08:50:55 -040047 USHORT SrcPortBegin;
48 USHORT SrcPortEnd;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070049
Kevin McKinney90942142012-05-18 08:50:55 -040050 USHORT DestPortBegin;
51 USHORT DestPortEnd;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070052
Kevin McKinney90942142012-05-18 08:50:55 -040053 UCHAR SrcTOS;
54 UCHAR SrcProtocol;
55} ADD_CONNECTION, *PADD_CONNECTION;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070056
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040057typedef struct _CLASSIFICATION_RULE {
Kevin McKinney90942142012-05-18 08:50:55 -040058 UCHAR ucIPSrcAddrLen;
59 UCHAR ucIPSrcAddr[32];
60 UCHAR ucIPDestAddrLen;
61 UCHAR ucIPDestAddr[32];
62 UCHAR ucSrcPortRangeLen;
63 UCHAR ucSrcPortRange[4];
64 UCHAR ucDestPortRangeLen;
65 UCHAR ucDestPortRange[4];
66 USHORT usVcid;
67} CLASSIFICATION_RULE, *PCLASSIFICATION_RULE;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070068
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040069typedef struct _CLASSIFICATION_ONLY {
Kevin McKinney90942142012-05-18 08:50:55 -040070 USHORT usVcid;
71 ULONG DestIpAddress;
72 ULONG DestIpMask;
73 USHORT usPortLo;
74 USHORT usPortHi;
75 BOOLEAN bIpVersion;
76 UCHAR ucDestinationAddress[16];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070077} CLASSIFICATION_ONLY, *PCLASSIFICATION_ONLY;
78
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070079#define MAX_IP_RANGE_LENGTH 4
80#define MAX_PORT_RANGE 4
81#define MAX_PROTOCOL_LENGTH 32
82#define IPV6_ADDRESS_SIZEINBYTES 0x10
83
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040084typedef union _U_IP_ADDRESS {
Kevin McKinney90942142012-05-18 08:50:55 -040085 struct {
Kevin McKinney5db647a2012-05-18 08:50:56 -040086 ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH]; /* Source Ip Address Range */
87 ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH]; /* Source Ip Mask Address Range */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070088 };
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040089 struct {
Kevin McKinney5db647a2012-05-18 08:50:56 -040090 ULONG ulIpv6Addr[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Address Range */
91 ULONG ulIpv6Mask[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Mask Address Range */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070092 };
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040093 struct {
Kevin McKinney90942142012-05-18 08:50:55 -040094 UCHAR ucIpv4Address[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS];
95 UCHAR ucIpv4Mask[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070096 };
Kevin McKinneyc71e0a62012-05-18 08:50:54 -040097 struct {
Kevin McKinney90942142012-05-18 08:50:55 -040098 UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
99 UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700100 };
Kevin McKinney90942142012-05-18 08:50:55 -0400101} U_IP_ADDRESS;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700102struct _packet_info;
103
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400104typedef struct _S_HDR_SUPRESSION_CONTEXTINFO {
Kevin McKinney5db647a2012-05-18 08:50:56 -0400105 UCHAR ucaHdrSupressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */
106 UCHAR ucaHdrSupressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */
Kevin McKinney90942142012-05-18 08:50:55 -0400107} S_HDR_SUPRESSION_CONTEXTINFO;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700108
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400109typedef struct _S_CLASSIFIER_RULE {
Kevin McKinney90942142012-05-18 08:50:55 -0400110 ULONG ulSFID;
111 UCHAR ucReserved[2];
112 B_UINT16 uiClassifierRuleIndex;
113 BOOLEAN bUsed;
114 USHORT usVCID_Value;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400115 B_UINT8 u8ClassifierRulePriority; /* This field detemines the Classifier Priority */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700116 U_IP_ADDRESS stSrcIpAddress;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400117 UCHAR ucIPSourceAddressLength; /* Ip Source Address Length */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700118
Kevin McKinney90942142012-05-18 08:50:55 -0400119 U_IP_ADDRESS stDestIpAddress;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400120 UCHAR ucIPDestinationAddressLength; /* Ip Destination Address Length */
121 UCHAR ucIPTypeOfServiceLength; /* Type of service Length */
122 UCHAR ucTosLow; /* Tos Low */
123 UCHAR ucTosHigh; /* Tos High */
124 UCHAR ucTosMask; /* Tos Mask */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700125
Kevin McKinney5db647a2012-05-18 08:50:56 -0400126 UCHAR ucProtocolLength; /* protocol Length */
127 UCHAR ucProtocol[MAX_PROTOCOL_LENGTH]; /* protocol Length */
Kevin McKinney90942142012-05-18 08:50:55 -0400128 USHORT usSrcPortRangeLo[MAX_PORT_RANGE];
129 USHORT usSrcPortRangeHi[MAX_PORT_RANGE];
130 UCHAR ucSrcPortRangeLength;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700131
Kevin McKinney90942142012-05-18 08:50:55 -0400132 USHORT usDestPortRangeLo[MAX_PORT_RANGE];
133 USHORT usDestPortRangeHi[MAX_PORT_RANGE];
134 UCHAR ucDestPortRangeLength;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700135
Kevin McKinney90942142012-05-18 08:50:55 -0400136 BOOLEAN bProtocolValid;
137 BOOLEAN bTOSValid;
138 BOOLEAN bDestIpValid;
139 BOOLEAN bSrcIpValid;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700140
Kevin McKinney5db647a2012-05-18 08:50:56 -0400141 /* For IPv6 Addressing */
Kevin McKinney90942142012-05-18 08:50:55 -0400142 UCHAR ucDirection;
143 BOOLEAN bIpv6Protocol;
144 UINT32 u32PHSRuleID;
145 S_PHS_RULE sPhsRule;
146 UCHAR u8AssociatedPHSI;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700147
Kevin McKinney5db647a2012-05-18 08:50:56 -0400148 /* Classification fields for ETH CS */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700149 UCHAR ucEthCSSrcMACLen;
150 UCHAR au8EThCSSrcMAC[MAC_ADDRESS_SIZE];
151 UCHAR au8EThCSSrcMACMask[MAC_ADDRESS_SIZE];
152 UCHAR ucEthCSDestMACLen;
153 UCHAR au8EThCSDestMAC[MAC_ADDRESS_SIZE];
154 UCHAR au8EThCSDestMACMask[MAC_ADDRESS_SIZE];
155 UCHAR ucEtherTypeLen;
156 UCHAR au8EthCSEtherType[NUM_ETHERTYPE_BYTES];
157 UCHAR usUserPriority[2];
158 USHORT usVLANID;
159 USHORT usValidityBitMap;
Kevin McKinney90942142012-05-18 08:50:55 -0400160} S_CLASSIFIER_RULE;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400161/* typedef struct _S_CLASSIFIER_RULE S_CLASSIFIER_RULE; */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700162
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400163typedef struct _S_FRAGMENTED_PACKET_INFO {
Kevin McKinney90942142012-05-18 08:50:55 -0400164 BOOLEAN bUsed;
165 ULONG ulSrcIpAddress;
166 USHORT usIpIdentification;
167 S_CLASSIFIER_RULE *pstMatchedClassifierEntry;
168 BOOLEAN bOutOfOrderFragment;
169} S_FRAGMENTED_PACKET_INFO, *PS_FRAGMENTED_PACKET_INFO;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700170
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400171struct _packet_info {
Kevin McKinney5db647a2012-05-18 08:50:56 -0400172 /* classification extension Rule */
Kevin McKinney90942142012-05-18 08:50:55 -0400173 ULONG ulSFID;
174 USHORT usVCID_Value;
175 UINT uiThreshold;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400176 /* This field determines the priority of the SF Queues */
Kevin McKinney90942142012-05-18 08:50:55 -0400177 B_UINT8 u8TrafficPriority;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700178
Kevin McKinney90942142012-05-18 08:50:55 -0400179 BOOLEAN bValid;
180 BOOLEAN bActive;
181 BOOLEAN bActivateRequestSent;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700182
Kevin McKinney5db647a2012-05-18 08:50:56 -0400183 B_UINT8 u8QueueType; /* BE or rtPS */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700184
Kevin McKinney5db647a2012-05-18 08:50:56 -0400185 UINT uiMaxBucketSize; /* maximum size of the bucket for the queue */
Kevin McKinney90942142012-05-18 08:50:55 -0400186 UINT uiCurrentQueueDepthOnTarget;
187 UINT uiCurrentBytesOnHost;
188 UINT uiCurrentPacketsOnHost;
189 UINT uiDroppedCountBytes;
190 UINT uiDroppedCountPackets;
191 UINT uiSentBytes;
192 UINT uiSentPackets;
193 UINT uiCurrentDrainRate;
194 UINT uiThisPeriodSentBytes;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700195 LARGE_INTEGER liDrainCalculated;
Kevin McKinney90942142012-05-18 08:50:55 -0400196 UINT uiCurrentTokenCount;
197 LARGE_INTEGER liLastUpdateTokenAt;
198 UINT uiMaxAllowedRate;
199 UINT NumOfPacketsSent;
200 UCHAR ucDirection;
201 USHORT usCID;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700202 S_MIBS_EXTSERVICEFLOW_PARAMETERS stMibsExtServiceFlowTable;
Kevin McKinney90942142012-05-18 08:50:55 -0400203 UINT uiCurrentRxRate;
204 UINT uiThisPeriodRxBytes;
205 UINT uiTotalRxBytes;
206 UINT uiTotalTxBytes;
207 UINT uiPendedLast;
208 UCHAR ucIpVersion;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700209
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400210 union {
211 struct {
Kevin McKinney90942142012-05-18 08:50:55 -0400212 struct sk_buff *FirstTxQueue;
213 struct sk_buff *LastTxQueue;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700214 };
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400215 struct {
Kevin McKinney90942142012-05-18 08:50:55 -0400216 struct sk_buff *ControlHead;
217 struct sk_buff *ControlTail;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700218 };
219 };
Kevin McKinney90942142012-05-18 08:50:55 -0400220
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700221 BOOLEAN bProtocolValid;
222 BOOLEAN bTOSValid;
223 BOOLEAN bDestIpValid;
224 BOOLEAN bSrcIpValid;
225
226 BOOLEAN bActiveSet;
227 BOOLEAN bAdmittedSet;
228 BOOLEAN bAuthorizedSet;
229 BOOLEAN bClassifierPriority;
230 UCHAR ucServiceClassName[MAX_CLASS_NAME_LENGTH];
Kevin McKinney90942142012-05-18 08:50:55 -0400231 BOOLEAN bHeaderSuppressionEnabled;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700232 spinlock_t SFQueueLock;
Kevin McKinney90942142012-05-18 08:50:55 -0400233 void *pstSFIndication;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700234 struct timeval stLastUpdateTokenAt;
Kevin McKinney90942142012-05-18 08:50:55 -0400235 atomic_t uiPerSFTxResourceCount;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700236 UINT uiMaxLatency;
Kevin McKinney90942142012-05-18 08:50:55 -0400237 UCHAR bIPCSSupport;
238 UCHAR bEthCSSupport;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700239};
240typedef struct _packet_info PacketInfo;
241
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400242typedef struct _PER_TARANG_DATA {
Kevin McKinney90942142012-05-18 08:50:55 -0400243 struct _PER_TARANG_DATA *next;
244 struct _MINI_ADAPTER *Adapter;
245 struct sk_buff *RxAppControlHead;
246 struct sk_buff *RxAppControlTail;
247 volatile INT AppCtrlQueueLen;
248 BOOLEAN MacTracingEnabled;
249 BOOLEAN bApplicationToExit;
250 S_MIBS_DROPPED_APP_CNTRL_MESSAGES stDroppedAppCntrlMsgs;
251 ULONG RxCntrlMsgBitMask;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700252} PER_TARANG_DATA, *PPER_TARANG_DATA;
253
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700254#ifdef REL_4_1
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400255typedef struct _TARGET_PARAMS {
Kevin McKinney90942142012-05-18 08:50:55 -0400256 B_UINT32 m_u32CfgVersion;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700257
Kevin McKinney5db647a2012-05-18 08:50:56 -0400258 /* Scanning Related Params */
Kevin McKinney90942142012-05-18 08:50:55 -0400259 B_UINT32 m_u32CenterFrequency;
260 B_UINT32 m_u32BandAScan;
261 B_UINT32 m_u32BandBScan;
262 B_UINT32 m_u32BandCScan;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700263
Kevin McKinney5db647a2012-05-18 08:50:56 -0400264 /* QoS Params */
265 B_UINT32 m_u32minGrantsize; /* size of minimum grant is 0 or 6 */
Kevin McKinney90942142012-05-18 08:50:55 -0400266 B_UINT32 m_u32PHSEnable;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700267
Kevin McKinney5db647a2012-05-18 08:50:56 -0400268 /* HO Params */
Kevin McKinney90942142012-05-18 08:50:55 -0400269 B_UINT32 m_u32HoEnable;
270 B_UINT32 m_u32HoReserved1;
271 B_UINT32 m_u32HoReserved2;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700272
Kevin McKinney5db647a2012-05-18 08:50:56 -0400273 /* Power Control Params */
Kevin McKinney90942142012-05-18 08:50:55 -0400274 B_UINT32 m_u32MimoEnable;
275 B_UINT32 m_u32SecurityEnable;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700276 /*
Kevin McKinney90942142012-05-18 08:50:55 -0400277 * bit 1: 1 Idlemode enable;
278 * bit 2: 1 Sleepmode Enable
279 */
280 B_UINT32 m_u32PowerSavingModesEnable;
281 /* PowerSaving Mode Options:
Kevin McKinney5db647a2012-05-18 08:50:56 -0400282 * bit 0 = 1: CPE mode - to keep pcmcia if alive;
283 * bit 1 = 1: CINR reporing in Idlemode Msg
284 * bit 2 = 1: Default PSC Enable in sleepmode
285 */
Kevin McKinney90942142012-05-18 08:50:55 -0400286 B_UINT32 m_u32PowerSavingModeOptions;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700287
Kevin McKinney90942142012-05-18 08:50:55 -0400288 B_UINT32 m_u32ArqEnable;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700289
Kevin McKinney5db647a2012-05-18 08:50:56 -0400290 /* From Version #3, the HARQ section renamed as general */
Kevin McKinney90942142012-05-18 08:50:55 -0400291 B_UINT32 m_u32HarqEnable;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400292 /* EEPROM Param Location */
Kevin McKinney90942142012-05-18 08:50:55 -0400293 B_UINT32 m_u32EEPROMFlag;
294 /* BINARY TYPE - 4th MSByte:
295 * Interface Type - 3rd MSByte:
296 * Vendor Type - 2nd MSByte
297 */
Kevin McKinney5db647a2012-05-18 08:50:56 -0400298 /* Unused - LSByte */
Kevin McKinney90942142012-05-18 08:50:55 -0400299 B_UINT32 m_u32Customize;
300 B_UINT32 m_u32ConfigBW; /* In Hz */
301 B_UINT32 m_u32ShutDownTimer;
302 B_UINT32 m_u32RadioParameter;
303 B_UINT32 m_u32PhyParameter1;
304 B_UINT32 m_u32PhyParameter2;
305 B_UINT32 m_u32PhyParameter3;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700306
307 /* in eval mode only;
Kevin McKinney90942142012-05-18 08:50:55 -0400308 * lower 16bits = basic cid for testing;
309 * then bit 16 is test cqich,
310 * bit 17 test init rang;
311 * bit 18 test periodic rang
312 * bit 19 is test harq ack/nack
313 */
314 B_UINT32 m_u32TestOptions;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700315 B_UINT32 m_u32MaxMACDataperDLFrame;
316 B_UINT32 m_u32MaxMACDataperULFrame;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700317 B_UINT32 m_u32Corr2MacFlags;
318
Kevin McKinney5db647a2012-05-18 08:50:56 -0400319 /* adding driver params. */
Kevin McKinney90942142012-05-18 08:50:55 -0400320 B_UINT32 HostDrvrConfig1;
321 B_UINT32 HostDrvrConfig2;
322 B_UINT32 HostDrvrConfig3;
323 B_UINT32 HostDrvrConfig4;
324 B_UINT32 HostDrvrConfig5;
325 B_UINT32 HostDrvrConfig6;
326 B_UINT32 m_u32SegmentedPUSCenable;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700327
Kevin McKinney5db647a2012-05-18 08:50:56 -0400328 /* BAMC enable - but 4.x does not support this feature
329 * This is added just to sync 4.x and 5.x CFGs
330 */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700331 B_UINT32 m_u32BandAMCEnable;
332} STARGETPARAMS, *PSTARGETPARAMS;
333#endif
334
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400335typedef struct _STTARGETDSXBUFFER {
Kevin McKinney90942142012-05-18 08:50:55 -0400336 ULONG ulTargetDsxBuffer;
337 B_UINT16 tid;
338 BOOLEAN valid;
339} STTARGETDSXBUFFER, *PSTTARGETDSXBUFFER;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700340
Kevin McKinney90942142012-05-18 08:50:55 -0400341typedef INT (*FP_FLASH_WRITE)(struct _MINI_ADAPTER *, UINT, PVOID);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700342
Kevin McKinney90942142012-05-18 08:50:55 -0400343typedef INT (*FP_FLASH_WRITE_STATUS)(struct _MINI_ADAPTER *, UINT, PVOID);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700344
Kevin McKinney5db647a2012-05-18 08:50:56 -0400345/*
346 * Driver adapter data structure
347 */
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400348struct _MINI_ADAPTER {
Kevin McKinney90942142012-05-18 08:50:55 -0400349 struct _MINI_ADAPTER *next;
Stephen Hemminger4fd64dd2010-11-01 12:12:31 -0400350 struct net_device *dev;
351 u32 msg_enable;
Kevin McKinney90942142012-05-18 08:50:55 -0400352 CHAR *caDsxReqResp;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400353 atomic_t ApplicationRunning;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700354 volatile INT CtrlQueueLen;
Kevin McKinney90942142012-05-18 08:50:55 -0400355 atomic_t AppCtrlQueueLen;
356 BOOLEAN AppCtrlQueueOverFlow;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400357 atomic_t CurrentApplicationCount;
Kevin McKinney90942142012-05-18 08:50:55 -0400358 atomic_t RegisteredApplicationCount;
359 BOOLEAN LinkUpStatus;
360 BOOLEAN TimerActive;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400361 u32 StatisticsPointer;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700362 struct sk_buff *RxControlHead;
363 struct sk_buff *RxControlTail;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700364 struct semaphore RxAppControlQueuelock;
365 struct semaphore fw_download_sema;
Kevin McKinney90942142012-05-18 08:50:55 -0400366 PPER_TARANG_DATA pTarangs;
367 spinlock_t control_queue_lock;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700368 wait_queue_head_t process_read_wait_queue;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700369
Kevin McKinney5db647a2012-05-18 08:50:56 -0400370 /* the pointer to the first packet we have queued in send
371 * deserialized miniport support variables
372 */
Kevin McKinney90942142012-05-18 08:50:55 -0400373 atomic_t TotalPacketCount;
374 atomic_t TxPktAvail;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700375
Kevin McKinney5db647a2012-05-18 08:50:56 -0400376 /* this to keep track of the Tx and Rx MailBox Registers. */
Kevin McKinney90942142012-05-18 08:50:55 -0400377 atomic_t CurrNumFreeTxDesc;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400378 /* to keep track the no of byte received */
Kevin McKinney90942142012-05-18 08:50:55 -0400379 USHORT PrevNumRecvDescs;
380 USHORT CurrNumRecvDescs;
381 UINT u32TotalDSD;
382 PacketInfo PackInfo[NO_OF_QUEUES];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700383 S_CLASSIFIER_RULE astClassifierTable[MAX_CLASSIFIERS];
Kevin McKinney90942142012-05-18 08:50:55 -0400384 BOOLEAN TransferMode;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700385
386 /*************** qos ******************/
Kevin McKinney90942142012-05-18 08:50:55 -0400387 BOOLEAN bETHCSEnabled;
388 ULONG BEBucketSize;
389 ULONG rtPSBucketSize;
390 UCHAR LinkStatus;
391 BOOLEAN AutoLinkUp;
392 BOOLEAN AutoSyncup;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700393
Kevin McKinney90942142012-05-18 08:50:55 -0400394 int major;
395 int minor;
396 wait_queue_head_t tx_packet_wait_queue;
397 wait_queue_head_t process_rx_cntrlpkt;
398 atomic_t process_waiting;
399 BOOLEAN fw_download_done;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700400
Kevin McKinney90942142012-05-18 08:50:55 -0400401 char *txctlpacket[MAX_CNTRL_PKTS];
402 atomic_t cntrlpktCnt ;
403 atomic_t index_app_read_cntrlpkt;
404 atomic_t index_wr_txcntrlpkt;
405 atomic_t index_rd_txcntrlpkt;
406 UINT index_datpkt;
407 struct semaphore rdmwrmsync;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700408
409 STTARGETDSXBUFFER astTargetDsxBuffer[MAX_TARGET_DSX_BUFFERS];
Stephen Hemminger3349d952010-11-01 11:12:56 -0400410 ULONG ulFreeTargetBufferCnt;
Kevin McKinney90942142012-05-18 08:50:55 -0400411 ULONG ulCurrentTargetBuffer;
412 ULONG ulTotalTargetBuffersAvailable;
413 unsigned long chip_id;
414 wait_queue_head_t lowpower_mode_wait_queue;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400415 BOOLEAN bFlashBoot;
416 BOOLEAN bBinDownloaded;
417 BOOLEAN bCfgDownloaded;
418 BOOLEAN bSyncUpRequestSent;
419 USHORT usBestEffortQueueIndex;
Kevin McKinney90942142012-05-18 08:50:55 -0400420 wait_queue_head_t ioctl_fw_dnld_wait_queue;
421 BOOLEAN waiting_to_fw_download_done;
422 pid_t fw_download_process_pid;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700423 PSTARGETPARAMS pstargetparams;
Kevin McKinney90942142012-05-18 08:50:55 -0400424 BOOLEAN device_removed;
425 BOOLEAN DeviceAccess;
426 BOOLEAN bIsAutoCorrectEnabled;
427 BOOLEAN bDDRInitDone;
428 INT DDRSetting;
429 ULONG ulPowerSaveMode;
430 spinlock_t txtransmitlock;
431 B_UINT8 txtransmit_running;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700432 /* Thread for control packet handling */
Kevin McKinney90942142012-05-18 08:50:55 -0400433 struct task_struct *control_packet_handler;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700434 /* thread for transmitting packets. */
Kevin McKinney90942142012-05-18 08:50:55 -0400435 struct task_struct *transmit_packet_thread;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700436
437 /* LED Related Structures */
438 LED_INFO_STRUCT LEDInfo;
439
440 /* Driver State for LED Blinking */
441 LedEventInfo_t DriverState;
442 /* Interface Specific */
Kevin McKinney90942142012-05-18 08:50:55 -0400443 PVOID pvInterfaceAdapter;
444 int (*bcm_file_download)(PVOID,
445 struct file *,
446 unsigned int);
447 int (*bcm_file_readback_from_chip)(PVOID,
448 struct file *,
449 unsigned int);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700450 INT (*interface_rdm)(PVOID,
Kevin McKinney90942142012-05-18 08:50:55 -0400451 UINT,
452 PVOID,
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700453 INT);
454 INT (*interface_wrm)(PVOID,
Kevin McKinney90942142012-05-18 08:50:55 -0400455 UINT,
456 PVOID,
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700457 INT);
458 int (*interface_transmit)(PVOID, PVOID , UINT);
459 BOOLEAN IdleMode;
460 BOOLEAN bDregRequestSentInIdleMode;
461 BOOLEAN bTriedToWakeUpFromlowPowerMode;
462 BOOLEAN bShutStatus;
463 BOOLEAN bWakeUpDevice;
Kevin McKinney90942142012-05-18 08:50:55 -0400464 unsigned int usIdleModePattern;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400465 /* BOOLEAN bTriedToWakeUpFromShutdown; */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700466 BOOLEAN bLinkDownRequested;
Kevin McKinney90942142012-05-18 08:50:55 -0400467 int downloadDDR;
468 PHS_DEVICE_EXTENSION stBCMPhsContext;
469 S_HDR_SUPRESSION_CONTEXTINFO stPhsTxContextInfo;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700470 uint8_t ucaPHSPktRestoreBuf[2048];
471 uint8_t bPHSEnabled;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400472 BOOLEAN AutoFirmDld;
Kevin McKinney90942142012-05-18 08:50:55 -0400473 BOOLEAN bMipsConfig;
474 BOOLEAN bDPLLConfig;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700475 UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
476 UINT32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
477 S_FRAGMENTED_PACKET_INFO astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES];
478 atomic_t uiMBupdate;
479 UINT32 PmuMode;
480 NVM_TYPE eNVMType;
481 UINT uiSectorSize;
482 UINT uiSectorSizeInCFG;
483 BOOLEAN bSectorSizeOverride;
484 BOOLEAN bStatusWrite;
485 UINT uiNVMDSDSize;
486 UINT uiVendorExtnFlag;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400487 /* it will always represent chosen DSD at any point of time.
488 * Generally it is Active DSD but in case of NVM RD/WR it might be different.
489 */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700490 UINT ulFlashCalStart;
Kevin McKinney90942142012-05-18 08:50:55 -0400491 ULONG ulFlashControlSectionStart;
492 ULONG ulFlashWriteSize;
493 ULONG ulFlashID;
494 FP_FLASH_WRITE fpFlashWrite;
495 FP_FLASH_WRITE_STATUS fpFlashWriteWithStatusCheck;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700496
497 struct semaphore NVMRdmWrmLock;
Kevin McKinney90942142012-05-18 08:50:55 -0400498 struct device *pstCreatedClassDevice;
Stephen Hemminger3705a842010-10-29 08:14:16 -0700499
Kevin McKinney5db647a2012-05-18 08:50:56 -0400500 /* BOOLEAN InterfaceUpStatus; */
Kevin McKinney90942142012-05-18 08:50:55 -0400501 PFLASH2X_CS_INFO psFlash2xCSInfo;
502 PFLASH_CS_INFO psFlashCSInfo;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700503 PFLASH2X_VENDORSPECIFIC_INFO psFlash2xVendorInfo;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400504 UINT uiFlashBaseAdd; /* Flash start address */
505 UINT uiActiveISOOffset; /* Active ISO offset chosen before f/w download */
506 FLASH2X_SECTION_VAL eActiveISO; /* Active ISO section val */
507 FLASH2X_SECTION_VAL eActiveDSD; /* Active DSD val chosen before f/w download */
508 UINT uiActiveDSDOffsetAtFwDld; /* For accessing Active DSD chosen before f/w download */
Kevin McKinney90942142012-05-18 08:50:55 -0400509 UINT uiFlashLayoutMajorVersion;
510 UINT uiFlashLayoutMinorVersion;
511 BOOLEAN bAllDSDWriteAllow;
512 BOOLEAN bSigCorrupted;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400513 /* this should be set who so ever want to change the Headers. after Wrtie it should be reset immediately. */
Kevin McKinney90942142012-05-18 08:50:55 -0400514 BOOLEAN bHeaderChangeAllowed;
515 INT SelectedChip;
516 BOOLEAN bEndPointHalted;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400517 /* while bFlashRawRead will be true, Driver ignore map lay out and consider flash as of without any map. */
Kevin McKinney90942142012-05-18 08:50:55 -0400518 BOOLEAN bFlashRawRead;
519 BOOLEAN bPreparingForLowPowerMode;
520 BOOLEAN bDoSuspend;
521 UINT syscfgBefFwDld;
522 BOOLEAN StopAllXaction;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400523 UINT32 liTimeSinceLastNetEntry; /* Used to Support extended CAPI requirements from */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700524 struct semaphore LowPowerModeSync;
Kevin McKinney90942142012-05-18 08:50:55 -0400525 ULONG liDrainCalculated;
526 UINT gpioBitMap;
527 S_BCM_DEBUG_STATE stDebugState;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700528};
529typedef struct _MINI_ADAPTER MINI_ADAPTER, *PMINI_ADAPTER;
530
Kevin McKinney90942142012-05-18 08:50:55 -0400531#define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700532
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700533struct _ETH_HEADER_STRUC {
Kevin McKinney90942142012-05-18 08:50:55 -0400534 UCHAR au8DestinationAddress[6];
535 UCHAR au8SourceAddress[6];
536 USHORT u16Etype;
537} __attribute__((packed));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700538typedef struct _ETH_HEADER_STRUC ETH_HEADER_STRUC, *PETH_HEADER_STRUC;
539
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400540typedef struct FirmwareInfo {
Kevin McKinney90942142012-05-18 08:50:55 -0400541 void __user *pvMappedFirmwareAddress;
542 ULONG u32FirmwareLength;
543 ULONG u32StartingAddress;
544} __attribute__((packed)) FIRMWARE_INFO, *PFIRMWARE_INFO;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700545
Kevin McKinney5db647a2012-05-18 08:50:56 -0400546/* holds the value of net_device structure.. */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700547extern struct net_device *gblpnetdev;
Kevin McKinney90942142012-05-18 08:50:55 -0400548typedef struct _cntl_pkt {
549 PMINI_ADAPTER Adapter;
550 PLEADER PLeader;
551} cntl_pkt;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700552typedef LINK_REQUEST CONTROL_MESSAGE;
553
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400554typedef struct _DDR_SETTING {
Alejandro R. SedeƱob7061132010-11-10 01:42:01 -0500555 UINT ulRegAddress;
556 UINT ulRegValue;
Kevin McKinney90942142012-05-18 08:50:55 -0400557} DDR_SETTING, *PDDR_SETTING;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700558typedef DDR_SETTING DDR_SET_NODE, *PDDR_SET_NODE;
Kevin McKinney90942142012-05-18 08:50:55 -0400559INT InitAdapter(PMINI_ADAPTER psAdapter);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700560
Kevin McKinney5db647a2012-05-18 08:50:56 -0400561/* =====================================================================
562 * Beceem vendor request codes for EP0
563 * =====================================================================
564 */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700565
Kevin McKinney90942142012-05-18 08:50:55 -0400566#define BCM_REQUEST_READ 0x2
567#define BCM_REQUEST_WRITE 0x1
568#define EP2_MPS_REG 0x0F0110A0
569#define EP2_MPS 0x40
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700570
Kevin McKinney90942142012-05-18 08:50:55 -0400571#define EP2_CFG_REG 0x0F0110A8
572#define EP2_CFG_INT 0x27
573#define EP2_CFG_BULK 0x25
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700574
Kevin McKinney90942142012-05-18 08:50:55 -0400575#define EP4_MPS_REG 0x0F0110F0
576#define EP4_MPS 0x8C
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700577
Kevin McKinney90942142012-05-18 08:50:55 -0400578#define EP4_CFG_REG 0x0F0110F8
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700579
Kevin McKinney90942142012-05-18 08:50:55 -0400580#define ISO_MPS_REG 0x0F0110C8
581#define ISO_MPS 0x00000000
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700582
583#define EP1 0
584#define EP2 1
585#define EP3 2
586#define EP4 3
587#define EP5 4
588#define EP6 5
589
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400590typedef enum eInterface_setting {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700591 DEFAULT_SETTING_0 = 0,
592 ALTERNATE_SETTING_1 = 1,
Kevin McKinney90942142012-05-18 08:50:55 -0400593} INTERFACE_SETTING;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700594
Kevin McKinney5db647a2012-05-18 08:50:56 -0400595#endif /* __ADAPTER_H__ */