blob: d2260fe8c2a14dda42084bd513a89090a53ac65e [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 McKinneye1325ad2012-05-18 08:50:57 -040015} __packed;
Kevin McKinney90942142012-05-18 08:50:55 -040016typedef 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 McKinneye1325ad2012-05-18 08:50:57 -040021} __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;
Kevin McKinneye1325ad2012-05-18 08:50:57 -040028} __packed;
Kevin McKinney90942142012-05-18 08:50:55 -040029typedef 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 McKinneye1325ad2012-05-18 08:50:57 -040034} __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 -0700102
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400103typedef struct _S_HDR_SUPRESSION_CONTEXTINFO {
Kevin McKinney5db647a2012-05-18 08:50:56 -0400104 UCHAR ucaHdrSupressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */
105 UCHAR ucaHdrSupressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */
Kevin McKinney90942142012-05-18 08:50:55 -0400106} S_HDR_SUPRESSION_CONTEXTINFO;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700107
Kevin McKinney92562ae2012-05-26 12:05:03 -0400108struct bcm_classifier_rule {
Kevin McKinney90942142012-05-18 08:50:55 -0400109 ULONG ulSFID;
110 UCHAR ucReserved[2];
111 B_UINT16 uiClassifierRuleIndex;
112 BOOLEAN bUsed;
113 USHORT usVCID_Value;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400114 B_UINT8 u8ClassifierRulePriority; /* This field detemines the Classifier Priority */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700115 U_IP_ADDRESS stSrcIpAddress;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400116 UCHAR ucIPSourceAddressLength; /* Ip Source Address Length */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700117
Kevin McKinney90942142012-05-18 08:50:55 -0400118 U_IP_ADDRESS stDestIpAddress;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400119 UCHAR ucIPDestinationAddressLength; /* Ip Destination Address Length */
120 UCHAR ucIPTypeOfServiceLength; /* Type of service Length */
121 UCHAR ucTosLow; /* Tos Low */
122 UCHAR ucTosHigh; /* Tos High */
123 UCHAR ucTosMask; /* Tos Mask */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700124
Kevin McKinney5db647a2012-05-18 08:50:56 -0400125 UCHAR ucProtocolLength; /* protocol Length */
126 UCHAR ucProtocol[MAX_PROTOCOL_LENGTH]; /* protocol Length */
Kevin McKinney90942142012-05-18 08:50:55 -0400127 USHORT usSrcPortRangeLo[MAX_PORT_RANGE];
128 USHORT usSrcPortRangeHi[MAX_PORT_RANGE];
129 UCHAR ucSrcPortRangeLength;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700130
Kevin McKinney90942142012-05-18 08:50:55 -0400131 USHORT usDestPortRangeLo[MAX_PORT_RANGE];
132 USHORT usDestPortRangeHi[MAX_PORT_RANGE];
133 UCHAR ucDestPortRangeLength;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700134
Kevin McKinney90942142012-05-18 08:50:55 -0400135 BOOLEAN bProtocolValid;
136 BOOLEAN bTOSValid;
137 BOOLEAN bDestIpValid;
138 BOOLEAN bSrcIpValid;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700139
Kevin McKinney5db647a2012-05-18 08:50:56 -0400140 /* For IPv6 Addressing */
Kevin McKinney90942142012-05-18 08:50:55 -0400141 UCHAR ucDirection;
142 BOOLEAN bIpv6Protocol;
143 UINT32 u32PHSRuleID;
144 S_PHS_RULE sPhsRule;
145 UCHAR u8AssociatedPHSI;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700146
Kevin McKinney5db647a2012-05-18 08:50:56 -0400147 /* Classification fields for ETH CS */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700148 UCHAR ucEthCSSrcMACLen;
149 UCHAR au8EThCSSrcMAC[MAC_ADDRESS_SIZE];
150 UCHAR au8EThCSSrcMACMask[MAC_ADDRESS_SIZE];
151 UCHAR ucEthCSDestMACLen;
152 UCHAR au8EThCSDestMAC[MAC_ADDRESS_SIZE];
153 UCHAR au8EThCSDestMACMask[MAC_ADDRESS_SIZE];
154 UCHAR ucEtherTypeLen;
155 UCHAR au8EthCSEtherType[NUM_ETHERTYPE_BYTES];
156 UCHAR usUserPriority[2];
157 USHORT usVLANID;
158 USHORT usValidityBitMap;
Kevin McKinney92562ae2012-05-26 12:05:03 -0400159};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700160
Kevin McKinney7f224852012-05-26 12:05:02 -0400161struct bcm_fragmented_packet_info {
Kevin McKinney90942142012-05-18 08:50:55 -0400162 BOOLEAN bUsed;
163 ULONG ulSrcIpAddress;
164 USHORT usIpIdentification;
Kevin McKinney92562ae2012-05-26 12:05:03 -0400165 struct bcm_classifier_rule *pstMatchedClassifierEntry;
Kevin McKinney90942142012-05-18 08:50:55 -0400166 BOOLEAN bOutOfOrderFragment;
Kevin McKinney7f224852012-05-26 12:05:02 -0400167};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700168
Kevin McKinney0b3edf72012-05-26 12:05:01 -0400169struct bcm_packet_info {
Kevin McKinney5db647a2012-05-18 08:50:56 -0400170 /* classification extension Rule */
Kevin McKinney90942142012-05-18 08:50:55 -0400171 ULONG ulSFID;
172 USHORT usVCID_Value;
173 UINT uiThreshold;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400174 /* This field determines the priority of the SF Queues */
Kevin McKinney90942142012-05-18 08:50:55 -0400175 B_UINT8 u8TrafficPriority;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700176
Kevin McKinney90942142012-05-18 08:50:55 -0400177 BOOLEAN bValid;
178 BOOLEAN bActive;
179 BOOLEAN bActivateRequestSent;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700180
Kevin McKinney5db647a2012-05-18 08:50:56 -0400181 B_UINT8 u8QueueType; /* BE or rtPS */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700182
Kevin McKinney5db647a2012-05-18 08:50:56 -0400183 UINT uiMaxBucketSize; /* maximum size of the bucket for the queue */
Kevin McKinney90942142012-05-18 08:50:55 -0400184 UINT uiCurrentQueueDepthOnTarget;
185 UINT uiCurrentBytesOnHost;
186 UINT uiCurrentPacketsOnHost;
187 UINT uiDroppedCountBytes;
188 UINT uiDroppedCountPackets;
189 UINT uiSentBytes;
190 UINT uiSentPackets;
191 UINT uiCurrentDrainRate;
192 UINT uiThisPeriodSentBytes;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700193 LARGE_INTEGER liDrainCalculated;
Kevin McKinney90942142012-05-18 08:50:55 -0400194 UINT uiCurrentTokenCount;
195 LARGE_INTEGER liLastUpdateTokenAt;
196 UINT uiMaxAllowedRate;
197 UINT NumOfPacketsSent;
198 UCHAR ucDirection;
199 USHORT usCID;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700200 S_MIBS_EXTSERVICEFLOW_PARAMETERS stMibsExtServiceFlowTable;
Kevin McKinney90942142012-05-18 08:50:55 -0400201 UINT uiCurrentRxRate;
202 UINT uiThisPeriodRxBytes;
203 UINT uiTotalRxBytes;
204 UINT uiTotalTxBytes;
205 UINT uiPendedLast;
206 UCHAR ucIpVersion;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700207
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400208 union {
209 struct {
Kevin McKinney90942142012-05-18 08:50:55 -0400210 struct sk_buff *FirstTxQueue;
211 struct sk_buff *LastTxQueue;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700212 };
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400213 struct {
Kevin McKinney90942142012-05-18 08:50:55 -0400214 struct sk_buff *ControlHead;
215 struct sk_buff *ControlTail;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700216 };
217 };
Kevin McKinney90942142012-05-18 08:50:55 -0400218
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700219 BOOLEAN bProtocolValid;
220 BOOLEAN bTOSValid;
221 BOOLEAN bDestIpValid;
222 BOOLEAN bSrcIpValid;
223
224 BOOLEAN bActiveSet;
225 BOOLEAN bAdmittedSet;
226 BOOLEAN bAuthorizedSet;
227 BOOLEAN bClassifierPriority;
228 UCHAR ucServiceClassName[MAX_CLASS_NAME_LENGTH];
Kevin McKinney90942142012-05-18 08:50:55 -0400229 BOOLEAN bHeaderSuppressionEnabled;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700230 spinlock_t SFQueueLock;
Kevin McKinney90942142012-05-18 08:50:55 -0400231 void *pstSFIndication;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700232 struct timeval stLastUpdateTokenAt;
Kevin McKinney90942142012-05-18 08:50:55 -0400233 atomic_t uiPerSFTxResourceCount;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700234 UINT uiMaxLatency;
Kevin McKinney90942142012-05-18 08:50:55 -0400235 UCHAR bIPCSSupport;
236 UCHAR bEthCSSupport;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700237};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700238
Kevin McKinney774bea82012-05-26 12:05:00 -0400239struct bcm_tarang_data {
240 struct bcm_tarang_data *next;
Kevin McKinney90942142012-05-18 08:50:55 -0400241 struct _MINI_ADAPTER *Adapter;
242 struct sk_buff *RxAppControlHead;
243 struct sk_buff *RxAppControlTail;
Kevin McKinney26cd2302012-05-18 08:50:59 -0400244 int AppCtrlQueueLen;
Kevin McKinney90942142012-05-18 08:50:55 -0400245 BOOLEAN MacTracingEnabled;
246 BOOLEAN bApplicationToExit;
247 S_MIBS_DROPPED_APP_CNTRL_MESSAGES stDroppedAppCntrlMsgs;
248 ULONG RxCntrlMsgBitMask;
Kevin McKinney774bea82012-05-26 12:05:00 -0400249};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700250
Kevin McKinney37531642012-05-26 12:04:58 -0400251struct bcm_targetdsx_buffer {
Kevin McKinney90942142012-05-18 08:50:55 -0400252 ULONG ulTargetDsxBuffer;
253 B_UINT16 tid;
254 BOOLEAN valid;
Kevin McKinney37531642012-05-26 12:04:58 -0400255};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700256
Kevin McKinneyd4262052012-05-18 08:50:58 -0400257typedef int (*FP_FLASH_WRITE)(struct _MINI_ADAPTER *, UINT, PVOID);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700258
Kevin McKinneyd4262052012-05-18 08:50:58 -0400259typedef int (*FP_FLASH_WRITE_STATUS)(struct _MINI_ADAPTER *, UINT, PVOID);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700260
Kevin McKinney5db647a2012-05-18 08:50:56 -0400261/*
262 * Driver adapter data structure
263 */
Kevin McKinneyc71e0a62012-05-18 08:50:54 -0400264struct _MINI_ADAPTER {
Kevin McKinney90942142012-05-18 08:50:55 -0400265 struct _MINI_ADAPTER *next;
Stephen Hemminger4fd64dd2010-11-01 12:12:31 -0400266 struct net_device *dev;
267 u32 msg_enable;
Kevin McKinney90942142012-05-18 08:50:55 -0400268 CHAR *caDsxReqResp;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400269 atomic_t ApplicationRunning;
Kevin McKinney90942142012-05-18 08:50:55 -0400270 BOOLEAN AppCtrlQueueOverFlow;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400271 atomic_t CurrentApplicationCount;
Kevin McKinney90942142012-05-18 08:50:55 -0400272 atomic_t RegisteredApplicationCount;
273 BOOLEAN LinkUpStatus;
274 BOOLEAN TimerActive;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400275 u32 StatisticsPointer;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700276 struct sk_buff *RxControlHead;
277 struct sk_buff *RxControlTail;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700278 struct semaphore RxAppControlQueuelock;
279 struct semaphore fw_download_sema;
Kevin McKinney774bea82012-05-26 12:05:00 -0400280 struct bcm_tarang_data *pTarangs;
Kevin McKinney90942142012-05-18 08:50:55 -0400281 spinlock_t control_queue_lock;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700282 wait_queue_head_t process_read_wait_queue;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700283
Kevin McKinney5db647a2012-05-18 08:50:56 -0400284 /* the pointer to the first packet we have queued in send
285 * deserialized miniport support variables
286 */
Kevin McKinney90942142012-05-18 08:50:55 -0400287 atomic_t TotalPacketCount;
288 atomic_t TxPktAvail;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700289
Kevin McKinney5db647a2012-05-18 08:50:56 -0400290 /* this to keep track of the Tx and Rx MailBox Registers. */
Kevin McKinney90942142012-05-18 08:50:55 -0400291 atomic_t CurrNumFreeTxDesc;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400292 /* to keep track the no of byte received */
Kevin McKinney90942142012-05-18 08:50:55 -0400293 USHORT PrevNumRecvDescs;
294 USHORT CurrNumRecvDescs;
295 UINT u32TotalDSD;
Kevin McKinney0b3edf72012-05-26 12:05:01 -0400296 struct bcm_packet_info PackInfo[NO_OF_QUEUES];
Kevin McKinney92562ae2012-05-26 12:05:03 -0400297 struct bcm_classifier_rule astClassifierTable[MAX_CLASSIFIERS];
Kevin McKinney90942142012-05-18 08:50:55 -0400298 BOOLEAN TransferMode;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700299
300 /*************** qos ******************/
Kevin McKinney90942142012-05-18 08:50:55 -0400301 BOOLEAN bETHCSEnabled;
302 ULONG BEBucketSize;
303 ULONG rtPSBucketSize;
304 UCHAR LinkStatus;
305 BOOLEAN AutoLinkUp;
306 BOOLEAN AutoSyncup;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700307
Kevin McKinney90942142012-05-18 08:50:55 -0400308 int major;
309 int minor;
310 wait_queue_head_t tx_packet_wait_queue;
311 wait_queue_head_t process_rx_cntrlpkt;
312 atomic_t process_waiting;
313 BOOLEAN fw_download_done;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700314
Kevin McKinney90942142012-05-18 08:50:55 -0400315 char *txctlpacket[MAX_CNTRL_PKTS];
316 atomic_t cntrlpktCnt ;
317 atomic_t index_app_read_cntrlpkt;
318 atomic_t index_wr_txcntrlpkt;
319 atomic_t index_rd_txcntrlpkt;
320 UINT index_datpkt;
321 struct semaphore rdmwrmsync;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700322
Kevin McKinney37531642012-05-26 12:04:58 -0400323 struct bcm_targetdsx_buffer astTargetDsxBuffer[MAX_TARGET_DSX_BUFFERS];
Stephen Hemminger3349d952010-11-01 11:12:56 -0400324 ULONG ulFreeTargetBufferCnt;
Kevin McKinney90942142012-05-18 08:50:55 -0400325 ULONG ulCurrentTargetBuffer;
326 ULONG ulTotalTargetBuffersAvailable;
327 unsigned long chip_id;
328 wait_queue_head_t lowpower_mode_wait_queue;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400329 BOOLEAN bFlashBoot;
330 BOOLEAN bBinDownloaded;
331 BOOLEAN bCfgDownloaded;
332 BOOLEAN bSyncUpRequestSent;
333 USHORT usBestEffortQueueIndex;
Kevin McKinney90942142012-05-18 08:50:55 -0400334 wait_queue_head_t ioctl_fw_dnld_wait_queue;
335 BOOLEAN waiting_to_fw_download_done;
336 pid_t fw_download_process_pid;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700337 PSTARGETPARAMS pstargetparams;
Kevin McKinney90942142012-05-18 08:50:55 -0400338 BOOLEAN device_removed;
339 BOOLEAN DeviceAccess;
340 BOOLEAN bIsAutoCorrectEnabled;
341 BOOLEAN bDDRInitDone;
Kevin McKinneyd4262052012-05-18 08:50:58 -0400342 int DDRSetting;
Kevin McKinney90942142012-05-18 08:50:55 -0400343 ULONG ulPowerSaveMode;
344 spinlock_t txtransmitlock;
345 B_UINT8 txtransmit_running;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700346 /* Thread for control packet handling */
Kevin McKinney90942142012-05-18 08:50:55 -0400347 struct task_struct *control_packet_handler;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700348 /* thread for transmitting packets. */
Kevin McKinney90942142012-05-18 08:50:55 -0400349 struct task_struct *transmit_packet_thread;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700350
351 /* LED Related Structures */
352 LED_INFO_STRUCT LEDInfo;
353
354 /* Driver State for LED Blinking */
355 LedEventInfo_t DriverState;
356 /* Interface Specific */
Kevin McKinney90942142012-05-18 08:50:55 -0400357 PVOID pvInterfaceAdapter;
358 int (*bcm_file_download)(PVOID,
359 struct file *,
360 unsigned int);
361 int (*bcm_file_readback_from_chip)(PVOID,
362 struct file *,
363 unsigned int);
Kevin McKinneyd4262052012-05-18 08:50:58 -0400364 int (*interface_rdm)(PVOID,
Kevin McKinney90942142012-05-18 08:50:55 -0400365 UINT,
366 PVOID,
Kevin McKinneyd4262052012-05-18 08:50:58 -0400367 int);
368 int (*interface_wrm)(PVOID,
Kevin McKinney90942142012-05-18 08:50:55 -0400369 UINT,
370 PVOID,
Kevin McKinneyd4262052012-05-18 08:50:58 -0400371 int);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700372 int (*interface_transmit)(PVOID, PVOID , UINT);
373 BOOLEAN IdleMode;
374 BOOLEAN bDregRequestSentInIdleMode;
375 BOOLEAN bTriedToWakeUpFromlowPowerMode;
376 BOOLEAN bShutStatus;
377 BOOLEAN bWakeUpDevice;
Kevin McKinney90942142012-05-18 08:50:55 -0400378 unsigned int usIdleModePattern;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400379 /* BOOLEAN bTriedToWakeUpFromShutdown; */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700380 BOOLEAN bLinkDownRequested;
Kevin McKinney90942142012-05-18 08:50:55 -0400381 int downloadDDR;
382 PHS_DEVICE_EXTENSION stBCMPhsContext;
383 S_HDR_SUPRESSION_CONTEXTINFO stPhsTxContextInfo;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700384 uint8_t ucaPHSPktRestoreBuf[2048];
385 uint8_t bPHSEnabled;
Stephen Hemminger3349d952010-11-01 11:12:56 -0400386 BOOLEAN AutoFirmDld;
Kevin McKinney90942142012-05-18 08:50:55 -0400387 BOOLEAN bMipsConfig;
388 BOOLEAN bDPLLConfig;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700389 UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
390 UINT32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES];
Kevin McKinney7f224852012-05-26 12:05:02 -0400391 struct bcm_fragmented_packet_info astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES];
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700392 atomic_t uiMBupdate;
393 UINT32 PmuMode;
394 NVM_TYPE eNVMType;
395 UINT uiSectorSize;
396 UINT uiSectorSizeInCFG;
397 BOOLEAN bSectorSizeOverride;
398 BOOLEAN bStatusWrite;
399 UINT uiNVMDSDSize;
400 UINT uiVendorExtnFlag;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400401 /* it will always represent chosen DSD at any point of time.
402 * Generally it is Active DSD but in case of NVM RD/WR it might be different.
403 */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700404 UINT ulFlashCalStart;
Kevin McKinney90942142012-05-18 08:50:55 -0400405 ULONG ulFlashControlSectionStart;
406 ULONG ulFlashWriteSize;
407 ULONG ulFlashID;
408 FP_FLASH_WRITE fpFlashWrite;
409 FP_FLASH_WRITE_STATUS fpFlashWriteWithStatusCheck;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700410
411 struct semaphore NVMRdmWrmLock;
Kevin McKinney90942142012-05-18 08:50:55 -0400412 struct device *pstCreatedClassDevice;
Stephen Hemminger3705a842010-10-29 08:14:16 -0700413
Kevin McKinney5db647a2012-05-18 08:50:56 -0400414 /* BOOLEAN InterfaceUpStatus; */
Kevin McKinney90942142012-05-18 08:50:55 -0400415 PFLASH2X_CS_INFO psFlash2xCSInfo;
416 PFLASH_CS_INFO psFlashCSInfo;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700417 PFLASH2X_VENDORSPECIFIC_INFO psFlash2xVendorInfo;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400418 UINT uiFlashBaseAdd; /* Flash start address */
419 UINT uiActiveISOOffset; /* Active ISO offset chosen before f/w download */
420 FLASH2X_SECTION_VAL eActiveISO; /* Active ISO section val */
421 FLASH2X_SECTION_VAL eActiveDSD; /* Active DSD val chosen before f/w download */
422 UINT uiActiveDSDOffsetAtFwDld; /* For accessing Active DSD chosen before f/w download */
Kevin McKinney90942142012-05-18 08:50:55 -0400423 UINT uiFlashLayoutMajorVersion;
424 UINT uiFlashLayoutMinorVersion;
425 BOOLEAN bAllDSDWriteAllow;
426 BOOLEAN bSigCorrupted;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400427 /* 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 -0400428 BOOLEAN bHeaderChangeAllowed;
Kevin McKinneyd4262052012-05-18 08:50:58 -0400429 int SelectedChip;
Kevin McKinney90942142012-05-18 08:50:55 -0400430 BOOLEAN bEndPointHalted;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400431 /* 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 -0400432 BOOLEAN bFlashRawRead;
433 BOOLEAN bPreparingForLowPowerMode;
434 BOOLEAN bDoSuspend;
435 UINT syscfgBefFwDld;
436 BOOLEAN StopAllXaction;
Kevin McKinney5db647a2012-05-18 08:50:56 -0400437 UINT32 liTimeSinceLastNetEntry; /* Used to Support extended CAPI requirements from */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700438 struct semaphore LowPowerModeSync;
Kevin McKinney90942142012-05-18 08:50:55 -0400439 ULONG liDrainCalculated;
440 UINT gpioBitMap;
441 S_BCM_DEBUG_STATE stDebugState;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700442};
443typedef struct _MINI_ADAPTER MINI_ADAPTER, *PMINI_ADAPTER;
444
Kevin McKinney90942142012-05-18 08:50:55 -0400445#define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700446
Kevin McKinney406a5082012-05-26 12:04:57 -0400447struct bcm_eth_header {
Kevin McKinney90942142012-05-18 08:50:55 -0400448 UCHAR au8DestinationAddress[6];
449 UCHAR au8SourceAddress[6];
450 USHORT u16Etype;
Kevin McKinneye1325ad2012-05-18 08:50:57 -0400451} __packed;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700452
Kevin McKinney7a27a2c2012-05-26 12:04:56 -0400453struct bcm_firmware_info {
Kevin McKinney90942142012-05-18 08:50:55 -0400454 void __user *pvMappedFirmwareAddress;
455 ULONG u32FirmwareLength;
456 ULONG u32StartingAddress;
Kevin McKinney7a27a2c2012-05-26 12:04:56 -0400457} __packed;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700458
Kevin McKinney5db647a2012-05-18 08:50:56 -0400459/* holds the value of net_device structure.. */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700460extern struct net_device *gblpnetdev;
Kevin McKinney7905c782012-05-26 12:04:55 -0400461
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700462typedef LINK_REQUEST CONTROL_MESSAGE;
463
Kevin McKinneybe309992012-05-26 12:04:54 -0400464struct bcm_ddr_setting {
Alejandro R. SedeƱob7061132010-11-10 01:42:01 -0500465 UINT ulRegAddress;
466 UINT ulRegValue;
Kevin McKinneybe309992012-05-26 12:04:54 -0400467};
Kevin McKinneyd4262052012-05-18 08:50:58 -0400468int InitAdapter(PMINI_ADAPTER psAdapter);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700469
Kevin McKinney5db647a2012-05-18 08:50:56 -0400470/* =====================================================================
471 * Beceem vendor request codes for EP0
472 * =====================================================================
473 */
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700474
Kevin McKinney90942142012-05-18 08:50:55 -0400475#define BCM_REQUEST_READ 0x2
476#define BCM_REQUEST_WRITE 0x1
477#define EP2_MPS_REG 0x0F0110A0
478#define EP2_MPS 0x40
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700479
Kevin McKinney90942142012-05-18 08:50:55 -0400480#define EP2_CFG_REG 0x0F0110A8
481#define EP2_CFG_INT 0x27
482#define EP2_CFG_BULK 0x25
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700483
Kevin McKinney90942142012-05-18 08:50:55 -0400484#define EP4_MPS_REG 0x0F0110F0
485#define EP4_MPS 0x8C
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700486
Kevin McKinney90942142012-05-18 08:50:55 -0400487#define EP4_CFG_REG 0x0F0110F8
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700488
Kevin McKinney90942142012-05-18 08:50:55 -0400489#define ISO_MPS_REG 0x0F0110C8
490#define ISO_MPS 0x00000000
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700491
492#define EP1 0
493#define EP2 1
494#define EP3 2
495#define EP4 3
496#define EP5 4
497#define EP6 5
498
Kevin McKinney76cc6f92012-05-26 12:04:53 -0400499enum bcm_einterface_setting {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700500 DEFAULT_SETTING_0 = 0,
501 ALTERNATE_SETTING_1 = 1,
Kevin McKinney76cc6f92012-05-26 12:04:53 -0400502};
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700503
Kevin McKinney5db647a2012-05-18 08:50:56 -0400504#endif /* __ADAPTER_H__ */