1 /***********************************
3 ************************************/
7 #define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256
17 struct bcm_packettosend
{
18 struct bcm_leader Leader
;
22 struct bcm_control_packet
{
25 struct bcm_control_packet
*next
;
28 struct bcm_link_request
{
29 struct bcm_leader Leader
;
33 #define MAX_IP_RANGE_LENGTH 4
34 #define MAX_PORT_RANGE 4
35 #define MAX_PROTOCOL_LENGTH 32
36 #define IPV6_ADDRESS_SIZEINBYTES 0x10
38 typedef union _U_IP_ADDRESS
{
40 ULONG ulIpv4Addr
[MAX_IP_RANGE_LENGTH
]; /* Source Ip Address Range */
41 ULONG ulIpv4Mask
[MAX_IP_RANGE_LENGTH
]; /* Source Ip Mask Address Range */
44 ULONG ulIpv6Addr
[MAX_IP_RANGE_LENGTH
* 4]; /* Source Ip Address Range */
45 ULONG ulIpv6Mask
[MAX_IP_RANGE_LENGTH
* 4]; /* Source Ip Mask Address Range */
48 UCHAR ucIpv4Address
[MAX_IP_RANGE_LENGTH
* IP_LENGTH_OF_ADDRESS
];
49 UCHAR ucIpv4Mask
[MAX_IP_RANGE_LENGTH
* IP_LENGTH_OF_ADDRESS
];
52 UCHAR ucIpv6Address
[MAX_IP_RANGE_LENGTH
* IPV6_ADDRESS_SIZEINBYTES
];
53 UCHAR ucIpv6Mask
[MAX_IP_RANGE_LENGTH
* IPV6_ADDRESS_SIZEINBYTES
];
57 struct bcm_hdr_suppression_contextinfo
{
58 UCHAR ucaHdrSuppressionInBuf
[MAX_PHS_LENGTHS
]; /* Intermediate buffer to accumulate pkt Header for PHS */
59 UCHAR ucaHdrSuppressionOutBuf
[MAX_PHS_LENGTHS
+ PHSI_LEN
]; /* Intermediate buffer containing pkt Header after PHS */
62 struct bcm_classifier_rule
{
65 B_UINT16 uiClassifierRuleIndex
;
68 B_UINT8 u8ClassifierRulePriority
; /* This field detemines the Classifier Priority */
69 U_IP_ADDRESS stSrcIpAddress
;
70 UCHAR ucIPSourceAddressLength
; /* Ip Source Address Length */
72 U_IP_ADDRESS stDestIpAddress
;
73 UCHAR ucIPDestinationAddressLength
; /* Ip Destination Address Length */
74 UCHAR ucIPTypeOfServiceLength
; /* Type of service Length */
75 UCHAR ucTosLow
; /* Tos Low */
76 UCHAR ucTosHigh
; /* Tos High */
77 UCHAR ucTosMask
; /* Tos Mask */
79 UCHAR ucProtocolLength
; /* protocol Length */
80 UCHAR ucProtocol
[MAX_PROTOCOL_LENGTH
]; /* protocol Length */
81 USHORT usSrcPortRangeLo
[MAX_PORT_RANGE
];
82 USHORT usSrcPortRangeHi
[MAX_PORT_RANGE
];
83 UCHAR ucSrcPortRangeLength
;
85 USHORT usDestPortRangeLo
[MAX_PORT_RANGE
];
86 USHORT usDestPortRangeHi
[MAX_PORT_RANGE
];
87 UCHAR ucDestPortRangeLength
;
89 BOOLEAN bProtocolValid
;
94 /* For IPv6 Addressing */
96 BOOLEAN bIpv6Protocol
;
98 struct bcm_phs_rule sPhsRule
;
99 UCHAR u8AssociatedPHSI
;
101 /* Classification fields for ETH CS */
102 UCHAR ucEthCSSrcMACLen
;
103 UCHAR au8EThCSSrcMAC
[MAC_ADDRESS_SIZE
];
104 UCHAR au8EThCSSrcMACMask
[MAC_ADDRESS_SIZE
];
105 UCHAR ucEthCSDestMACLen
;
106 UCHAR au8EThCSDestMAC
[MAC_ADDRESS_SIZE
];
107 UCHAR au8EThCSDestMACMask
[MAC_ADDRESS_SIZE
];
108 UCHAR ucEtherTypeLen
;
109 UCHAR au8EthCSEtherType
[NUM_ETHERTYPE_BYTES
];
110 UCHAR usUserPriority
[2];
112 USHORT usValidityBitMap
;
115 struct bcm_fragmented_packet_info
{
117 ULONG ulSrcIpAddress
;
118 USHORT usIpIdentification
;
119 struct bcm_classifier_rule
*pstMatchedClassifierEntry
;
120 BOOLEAN bOutOfOrderFragment
;
123 struct bcm_packet_info
{
124 /* classification extension Rule */
128 /* This field determines the priority of the SF Queues */
129 B_UINT8 u8TrafficPriority
;
133 BOOLEAN bActivateRequestSent
;
135 B_UINT8 u8QueueType
; /* BE or rtPS */
137 UINT uiMaxBucketSize
; /* maximum size of the bucket for the queue */
138 UINT uiCurrentQueueDepthOnTarget
;
139 UINT uiCurrentBytesOnHost
;
140 UINT uiCurrentPacketsOnHost
;
141 UINT uiDroppedCountBytes
;
142 UINT uiDroppedCountPackets
;
145 UINT uiCurrentDrainRate
;
146 UINT uiThisPeriodSentBytes
;
147 LARGE_INTEGER liDrainCalculated
;
148 UINT uiCurrentTokenCount
;
149 LARGE_INTEGER liLastUpdateTokenAt
;
150 UINT uiMaxAllowedRate
;
151 UINT NumOfPacketsSent
;
154 struct bcm_mibs_parameters stMibsExtServiceFlowTable
;
155 UINT uiCurrentRxRate
;
156 UINT uiThisPeriodRxBytes
;
164 struct sk_buff
*FirstTxQueue
;
165 struct sk_buff
*LastTxQueue
;
168 struct sk_buff
*ControlHead
;
169 struct sk_buff
*ControlTail
;
173 BOOLEAN bProtocolValid
;
175 BOOLEAN bDestIpValid
;
179 BOOLEAN bAdmittedSet
;
180 BOOLEAN bAuthorizedSet
;
181 BOOLEAN bClassifierPriority
;
182 UCHAR ucServiceClassName
[MAX_CLASS_NAME_LENGTH
];
183 BOOLEAN bHeaderSuppressionEnabled
;
184 spinlock_t SFQueueLock
;
185 void *pstSFIndication
;
186 struct timeval stLastUpdateTokenAt
;
187 atomic_t uiPerSFTxResourceCount
;
193 struct bcm_tarang_data
{
194 struct bcm_tarang_data
*next
;
195 struct bcm_mini_adapter
*Adapter
;
196 struct sk_buff
*RxAppControlHead
;
197 struct sk_buff
*RxAppControlTail
;
199 BOOLEAN MacTracingEnabled
;
200 BOOLEAN bApplicationToExit
;
201 struct bcm_mibs_dropped_cntrl_msg stDroppedAppCntrlMsgs
;
202 ULONG RxCntrlMsgBitMask
;
205 struct bcm_targetdsx_buffer
{
206 ULONG ulTargetDsxBuffer
;
211 typedef int (*FP_FLASH_WRITE
)(struct bcm_mini_adapter
*, UINT
, PVOID
);
213 typedef int (*FP_FLASH_WRITE_STATUS
)(struct bcm_mini_adapter
*, UINT
, PVOID
);
216 * Driver adapter data structure
218 struct bcm_mini_adapter
{
219 struct bcm_mini_adapter
*next
;
220 struct net_device
*dev
;
223 atomic_t ApplicationRunning
;
224 BOOLEAN AppCtrlQueueOverFlow
;
225 atomic_t CurrentApplicationCount
;
226 atomic_t RegisteredApplicationCount
;
227 BOOLEAN LinkUpStatus
;
229 u32 StatisticsPointer
;
230 struct sk_buff
*RxControlHead
;
231 struct sk_buff
*RxControlTail
;
232 struct semaphore RxAppControlQueuelock
;
233 struct semaphore fw_download_sema
;
234 struct bcm_tarang_data
*pTarangs
;
235 spinlock_t control_queue_lock
;
236 wait_queue_head_t process_read_wait_queue
;
238 /* the pointer to the first packet we have queued in send
239 * deserialized miniport support variables
241 atomic_t TotalPacketCount
;
244 /* this to keep track of the Tx and Rx MailBox Registers. */
245 atomic_t CurrNumFreeTxDesc
;
246 /* to keep track the no of byte received */
247 USHORT PrevNumRecvDescs
;
248 USHORT CurrNumRecvDescs
;
250 struct bcm_packet_info PackInfo
[NO_OF_QUEUES
];
251 struct bcm_classifier_rule astClassifierTable
[MAX_CLASSIFIERS
];
252 BOOLEAN TransferMode
;
254 /*************** qos ******************/
255 BOOLEAN bETHCSEnabled
;
257 ULONG rtPSBucketSize
;
264 wait_queue_head_t tx_packet_wait_queue
;
265 wait_queue_head_t process_rx_cntrlpkt
;
266 atomic_t process_waiting
;
267 BOOLEAN fw_download_done
;
269 char *txctlpacket
[MAX_CNTRL_PKTS
];
270 atomic_t cntrlpktCnt
;
271 atomic_t index_app_read_cntrlpkt
;
272 atomic_t index_wr_txcntrlpkt
;
273 atomic_t index_rd_txcntrlpkt
;
275 struct semaphore rdmwrmsync
;
277 struct bcm_targetdsx_buffer astTargetDsxBuffer
[MAX_TARGET_DSX_BUFFERS
];
278 ULONG ulFreeTargetBufferCnt
;
279 ULONG ulCurrentTargetBuffer
;
280 ULONG ulTotalTargetBuffersAvailable
;
281 unsigned long chip_id
;
282 wait_queue_head_t lowpower_mode_wait_queue
;
284 BOOLEAN bBinDownloaded
;
285 BOOLEAN bCfgDownloaded
;
286 BOOLEAN bSyncUpRequestSent
;
287 USHORT usBestEffortQueueIndex
;
288 wait_queue_head_t ioctl_fw_dnld_wait_queue
;
289 BOOLEAN waiting_to_fw_download_done
;
290 pid_t fw_download_process_pid
;
291 struct bcm_target_params
*pstargetparams
;
292 BOOLEAN device_removed
;
293 BOOLEAN DeviceAccess
;
294 BOOLEAN bIsAutoCorrectEnabled
;
295 BOOLEAN bDDRInitDone
;
297 ULONG ulPowerSaveMode
;
298 spinlock_t txtransmitlock
;
299 B_UINT8 txtransmit_running
;
300 /* Thread for control packet handling */
301 struct task_struct
*control_packet_handler
;
302 /* thread for transmitting packets. */
303 struct task_struct
*transmit_packet_thread
;
305 /* LED Related Structures */
306 struct bcm_led_info LEDInfo
;
308 /* Driver State for LED Blinking */
309 enum bcm_led_events DriverState
;
310 /* Interface Specific */
311 PVOID pvInterfaceAdapter
;
312 int (*bcm_file_download
)(PVOID
,
315 int (*bcm_file_readback_from_chip
)(PVOID
,
318 int (*interface_rdm
)(PVOID
,
322 int (*interface_wrm
)(PVOID
,
326 int (*interface_transmit
)(PVOID
, PVOID
, UINT
);
328 BOOLEAN bDregRequestSentInIdleMode
;
329 BOOLEAN bTriedToWakeUpFromlowPowerMode
;
331 BOOLEAN bWakeUpDevice
;
332 unsigned int usIdleModePattern
;
333 /* BOOLEAN bTriedToWakeUpFromShutdown; */
334 BOOLEAN bLinkDownRequested
;
336 struct bcm_phs_extension stBCMPhsContext
;
337 struct bcm_hdr_suppression_contextinfo stPhsTxContextInfo
;
338 uint8_t ucaPHSPktRestoreBuf
[2048];
343 UINT32 aTxPktSizeHist
[MIBS_MAX_HIST_ENTRIES
];
344 UINT32 aRxPktSizeHist
[MIBS_MAX_HIST_ENTRIES
];
345 struct bcm_fragmented_packet_info astFragmentedPktClassifierTable
[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES
];
348 enum bcm_nvm_type eNVMType
;
350 UINT uiSectorSizeInCFG
;
351 BOOLEAN bSectorSizeOverride
;
352 BOOLEAN bStatusWrite
;
354 UINT uiVendorExtnFlag
;
355 /* it will always represent chosen DSD at any point of time.
356 * Generally it is Active DSD but in case of NVM RD/WR it might be different.
358 UINT ulFlashCalStart
;
359 ULONG ulFlashControlSectionStart
;
360 ULONG ulFlashWriteSize
;
362 FP_FLASH_WRITE fpFlashWrite
;
363 FP_FLASH_WRITE_STATUS fpFlashWriteWithStatusCheck
;
365 struct semaphore NVMRdmWrmLock
;
366 struct device
*pstCreatedClassDevice
;
368 /* BOOLEAN InterfaceUpStatus; */
369 struct bcm_flash2x_cs_info
*psFlash2xCSInfo
;
370 struct bcm_flash_cs_info
*psFlashCSInfo
;
371 struct bcm_flash2x_vendor_info
*psFlash2xVendorInfo
;
372 UINT uiFlashBaseAdd
; /* Flash start address */
373 UINT uiActiveISOOffset
; /* Active ISO offset chosen before f/w download */
374 enum bcm_flash2x_section_val eActiveISO
; /* Active ISO section val */
375 enum bcm_flash2x_section_val eActiveDSD
; /* Active DSD val chosen before f/w download */
376 UINT uiActiveDSDOffsetAtFwDld
; /* For accessing Active DSD chosen before f/w download */
377 UINT uiFlashLayoutMajorVersion
;
378 UINT uiFlashLayoutMinorVersion
;
379 BOOLEAN bAllDSDWriteAllow
;
380 BOOLEAN bSigCorrupted
;
381 /* this should be set who so ever want to change the Headers. after Wrtie it should be reset immediately. */
382 BOOLEAN bHeaderChangeAllowed
;
384 BOOLEAN bEndPointHalted
;
385 /* while bFlashRawRead will be true, Driver ignore map lay out and consider flash as of without any map. */
386 BOOLEAN bFlashRawRead
;
387 BOOLEAN bPreparingForLowPowerMode
;
390 BOOLEAN StopAllXaction
;
391 UINT32 liTimeSinceLastNetEntry
; /* Used to Support extended CAPI requirements from */
392 struct semaphore LowPowerModeSync
;
393 ULONG liDrainCalculated
;
395 struct bcm_debug_state stDebugState
;
398 #define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev)
400 struct bcm_eth_header
{
401 UCHAR au8DestinationAddress
[6];
402 UCHAR au8SourceAddress
[6];
406 struct bcm_firmware_info
{
407 void __user
*pvMappedFirmwareAddress
;
408 ULONG u32FirmwareLength
;
409 ULONG u32StartingAddress
;
412 /* holds the value of net_device structure.. */
413 extern struct net_device
*gblpnetdev
;
415 struct bcm_ddr_setting
{
419 int InitAdapter(struct bcm_mini_adapter
*psAdapter
);
421 /* =====================================================================
422 * Beceem vendor request codes for EP0
423 * =====================================================================
426 #define BCM_REQUEST_READ 0x2
427 #define BCM_REQUEST_WRITE 0x1
428 #define EP2_MPS_REG 0x0F0110A0
431 #define EP2_CFG_REG 0x0F0110A8
432 #define EP2_CFG_INT 0x27
433 #define EP2_CFG_BULK 0x25
435 #define EP4_MPS_REG 0x0F0110F0
438 #define EP4_CFG_REG 0x0F0110F8
440 #define ISO_MPS_REG 0x0F0110C8
441 #define ISO_MPS 0x00000000
450 enum bcm_einterface_setting
{
451 DEFAULT_SETTING_0
= 0,
452 ALTERNATE_SETTING_1
= 1,
455 #endif /* __ADAPTER_H__ */