diff options
Diffstat (limited to 'drivers/staging/bcm')
-rw-r--r-- | drivers/staging/bcm/Adapter.h | 883 | ||||
-rw-r--r-- | drivers/staging/bcm/DDRInit.c | 26 | ||||
-rw-r--r-- | drivers/staging/bcm/IPv6Protocol.c | 409 | ||||
-rw-r--r-- | drivers/staging/bcm/Misc.c | 2 |
4 files changed, 656 insertions, 664 deletions
diff --git a/drivers/staging/bcm/Adapter.h b/drivers/staging/bcm/Adapter.h index 20cca24..aa51d17 100644 --- a/drivers/staging/bcm/Adapter.h +++ b/drivers/staging/bcm/Adapter.h @@ -7,168 +7,145 @@ #define MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES 256 #include "Debug.h" -struct _LEADER -{ - USHORT Vcid; - USHORT PLength; - UCHAR Status; +struct _LEADER { + USHORT Vcid; + USHORT PLength; + UCHAR Status; UCHAR Unused[3]; -}__attribute__((packed)); -typedef struct _LEADER LEADER,*PLEADER; +} __packed; +typedef struct _LEADER LEADER, *PLEADER; -struct _PACKETTOSEND -{ +struct _PACKETTOSEND { LEADER Leader; UCHAR ucPayload; -}__attribute__((packed)); +} __packed; typedef struct _PACKETTOSEND PACKETTOSEND, *PPACKETTOSEND; - -struct _CONTROL_PACKET -{ +struct _CONTROL_PACKET { PVOID ControlBuff; UINT ControlBuffLen; - struct _CONTROL_PACKET* next; -}__attribute__((packed)); -typedef struct _CONTROL_PACKET CONTROL_PACKET,*PCONTROL_PACKET; - + struct _CONTROL_PACKET *next; +} __packed; +typedef struct _CONTROL_PACKET CONTROL_PACKET, *PCONTROL_PACKET; -struct link_request -{ +struct link_request { LEADER Leader; UCHAR szData[4]; -}__attribute__((packed)); +} __packed; typedef struct link_request LINK_REQUEST, *PLINK_REQUEST; - -//classification extension is added -typedef struct _ADD_CONNECTION -{ - ULONG SrcIpAddressCount; - ULONG SrcIpAddress[MAX_CONNECTIONS]; - ULONG SrcIpMask[MAX_CONNECTIONS]; - - ULONG DestIpAddressCount; - ULONG DestIpAddress[MAX_CONNECTIONS]; - ULONG DestIpMask[MAX_CONNECTIONS]; - - USHORT SrcPortBegin; - USHORT SrcPortEnd; - - USHORT DestPortBegin; - USHORT DestPortEnd; - - UCHAR SrcTOS; - UCHAR SrcProtocol; -} ADD_CONNECTION,*PADD_CONNECTION; - - -typedef struct _CLASSIFICATION_RULE -{ - UCHAR ucIPSrcAddrLen; - UCHAR ucIPSrcAddr[32]; - UCHAR ucIPDestAddrLen; - UCHAR ucIPDestAddr[32]; - UCHAR ucSrcPortRangeLen; - UCHAR ucSrcPortRange[4]; - UCHAR ucDestPortRangeLen; - UCHAR ucDestPortRange[4]; - USHORT usVcid; -} CLASSIFICATION_RULE,*PCLASSIFICATION_RULE; - -typedef struct _CLASSIFICATION_ONLY -{ - USHORT usVcid; - ULONG DestIpAddress; - ULONG DestIpMask; - USHORT usPortLo; - USHORT usPortHi; - BOOLEAN bIpVersion; - UCHAR ucDestinationAddress[16]; +/* classification extension is added */ +typedef struct _ADD_CONNECTION { + ULONG SrcIpAddressCount; + ULONG SrcIpAddress[MAX_CONNECTIONS]; + ULONG SrcIpMask[MAX_CONNECTIONS]; + + ULONG DestIpAddressCount; + ULONG DestIpAddress[MAX_CONNECTIONS]; + ULONG DestIpMask[MAX_CONNECTIONS]; + + USHORT SrcPortBegin; + USHORT SrcPortEnd; + + USHORT DestPortBegin; + USHORT DestPortEnd; + + UCHAR SrcTOS; + UCHAR SrcProtocol; +} ADD_CONNECTION, *PADD_CONNECTION; + +typedef struct _CLASSIFICATION_RULE { + UCHAR ucIPSrcAddrLen; + UCHAR ucIPSrcAddr[32]; + UCHAR ucIPDestAddrLen; + UCHAR ucIPDestAddr[32]; + UCHAR ucSrcPortRangeLen; + UCHAR ucSrcPortRange[4]; + UCHAR ucDestPortRangeLen; + UCHAR ucDestPortRange[4]; + USHORT usVcid; +} CLASSIFICATION_RULE, *PCLASSIFICATION_RULE; + +typedef struct _CLASSIFICATION_ONLY { + USHORT usVcid; + ULONG DestIpAddress; + ULONG DestIpMask; + USHORT usPortLo; + USHORT usPortHi; + BOOLEAN bIpVersion; + UCHAR ucDestinationAddress[16]; } CLASSIFICATION_ONLY, *PCLASSIFICATION_ONLY; - #define MAX_IP_RANGE_LENGTH 4 #define MAX_PORT_RANGE 4 #define MAX_PROTOCOL_LENGTH 32 #define IPV6_ADDRESS_SIZEINBYTES 0x10 -typedef union _U_IP_ADDRESS -{ - struct - { - ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH];//Source Ip Address Range - ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH];//Source Ip Mask Address Range +typedef union _U_IP_ADDRESS { + struct { + ULONG ulIpv4Addr[MAX_IP_RANGE_LENGTH]; /* Source Ip Address Range */ + ULONG ulIpv4Mask[MAX_IP_RANGE_LENGTH]; /* Source Ip Mask Address Range */ }; - struct - { - ULONG ulIpv6Addr[MAX_IP_RANGE_LENGTH * 4];//Source Ip Address Range - ULONG ulIpv6Mask[MAX_IP_RANGE_LENGTH * 4];//Source Ip Mask Address Range - + struct { + ULONG ulIpv6Addr[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Address Range */ + ULONG ulIpv6Mask[MAX_IP_RANGE_LENGTH * 4]; /* Source Ip Mask Address Range */ }; - struct - { - UCHAR ucIpv4Address[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; - UCHAR ucIpv4Mask[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; + struct { + UCHAR ucIpv4Address[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; + UCHAR ucIpv4Mask[MAX_IP_RANGE_LENGTH * IP_LENGTH_OF_ADDRESS]; }; - struct - { - UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; - UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; + struct { + UCHAR ucIpv6Address[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; + UCHAR ucIpv6Mask[MAX_IP_RANGE_LENGTH * IPV6_ADDRESS_SIZEINBYTES]; }; -}U_IP_ADDRESS; +} U_IP_ADDRESS; struct _packet_info; -typedef struct _S_HDR_SUPRESSION_CONTEXTINFO -{ +typedef struct _S_HDR_SUPRESSION_CONTEXTINFO { + UCHAR ucaHdrSupressionInBuf[MAX_PHS_LENGTHS]; /* Intermediate buffer to accumulate pkt Header for PHS */ + UCHAR ucaHdrSupressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; /* Intermediate buffer containing pkt Header after PHS */ +} S_HDR_SUPRESSION_CONTEXTINFO; + +typedef struct _S_CLASSIFIER_RULE { + ULONG ulSFID; + UCHAR ucReserved[2]; + B_UINT16 uiClassifierRuleIndex; + BOOLEAN bUsed; + USHORT usVCID_Value; + B_UINT8 u8ClassifierRulePriority; /* This field detemines the Classifier Priority */ + U_IP_ADDRESS stSrcIpAddress; + UCHAR ucIPSourceAddressLength; /* Ip Source Address Length */ - UCHAR ucaHdrSupressionInBuf[MAX_PHS_LENGTHS]; //Intermediate buffer to accumulate pkt Header for PHS - UCHAR ucaHdrSupressionOutBuf[MAX_PHS_LENGTHS + PHSI_LEN]; //Intermediate buffer containing pkt Header after PHS + U_IP_ADDRESS stDestIpAddress; + UCHAR ucIPDestinationAddressLength; /* Ip Destination Address Length */ + UCHAR ucIPTypeOfServiceLength; /* Type of service Length */ + UCHAR ucTosLow; /* Tos Low */ + UCHAR ucTosHigh; /* Tos High */ + UCHAR ucTosMask; /* Tos Mask */ -}S_HDR_SUPRESSION_CONTEXTINFO; + UCHAR ucProtocolLength; /* protocol Length */ + UCHAR ucProtocol[MAX_PROTOCOL_LENGTH]; /* protocol Length */ + USHORT usSrcPortRangeLo[MAX_PORT_RANGE]; + USHORT usSrcPortRangeHi[MAX_PORT_RANGE]; + UCHAR ucSrcPortRangeLength; + USHORT usDestPortRangeLo[MAX_PORT_RANGE]; + USHORT usDestPortRangeHi[MAX_PORT_RANGE]; + UCHAR ucDestPortRangeLength; -typedef struct _S_CLASSIFIER_RULE -{ - ULONG ulSFID; - UCHAR ucReserved[2]; - B_UINT16 uiClassifierRuleIndex; - BOOLEAN bUsed; - USHORT usVCID_Value; - B_UINT8 u8ClassifierRulePriority; //This field detemines the Classifier Priority - U_IP_ADDRESS stSrcIpAddress; - UCHAR ucIPSourceAddressLength;//Ip Source Address Length - - U_IP_ADDRESS stDestIpAddress; - UCHAR ucIPDestinationAddressLength;//Ip Destination Address Length - UCHAR ucIPTypeOfServiceLength;//Type of service Length - UCHAR ucTosLow;//Tos Low - UCHAR ucTosHigh;//Tos High - UCHAR ucTosMask;//Tos Mask - - UCHAR ucProtocolLength;//protocol Length - UCHAR ucProtocol[MAX_PROTOCOL_LENGTH];//protocol Length - USHORT usSrcPortRangeLo[MAX_PORT_RANGE]; - USHORT usSrcPortRangeHi[MAX_PORT_RANGE]; - UCHAR ucSrcPortRangeLength; - - USHORT usDestPortRangeLo[MAX_PORT_RANGE]; - USHORT usDestPortRangeHi[MAX_PORT_RANGE]; - UCHAR ucDestPortRangeLength; - - BOOLEAN bProtocolValid; - BOOLEAN bTOSValid; - BOOLEAN bDestIpValid; - BOOLEAN bSrcIpValid; - - //For IPv6 Addressing - UCHAR ucDirection; - BOOLEAN bIpv6Protocol; - UINT32 u32PHSRuleID; - S_PHS_RULE sPhsRule; - UCHAR u8AssociatedPHSI; - - //Classification fields for ETH CS + BOOLEAN bProtocolValid; + BOOLEAN bTOSValid; + BOOLEAN bDestIpValid; + BOOLEAN bSrcIpValid; + + /* For IPv6 Addressing */ + UCHAR ucDirection; + BOOLEAN bIpv6Protocol; + UINT32 u32PHSRuleID; + S_PHS_RULE sPhsRule; + UCHAR u8AssociatedPHSI; + + /* Classification fields for ETH CS */ UCHAR ucEthCSSrcMACLen; UCHAR au8EThCSSrcMAC[MAC_ADDRESS_SIZE]; UCHAR au8EThCSSrcMACMask[MAC_ADDRESS_SIZE]; @@ -180,71 +157,67 @@ typedef struct _S_CLASSIFIER_RULE UCHAR usUserPriority[2]; USHORT usVLANID; USHORT usValidityBitMap; -}S_CLASSIFIER_RULE; -//typedef struct _S_CLASSIFIER_RULE S_CLASSIFIER_RULE; - -typedef struct _S_FRAGMENTED_PACKET_INFO -{ - BOOLEAN bUsed; - ULONG ulSrcIpAddress; - USHORT usIpIdentification; - S_CLASSIFIER_RULE *pstMatchedClassifierEntry; - BOOLEAN bOutOfOrderFragment; -}S_FRAGMENTED_PACKET_INFO,*PS_FRAGMENTED_PACKET_INFO; - -struct _packet_info -{ - //classification extension Rule - ULONG ulSFID; - USHORT usVCID_Value; - UINT uiThreshold; - // This field determines the priority of the SF Queues - B_UINT8 u8TrafficPriority; - - BOOLEAN bValid; - BOOLEAN bActive; - BOOLEAN bActivateRequestSent; - - B_UINT8 u8QueueType;//BE or rtPS - - UINT uiMaxBucketSize;//maximum size of the bucket for the queue - UINT uiCurrentQueueDepthOnTarget; - UINT uiCurrentBytesOnHost; - UINT uiCurrentPacketsOnHost; - UINT uiDroppedCountBytes; - UINT uiDroppedCountPackets; - UINT uiSentBytes; - UINT uiSentPackets; - UINT uiCurrentDrainRate; - UINT uiThisPeriodSentBytes; +} S_CLASSIFIER_RULE; +/* typedef struct _S_CLASSIFIER_RULE S_CLASSIFIER_RULE; */ + +typedef struct _S_FRAGMENTED_PACKET_INFO { + BOOLEAN bUsed; + ULONG ulSrcIpAddress; + USHORT usIpIdentification; + S_CLASSIFIER_RULE *pstMatchedClassifierEntry; + BOOLEAN bOutOfOrderFragment; +} S_FRAGMENTED_PACKET_INFO, *PS_FRAGMENTED_PACKET_INFO; + +struct _packet_info { + /* classification extension Rule */ + ULONG ulSFID; + USHORT usVCID_Value; + UINT uiThreshold; + /* This field determines the priority of the SF Queues */ + B_UINT8 u8TrafficPriority; + + BOOLEAN bValid; + BOOLEAN bActive; + BOOLEAN bActivateRequestSent; + + B_UINT8 u8QueueType; /* BE or rtPS */ + + UINT uiMaxBucketSize; /* maximum size of the bucket for the queue */ + UINT uiCurrentQueueDepthOnTarget; + UINT uiCurrentBytesOnHost; + UINT uiCurrentPacketsOnHost; + UINT uiDroppedCountBytes; + UINT uiDroppedCountPackets; + UINT uiSentBytes; + UINT uiSentPackets; + UINT uiCurrentDrainRate; + UINT uiThisPeriodSentBytes; LARGE_INTEGER liDrainCalculated; - UINT uiCurrentTokenCount; - LARGE_INTEGER liLastUpdateTokenAt; - UINT uiMaxAllowedRate; - UINT NumOfPacketsSent; - UCHAR ucDirection; - USHORT usCID; + UINT uiCurrentTokenCount; + LARGE_INTEGER liLastUpdateTokenAt; + UINT uiMaxAllowedRate; + UINT NumOfPacketsSent; + UCHAR ucDirection; + USHORT usCID; S_MIBS_EXTSERVICEFLOW_PARAMETERS stMibsExtServiceFlowTable; - UINT uiCurrentRxRate; - UINT uiThisPeriodRxBytes; - UINT uiTotalRxBytes; - UINT uiTotalTxBytes; - UINT uiPendedLast; - UCHAR ucIpVersion; - - union - { - struct - { - struct sk_buff* FirstTxQueue; - struct sk_buff* LastTxQueue; + UINT uiCurrentRxRate; + UINT uiThisPeriodRxBytes; + UINT uiTotalRxBytes; + UINT uiTotalTxBytes; + UINT uiPendedLast; + UCHAR ucIpVersion; + + union { + struct { + struct sk_buff *FirstTxQueue; + struct sk_buff *LastTxQueue; }; - struct - { - struct sk_buff* ControlHead; - struct sk_buff* ControlTail; + struct { + struct sk_buff *ControlHead; + struct sk_buff *ControlTail; }; }; + BOOLEAN bProtocolValid; BOOLEAN bTOSValid; BOOLEAN bDestIpValid; @@ -255,226 +228,209 @@ struct _packet_info BOOLEAN bAuthorizedSet; BOOLEAN bClassifierPriority; UCHAR ucServiceClassName[MAX_CLASS_NAME_LENGTH]; - BOOLEAN bHeaderSuppressionEnabled; + BOOLEAN bHeaderSuppressionEnabled; spinlock_t SFQueueLock; - void *pstSFIndication; + void *pstSFIndication; struct timeval stLastUpdateTokenAt; - atomic_t uiPerSFTxResourceCount; + atomic_t uiPerSFTxResourceCount; UINT uiMaxLatency; - UCHAR bIPCSSupport; - UCHAR bEthCSSupport; + UCHAR bIPCSSupport; + UCHAR bEthCSSupport; }; typedef struct _packet_info PacketInfo; - -typedef struct _PER_TARANG_DATA -{ - struct _PER_TARANG_DATA * next; - struct _MINI_ADAPTER * Adapter; - struct sk_buff* RxAppControlHead; - struct sk_buff* RxAppControlTail; - volatile INT AppCtrlQueueLen; - BOOLEAN MacTracingEnabled; - BOOLEAN bApplicationToExit; - S_MIBS_DROPPED_APP_CNTRL_MESSAGES stDroppedAppCntrlMsgs; - ULONG RxCntrlMsgBitMask; +typedef struct _PER_TARANG_DATA { + struct _PER_TARANG_DATA *next; + struct _MINI_ADAPTER *Adapter; + struct sk_buff *RxAppControlHead; + struct sk_buff *RxAppControlTail; + int AppCtrlQueueLen; + BOOLEAN MacTracingEnabled; + BOOLEAN bApplicationToExit; + S_MIBS_DROPPED_APP_CNTRL_MESSAGES stDroppedAppCntrlMsgs; + ULONG RxCntrlMsgBitMask; } PER_TARANG_DATA, *PPER_TARANG_DATA; - #ifdef REL_4_1 -typedef struct _TARGET_PARAMS -{ - B_UINT32 m_u32CfgVersion; - - // Scanning Related Params - B_UINT32 m_u32CenterFrequency; - B_UINT32 m_u32BandAScan; - B_UINT32 m_u32BandBScan; - B_UINT32 m_u32BandCScan; - - // QoS Params - B_UINT32 m_u32minGrantsize; // size of minimum grant is 0 or 6 - B_UINT32 m_u32PHSEnable; - - // HO Params - B_UINT32 m_u32HoEnable; - B_UINT32 m_u32HoReserved1; - B_UINT32 m_u32HoReserved2; - - // Power Control Params - B_UINT32 m_u32MimoEnable; - B_UINT32 m_u32SecurityEnable; +typedef struct _TARGET_PARAMS { + B_UINT32 m_u32CfgVersion; + + /* Scanning Related Params */ + B_UINT32 m_u32CenterFrequency; + B_UINT32 m_u32BandAScan; + B_UINT32 m_u32BandBScan; + B_UINT32 m_u32BandCScan; + + /* QoS Params */ + B_UINT32 m_u32minGrantsize; /* size of minimum grant is 0 or 6 */ + B_UINT32 m_u32PHSEnable; + + /* HO Params */ + B_UINT32 m_u32HoEnable; + B_UINT32 m_u32HoReserved1; + B_UINT32 m_u32HoReserved2; + + /* Power Control Params */ + B_UINT32 m_u32MimoEnable; + B_UINT32 m_u32SecurityEnable; /* - * bit 1: 1 Idlemode enable; - * bit 2: 1 Sleepmode Enable - */ - B_UINT32 m_u32PowerSavingModesEnable; - /* PowerSaving Mode Options: - bit 0 = 1: CPE mode - to keep pcmcia if alive; - bit 1 = 1: CINR reporing in Idlemode Msg - bit 2 = 1: Default PSC Enable in sleepmode*/ - B_UINT32 m_u32PowerSavingModeOptions; - - B_UINT32 m_u32ArqEnable; - - // From Version #3, the HARQ section renamed as general - B_UINT32 m_u32HarqEnable; - // EEPROM Param Location - B_UINT32 m_u32EEPROMFlag; - /* BINARY TYPE - 4th MSByte: - * Interface Type - 3rd MSByte: - * Vendor Type - 2nd MSByte - */ - // Unused - LSByte - B_UINT32 m_u32Customize; - B_UINT32 m_u32ConfigBW; /* In Hz */ - B_UINT32 m_u32ShutDownTimer; - - - B_UINT32 m_u32RadioParameter; - B_UINT32 m_u32PhyParameter1; - B_UINT32 m_u32PhyParameter2; - B_UINT32 m_u32PhyParameter3; + * bit 1: 1 Idlemode enable; + * bit 2: 1 Sleepmode Enable + */ + B_UINT32 m_u32PowerSavingModesEnable; + /* PowerSaving Mode Options: + * bit 0 = 1: CPE mode - to keep pcmcia if alive; + * bit 1 = 1: CINR reporing in Idlemode Msg + * bit 2 = 1: Default PSC Enable in sleepmode + */ + B_UINT32 m_u32PowerSavingModeOptions; + + B_UINT32 m_u32ArqEnable; + + /* From Version #3, the HARQ section renamed as general */ + B_UINT32 m_u32HarqEnable; + /* EEPROM Param Location */ + B_UINT32 m_u32EEPROMFlag; + /* BINARY TYPE - 4th MSByte: + * Interface Type - 3rd MSByte: + * Vendor Type - 2nd MSByte + */ + /* Unused - LSByte */ + B_UINT32 m_u32Customize; + B_UINT32 m_u32ConfigBW; /* In Hz */ + B_UINT32 m_u32ShutDownTimer; + B_UINT32 m_u32RadioParameter; + B_UINT32 m_u32PhyParameter1; + B_UINT32 m_u32PhyParameter2; + B_UINT32 m_u32PhyParameter3; /* in eval mode only; - * lower 16bits = basic cid for testing; - * then bit 16 is test cqich, - * bit 17 test init rang; - * bit 18 test periodic rang - * bit 19 is test harq ack/nack - */ - B_UINT32 m_u32TestOptions; - + * lower 16bits = basic cid for testing; + * then bit 16 is test cqich, + * bit 17 test init rang; + * bit 18 test periodic rang + * bit 19 is test harq ack/nack + */ + B_UINT32 m_u32TestOptions; B_UINT32 m_u32MaxMACDataperDLFrame; B_UINT32 m_u32MaxMACDataperULFrame; - B_UINT32 m_u32Corr2MacFlags; - //adding driver params. - B_UINT32 HostDrvrConfig1; - B_UINT32 HostDrvrConfig2; - B_UINT32 HostDrvrConfig3; - B_UINT32 HostDrvrConfig4; - B_UINT32 HostDrvrConfig5; - B_UINT32 HostDrvrConfig6; - B_UINT32 m_u32SegmentedPUSCenable; - - // BAMC enable - but 4.x does not support this feature - // This is added just to sync 4.x and 5.x CFGs + /* adding driver params. */ + B_UINT32 HostDrvrConfig1; + B_UINT32 HostDrvrConfig2; + B_UINT32 HostDrvrConfig3; + B_UINT32 HostDrvrConfig4; + B_UINT32 HostDrvrConfig5; + B_UINT32 HostDrvrConfig6; + B_UINT32 m_u32SegmentedPUSCenable; + + /* BAMC enable - but 4.x does not support this feature + * This is added just to sync 4.x and 5.x CFGs + */ B_UINT32 m_u32BandAMCEnable; } STARGETPARAMS, *PSTARGETPARAMS; #endif -typedef struct _STTARGETDSXBUFFER -{ - ULONG ulTargetDsxBuffer; - B_UINT16 tid; - BOOLEAN valid; -}STTARGETDSXBUFFER, *PSTTARGETDSXBUFFER; +typedef struct _STTARGETDSXBUFFER { + ULONG ulTargetDsxBuffer; + B_UINT16 tid; + BOOLEAN valid; +} STTARGETDSXBUFFER, *PSTTARGETDSXBUFFER; -typedef INT (*FP_FLASH_WRITE)(struct _MINI_ADAPTER*,UINT,PVOID); +typedef int (*FP_FLASH_WRITE)(struct _MINI_ADAPTER *, UINT, PVOID); -typedef INT (*FP_FLASH_WRITE_STATUS)(struct _MINI_ADAPTER*,UINT,PVOID); +typedef int (*FP_FLASH_WRITE_STATUS)(struct _MINI_ADAPTER *, UINT, PVOID); -/** -Driver adapter data structure -*/ -struct _MINI_ADAPTER -{ - struct _MINI_ADAPTER *next; +/* + * Driver adapter data structure + */ +struct _MINI_ADAPTER { + struct _MINI_ADAPTER *next; struct net_device *dev; u32 msg_enable; - - CHAR *caDsxReqResp; + CHAR *caDsxReqResp; atomic_t ApplicationRunning; - volatile INT CtrlQueueLen; - atomic_t AppCtrlQueueLen; - BOOLEAN AppCtrlQueueOverFlow; + BOOLEAN AppCtrlQueueOverFlow; atomic_t CurrentApplicationCount; - atomic_t RegisteredApplicationCount; - BOOLEAN LinkUpStatus; - BOOLEAN TimerActive; + atomic_t RegisteredApplicationCount; + BOOLEAN LinkUpStatus; + BOOLEAN TimerActive; u32 StatisticsPointer; struct sk_buff *RxControlHead; struct sk_buff *RxControlTail; - struct semaphore RxAppControlQueuelock; struct semaphore fw_download_sema; - - PPER_TARANG_DATA pTarangs; - spinlock_t control_queue_lock; + PPER_TARANG_DATA pTarangs; + spinlock_t control_queue_lock; wait_queue_head_t process_read_wait_queue; - // the pointer to the first packet we have queued in send - // deserialized miniport support variables - atomic_t TotalPacketCount; - atomic_t TxPktAvail; - - // this to keep track of the Tx and Rx MailBox Registers. - atomic_t CurrNumFreeTxDesc; - // to keep track the no of byte received - USHORT PrevNumRecvDescs; - USHORT CurrNumRecvDescs; - UINT u32TotalDSD; - PacketInfo PackInfo[NO_OF_QUEUES]; + /* the pointer to the first packet we have queued in send + * deserialized miniport support variables + */ + atomic_t TotalPacketCount; + atomic_t TxPktAvail; + + /* this to keep track of the Tx and Rx MailBox Registers. */ + atomic_t CurrNumFreeTxDesc; + /* to keep track the no of byte received */ + USHORT PrevNumRecvDescs; + USHORT CurrNumRecvDescs; + UINT u32TotalDSD; + PacketInfo PackInfo[NO_OF_QUEUES]; S_CLASSIFIER_RULE astClassifierTable[MAX_CLASSIFIERS]; - BOOLEAN TransferMode; + BOOLEAN TransferMode; /*************** qos ******************/ - BOOLEAN bETHCSEnabled; - - ULONG BEBucketSize; - ULONG rtPSBucketSize; - UCHAR LinkStatus; - BOOLEAN AutoLinkUp; - BOOLEAN AutoSyncup; - - int major; - int minor; - wait_queue_head_t tx_packet_wait_queue; - wait_queue_head_t process_rx_cntrlpkt; - atomic_t process_waiting; - BOOLEAN fw_download_done; - - char *txctlpacket[MAX_CNTRL_PKTS]; - atomic_t cntrlpktCnt ; - atomic_t index_app_read_cntrlpkt; - atomic_t index_wr_txcntrlpkt; - atomic_t index_rd_txcntrlpkt; - UINT index_datpkt; - struct semaphore rdmwrmsync; + BOOLEAN bETHCSEnabled; + ULONG BEBucketSize; + ULONG rtPSBucketSize; + UCHAR LinkStatus; + BOOLEAN AutoLinkUp; + BOOLEAN AutoSyncup; + + int major; + int minor; + wait_queue_head_t tx_packet_wait_queue; + wait_queue_head_t process_rx_cntrlpkt; + atomic_t process_waiting; + BOOLEAN fw_download_done; + + char *txctlpacket[MAX_CNTRL_PKTS]; + atomic_t cntrlpktCnt ; + atomic_t index_app_read_cntrlpkt; + atomic_t index_wr_txcntrlpkt; + atomic_t index_rd_txcntrlpkt; + UINT index_datpkt; + struct semaphore rdmwrmsync; STTARGETDSXBUFFER astTargetDsxBuffer[MAX_TARGET_DSX_BUFFERS]; ULONG ulFreeTargetBufferCnt; - ULONG ulCurrentTargetBuffer; - ULONG ulTotalTargetBuffersAvailable; - - unsigned long chip_id; - - wait_queue_head_t lowpower_mode_wait_queue; - + ULONG ulCurrentTargetBuffer; + ULONG ulTotalTargetBuffersAvailable; + unsigned long chip_id; + wait_queue_head_t lowpower_mode_wait_queue; BOOLEAN bFlashBoot; BOOLEAN bBinDownloaded; BOOLEAN bCfgDownloaded; BOOLEAN bSyncUpRequestSent; USHORT usBestEffortQueueIndex; - - wait_queue_head_t ioctl_fw_dnld_wait_queue; - BOOLEAN waiting_to_fw_download_done; - pid_t fw_download_process_pid; + wait_queue_head_t ioctl_fw_dnld_wait_queue; + BOOLEAN waiting_to_fw_download_done; + pid_t fw_download_process_pid; PSTARGETPARAMS pstargetparams; - BOOLEAN device_removed; - BOOLEAN DeviceAccess; - BOOLEAN bIsAutoCorrectEnabled; - BOOLEAN bDDRInitDone; - INT DDRSetting; - ULONG ulPowerSaveMode; - spinlock_t txtransmitlock; - B_UINT8 txtransmit_running; + BOOLEAN device_removed; + BOOLEAN DeviceAccess; + BOOLEAN bIsAutoCorrectEnabled; + BOOLEAN bDDRInitDone; + int DDRSetting; + ULONG ulPowerSaveMode; + spinlock_t txtransmitlock; + B_UINT8 txtransmit_running; /* Thread for control packet handling */ - struct task_struct *control_packet_handler; + struct task_struct *control_packet_handler; /* thread for transmitting packets. */ - struct task_struct *transmit_packet_thread; + struct task_struct *transmit_packet_thread; /* LED Related Structures */ LED_INFO_STRUCT LEDInfo; @@ -482,39 +438,38 @@ struct _MINI_ADAPTER /* Driver State for LED Blinking */ LedEventInfo_t DriverState; /* Interface Specific */ - PVOID pvInterfaceAdapter; - int (*bcm_file_download)( PVOID, - struct file *, - unsigned int); - int (*bcm_file_readback_from_chip)( PVOID, - struct file *, - unsigned int); - INT (*interface_rdm)(PVOID, - UINT , - PVOID , - INT); - INT (*interface_wrm)(PVOID, - UINT , - PVOID , - INT); + PVOID pvInterfaceAdapter; + int (*bcm_file_download)(PVOID, + struct file *, + unsigned int); + int (*bcm_file_readback_from_chip)(PVOID, + struct file *, + unsigned int); + int (*interface_rdm)(PVOID, + UINT, + PVOID, + int); + int (*interface_wrm)(PVOID, + UINT, + PVOID, + int); int (*interface_transmit)(PVOID, PVOID , UINT); BOOLEAN IdleMode; BOOLEAN bDregRequestSentInIdleMode; BOOLEAN bTriedToWakeUpFromlowPowerMode; BOOLEAN bShutStatus; BOOLEAN bWakeUpDevice; - unsigned int usIdleModePattern; - //BOOLEAN bTriedToWakeUpFromShutdown; + unsigned int usIdleModePattern; + /* BOOLEAN bTriedToWakeUpFromShutdown; */ BOOLEAN bLinkDownRequested; - - int downloadDDR; - PHS_DEVICE_EXTENSION stBCMPhsContext; - S_HDR_SUPRESSION_CONTEXTINFO stPhsTxContextInfo; + int downloadDDR; + PHS_DEVICE_EXTENSION stBCMPhsContext; + S_HDR_SUPRESSION_CONTEXTINFO stPhsTxContextInfo; uint8_t ucaPHSPktRestoreBuf[2048]; uint8_t bPHSEnabled; BOOLEAN AutoFirmDld; - BOOLEAN bMipsConfig; - BOOLEAN bDPLLConfig; + BOOLEAN bMipsConfig; + BOOLEAN bDPLLConfig; UINT32 aTxPktSizeHist[MIBS_MAX_HIST_ENTRIES]; UINT32 aRxPktSizeHist[MIBS_MAX_HIST_ENTRIES]; S_FRAGMENTED_PACKET_INFO astFragmentedPktClassifierTable[MAX_FRAGMENTEDIP_CLASSIFICATION_ENTRIES]; @@ -527,108 +482,101 @@ struct _MINI_ADAPTER BOOLEAN bStatusWrite; UINT uiNVMDSDSize; UINT uiVendorExtnFlag; - //it will always represent chosen DSD at any point of time. - // Generally it is Active DSD but in case of NVM RD/WR it might be different. + /* it will always represent chosen DSD at any point of time. + * Generally it is Active DSD but in case of NVM RD/WR it might be different. + */ UINT ulFlashCalStart; - ULONG ulFlashControlSectionStart; - ULONG ulFlashWriteSize; - ULONG ulFlashID; - FP_FLASH_WRITE fpFlashWrite; - FP_FLASH_WRITE_STATUS fpFlashWriteWithStatusCheck; - + ULONG ulFlashControlSectionStart; + ULONG ulFlashWriteSize; + ULONG ulFlashID; + FP_FLASH_WRITE fpFlashWrite; + FP_FLASH_WRITE_STATUS fpFlashWriteWithStatusCheck; struct semaphore NVMRdmWrmLock; + struct device *pstCreatedClassDevice; - struct device *pstCreatedClassDevice; - -// BOOLEAN InterfaceUpStatus; - PFLASH2X_CS_INFO psFlash2xCSInfo; - PFLASH_CS_INFO psFlashCSInfo ; + /* BOOLEAN InterfaceUpStatus; */ + PFLASH2X_CS_INFO psFlash2xCSInfo; + PFLASH_CS_INFO psFlashCSInfo; PFLASH2X_VENDORSPECIFIC_INFO psFlash2xVendorInfo; - UINT uiFlashBaseAdd; //Flash start address - UINT uiActiveISOOffset; //Active ISO offset chosen before f/w download - FLASH2X_SECTION_VAL eActiveISO; //Active ISO section val - FLASH2X_SECTION_VAL eActiveDSD; //Active DSD val chosen before f/w download - UINT uiActiveDSDOffsetAtFwDld; //For accessing Active DSD chosen before f/w download - UINT uiFlashLayoutMajorVersion ; - UINT uiFlashLayoutMinorVersion; - BOOLEAN bAllDSDWriteAllow ; - BOOLEAN bSigCorrupted ; - //this should be set who so ever want to change the Headers. after Wrtie it should be reset immediately. - BOOLEAN bHeaderChangeAllowed ; - INT SelectedChip ; - BOOLEAN bEndPointHalted; - //while bFlashRawRead will be true, Driver ignore map lay out and consider flash as of without any map. - BOOLEAN bFlashRawRead; - BOOLEAN bPreparingForLowPowerMode ; - BOOLEAN bDoSuspend ; - UINT syscfgBefFwDld ; - BOOLEAN StopAllXaction ; - UINT32 liTimeSinceLastNetEntry; //Used to Support extended CAPI requirements from + UINT uiFlashBaseAdd; /* Flash start address */ + UINT uiActiveISOOffset; /* Active ISO offset chosen before f/w download */ + FLASH2X_SECTION_VAL eActiveISO; /* Active ISO section val */ + FLASH2X_SECTION_VAL eActiveDSD; /* Active DSD val chosen before f/w download */ + UINT uiActiveDSDOffsetAtFwDld; /* For accessing Active DSD chosen before f/w download */ + UINT uiFlashLayoutMajorVersion; + UINT uiFlashLayoutMinorVersion; + BOOLEAN bAllDSDWriteAllow; + BOOLEAN bSigCorrupted; + /* this should be set who so ever want to change the Headers. after Wrtie it should be reset immediately. */ + BOOLEAN bHeaderChangeAllowed; + int SelectedChip; + BOOLEAN bEndPointHalted; + /* while bFlashRawRead will be true, Driver ignore map lay out and consider flash as of without any map. */ + BOOLEAN bFlashRawRead; + BOOLEAN bPreparingForLowPowerMode; + BOOLEAN bDoSuspend; + UINT syscfgBefFwDld; + BOOLEAN StopAllXaction; + UINT32 liTimeSinceLastNetEntry; /* Used to Support extended CAPI requirements from */ struct semaphore LowPowerModeSync; - ULONG liDrainCalculated; - UINT gpioBitMap; - - S_BCM_DEBUG_STATE stDebugState; - + ULONG liDrainCalculated; + UINT gpioBitMap; + S_BCM_DEBUG_STATE stDebugState; }; typedef struct _MINI_ADAPTER MINI_ADAPTER, *PMINI_ADAPTER; -#define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev) +#define GET_BCM_ADAPTER(net_dev) netdev_priv(net_dev) struct _ETH_HEADER_STRUC { - UCHAR au8DestinationAddress[6]; - UCHAR au8SourceAddress[6]; - USHORT u16Etype; -}__attribute__((packed)); + UCHAR au8DestinationAddress[6]; + UCHAR au8SourceAddress[6]; + USHORT u16Etype; +} __packed; typedef struct _ETH_HEADER_STRUC ETH_HEADER_STRUC, *PETH_HEADER_STRUC; +typedef struct FirmwareInfo { + void __user *pvMappedFirmwareAddress; + ULONG u32FirmwareLength; + ULONG u32StartingAddress; +} __packed FIRMWARE_INFO, *PFIRMWARE_INFO; -typedef struct FirmwareInfo -{ - void __user * pvMappedFirmwareAddress; - ULONG u32FirmwareLength; - ULONG u32StartingAddress; -}__attribute__((packed)) FIRMWARE_INFO, *PFIRMWARE_INFO; - -// holds the value of net_device structure.. +/* holds the value of net_device structure.. */ extern struct net_device *gblpnetdev; -typedef struct _cntl_pkt{ - PMINI_ADAPTER Adapter; - PLEADER PLeader; -}cntl_pkt; +typedef struct _cntl_pkt { + PMINI_ADAPTER Adapter; + PLEADER PLeader; +} cntl_pkt; typedef LINK_REQUEST CONTROL_MESSAGE; -typedef struct _DDR_SETTING -{ +typedef struct _DDR_SETTING { UINT ulRegAddress; UINT ulRegValue; -}DDR_SETTING, *PDDR_SETTING; +} DDR_SETTING, *PDDR_SETTING; typedef DDR_SETTING DDR_SET_NODE, *PDDR_SET_NODE; -INT -InitAdapter(PMINI_ADAPTER psAdapter); - -// ===================================================================== -// Beceem vendor request codes for EP0 -// ===================================================================== +int InitAdapter(PMINI_ADAPTER psAdapter); -#define BCM_REQUEST_READ 0x2 -#define BCM_REQUEST_WRITE 0x1 -#define EP2_MPS_REG 0x0F0110A0 -#define EP2_MPS 0x40 +/* ===================================================================== + * Beceem vendor request codes for EP0 + * ===================================================================== + */ -#define EP2_CFG_REG 0x0F0110A8 -#define EP2_CFG_INT 0x27 -#define EP2_CFG_BULK 0x25 +#define BCM_REQUEST_READ 0x2 +#define BCM_REQUEST_WRITE 0x1 +#define EP2_MPS_REG 0x0F0110A0 +#define EP2_MPS 0x40 -#define EP4_MPS_REG 0x0F0110F0 -#define EP4_MPS 0x8C +#define EP2_CFG_REG 0x0F0110A8 +#define EP2_CFG_INT 0x27 +#define EP2_CFG_BULK 0x25 -#define EP4_CFG_REG 0x0F0110F8 +#define EP4_MPS_REG 0x0F0110F0 +#define EP4_MPS 0x8C -#define ISO_MPS_REG 0x0F0110C8 -#define ISO_MPS 0x00000000 +#define EP4_CFG_REG 0x0F0110F8 +#define ISO_MPS_REG 0x0F0110C8 +#define ISO_MPS 0x00000000 #define EP1 0 #define EP2 1 @@ -637,12 +585,9 @@ InitAdapter(PMINI_ADAPTER psAdapter); #define EP5 4 #define EP6 5 - -typedef enum eInterface_setting -{ +typedef enum eInterface_setting { DEFAULT_SETTING_0 = 0, ALTERNATE_SETTING_1 = 1, -}INTERFACE_SETTING; - -#endif //__ADAPTER_H__ +} INTERFACE_SETTING; +#endif /* __ADAPTER_H__ */ diff --git a/drivers/staging/bcm/DDRInit.c b/drivers/staging/bcm/DDRInit.c index 1c7db81..2b46f4d 100644 --- a/drivers/staging/bcm/DDRInit.c +++ b/drivers/staging/bcm/DDRInit.c @@ -1115,20 +1115,20 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) { case DDR_80_MHZ: psDDRSetting = asT3LP_DDRSetting80MHz; - RegCount = (sizeof(asT3LP_DDRSetting80MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3LP_DDRSetting80MHz); RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ; psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; break; case DDR_100_MHZ: psDDRSetting = asT3LP_DDRSetting100MHz; - RegCount = (sizeof(asT3LP_DDRSetting100MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3LP_DDRSetting100MHz); RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ; psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; break; case DDR_133_MHZ: bOverrideSelfRefresh = TRUE; psDDRSetting = asT3LP_DDRSetting133MHz; - RegCount = (sizeof(asT3LP_DDRSetting133MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3LP_DDRSetting133MHz); RegCount -= T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; psDDRSetting += T3LP_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; break; @@ -1146,20 +1146,20 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) { case DDR_80_MHZ: psDDRSetting = asT3LPB_DDRSetting80MHz; - RegCount=(sizeof(asT3LPB_DDRSetting80MHz)/sizeof(DDR_SET_NODE)); + RegCount=ARRAY_SIZE(asT3LPB_DDRSetting80MHz); RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ; psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; break; case DDR_100_MHZ: psDDRSetting = asT3LPB_DDRSetting100MHz; - RegCount = (sizeof(asT3LPB_DDRSetting100MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3LPB_DDRSetting100MHz); RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ; psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; break; case DDR_133_MHZ: bOverrideSelfRefresh = TRUE; psDDRSetting = asT3LPB_DDRSetting133MHz; - RegCount = (sizeof(asT3LPB_DDRSetting133MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3LPB_DDRSetting133MHz); RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; break; @@ -1167,7 +1167,7 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) case DDR_160_MHZ: bOverrideSelfRefresh = TRUE; psDDRSetting = asT3LPB_DDRSetting160MHz; - RegCount = sizeof(asT3LPB_DDRSetting160MHz)/sizeof(DDR_SET_NODE); + RegCount = ARRAY_SIZE(asT3LPB_DDRSetting160MHz); RegCount -= T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ; psDDRSetting += T3LPB_SKIP_CLOCK_PROGRAM_DUMP_160MHZ; @@ -1181,19 +1181,19 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) { case DDR_80_MHZ: psDDRSetting = asT3_DDRSetting80MHz; - RegCount = (sizeof(asT3_DDRSetting80MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3_DDRSetting80MHz); RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ; psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; break; case DDR_100_MHZ: psDDRSetting = asT3_DDRSetting100MHz; - RegCount = (sizeof(asT3_DDRSetting100MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3_DDRSetting100MHz); RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ; psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; break; case DDR_133_MHZ: psDDRSetting = asT3_DDRSetting133MHz; - RegCount = (sizeof(asT3_DDRSetting133MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3_DDRSetting133MHz); RegCount-=T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; psDDRSetting += T3_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; break; @@ -1207,20 +1207,20 @@ int download_ddr_settings(PMINI_ADAPTER Adapter) { case DDR_80_MHZ: psDDRSetting = asT3B_DDRSetting80MHz; - RegCount = (sizeof(asT3B_DDRSetting80MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3B_DDRSetting80MHz); RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ ; psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_80MHZ; break; case DDR_100_MHZ: psDDRSetting = asT3B_DDRSetting100MHz; - RegCount = (sizeof(asT3B_DDRSetting100MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3B_DDRSetting100MHz); RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ ; psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_100MHZ; break; case DDR_133_MHZ: bOverrideSelfRefresh = TRUE; psDDRSetting = asT3B_DDRSetting133MHz; - RegCount = (sizeof(asT3B_DDRSetting133MHz)/sizeof(DDR_SET_NODE)); + RegCount = ARRAY_SIZE(asT3B_DDRSetting133MHz); RegCount -= T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ ; psDDRSetting += T3B_SKIP_CLOCK_PROGRAM_DUMP_133MHZ; break; diff --git a/drivers/staging/bcm/IPv6Protocol.c b/drivers/staging/bcm/IPv6Protocol.c index 5b4fd37..1da2164 100644 --- a/drivers/staging/bcm/IPv6Protocol.c +++ b/drivers/staging/bcm/IPv6Protocol.c @@ -1,51 +1,52 @@ #include "headers.h" -static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Header *pstIpv6Header); -static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Header *pstIpv6Header); +static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, + IPV6Header *pstIpv6Header); +static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, + IPV6Header *pstIpv6Header); static VOID DumpIpv6Header(IPV6Header *pstIpv6Header); -static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader,BOOLEAN *bParseDone,USHORT *pusPayloadLength) +static UCHAR *GetNextIPV6ChainedHeader(UCHAR **ppucPayload, + UCHAR *pucNextHeader, BOOLEAN *bParseDone, USHORT *pusPayloadLength) { UCHAR *pucRetHeaderPtr = NULL; UCHAR *pucPayloadPtr = NULL; USHORT usNextHeaderOffset = 0 ; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if((NULL == ppucPayload) || (*pusPayloadLength == 0) || (*bParseDone)) - { + if ((ppucPayload == NULL) || (*pusPayloadLength == 0) || + (*bParseDone)) { *bParseDone = TRUE; return NULL; - } pucRetHeaderPtr = *ppucPayload; pucPayloadPtr = *ppucPayload; - if(!pucRetHeaderPtr || !pucPayloadPtr) - { + if (!pucRetHeaderPtr || !pucPayloadPtr) { *bParseDone = TRUE; return NULL; } - //Get the Nextt Header Type + /* Get the Nextt Header Type */ *bParseDone = FALSE; - - switch(*pucNextHeader) - { + switch (*pucNextHeader) { case IPV6HDR_TYPE_HOPBYHOP: { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 HopByHop Header"); - usNextHeaderOffset+=sizeof(IPV6HopByHopOptionsHeader); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nIPv6 HopByHop Header"); + usNextHeaderOffset += sizeof(IPV6HopByHopOptionsHeader); } break; case IPV6HDR_TYPE_ROUTING: { IPV6RoutingHeader *pstIpv6RoutingHeader; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Routing Header"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nIPv6 Routing Header"); pstIpv6RoutingHeader = (IPV6RoutingHeader *)pucPayloadPtr; usNextHeaderOffset += sizeof(IPV6RoutingHeader); usNextHeaderOffset += pstIpv6RoutingHeader->ucNumAddresses * IPV6_ADDRESS_SIZEINBYTES; @@ -54,8 +55,10 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader break; case IPV6HDR_TYPE_FRAGMENTATION: { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Fragmentation Header"); - usNextHeaderOffset+= sizeof(IPV6FragmentHeader); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, + "\nIPv6 Fragmentation Header"); + usNextHeaderOffset += sizeof(IPV6FragmentHeader); } break; @@ -63,9 +66,11 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader { IPV6DestOptionsHeader *pstIpv6DestOptsHdr = (IPV6DestOptionsHeader *)pucPayloadPtr; int nTotalOptions = pstIpv6DestOptsHdr->ucHdrExtLen; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 DestOpts Header Header"); - usNextHeaderOffset+= sizeof(IPV6DestOptionsHeader); - usNextHeaderOffset+= nTotalOptions * IPV6_DESTOPTS_HDR_OPTIONSIZE ; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, + "\nIPv6 DestOpts Header Header"); + usNextHeaderOffset += sizeof(IPV6DestOptionsHeader); + usNextHeaderOffset += nTotalOptions * IPV6_DESTOPTS_HDR_OPTIONSIZE ; } break; @@ -73,36 +78,43 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader { IPV6AuthenticationHeader *pstIpv6AuthHdr = (IPV6AuthenticationHeader *)pucPayloadPtr; int nHdrLen = pstIpv6AuthHdr->ucLength; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Authentication Header"); - usNextHeaderOffset+= nHdrLen * 4; + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, + "\nIPv6 Authentication Header"); + usNextHeaderOffset += nHdrLen * 4; } break; case IPV6HDR_TYPE_ENCRYPTEDSECURITYPAYLOAD: { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Encrypted Security Payload Header"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, + "\nIPv6 Encrypted Security Payload Header"); *bParseDone = TRUE; } break; case IPV6_ICMP_HDR_TYPE: { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, " ICMP Header"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nICMP Header"); *bParseDone = TRUE; } break; case TCP_HEADER_TYPE: { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, " \nTCP Header"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nTCP Header"); *bParseDone = TRUE; } break; case UDP_HEADER_TYPE: { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, " \nUDP Header"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nUDP Header"); *bParseDone = TRUE; } break; - default : + default: { *bParseDone = TRUE; @@ -112,53 +124,49 @@ static UCHAR * GetNextIPV6ChainedHeader(UCHAR **ppucPayload,UCHAR *pucNextHeader } - if(*bParseDone == FALSE) - { - if(*pusPayloadLength <= usNextHeaderOffset) - { + if (*bParseDone == FALSE) { + if (*pusPayloadLength <= usNextHeaderOffset) { *bParseDone = TRUE; - } - else - { + } else { *pucNextHeader = *pucPayloadPtr; - pucPayloadPtr+=usNextHeaderOffset; - (*pusPayloadLength)-=usNextHeaderOffset; + pucPayloadPtr += usNextHeaderOffset; + (*pusPayloadLength) -= usNextHeaderOffset; } } - - *ppucPayload = pucPayloadPtr; return pucRetHeaderPtr; } -static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload,USHORT *pusSrcPort,USHORT *pusDestPort,USHORT usPayloadLength,UCHAR ucNextHeader) +static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload, USHORT *pusSrcPort, + USHORT *pusDestPort, USHORT usPayloadLength, UCHAR ucNextHeader) { UCHAR *pIpv6HdrScanContext = pucPayload; BOOLEAN bDone = FALSE; - UCHAR ucHeaderType =0; + UCHAR ucHeaderType = 0; UCHAR *pucNextHeader = NULL; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - if( !pucPayload || (usPayloadLength == 0)) - { + if (!pucPayload || (usPayloadLength == 0)) return 0; - } *pusSrcPort = *pusDestPort = 0; ucHeaderType = ucNextHeader; - while(!bDone) - { - pucNextHeader = GetNextIPV6ChainedHeader(&pIpv6HdrScanContext,&ucHeaderType,&bDone,&usPayloadLength); - if(bDone) - { - if((ucHeaderType==TCP_HEADER_TYPE) || (ucHeaderType == UDP_HEADER_TYPE)) - { - *pusSrcPort=*((PUSHORT)(pucNextHeader)); - *pusDestPort=*((PUSHORT)(pucNextHeader+2)); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, " \nProtocol Ports - Src Port :0x%x Dest Port : 0x%x",ntohs(*pusSrcPort),ntohs(*pusDestPort)); + while (!bDone) { + pucNextHeader = GetNextIPV6ChainedHeader(&pIpv6HdrScanContext, + &ucHeaderType, &bDone, &usPayloadLength); + if (bDone) { + if ((ucHeaderType == TCP_HEADER_TYPE) || + (ucHeaderType == UDP_HEADER_TYPE)) { + *pusSrcPort = *((PUSHORT)(pucNextHeader)); + *pusDestPort = *((PUSHORT)(pucNextHeader+2)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, + "\nProtocol Ports - Src Port :0x%x Dest Port : 0x%x", + ntohs(*pusSrcPort), + ntohs(*pusDestPort)); } break; @@ -168,92 +176,111 @@ static UCHAR GetIpv6ProtocolPorts(UCHAR *pucPayload,USHORT *pusSrcPort,USHORT *p } - -USHORT IpVersion6(PMINI_ADAPTER Adapter, /**< Pointer to the driver control structure */ - PVOID pcIpHeader, /**<Pointer to the IP Hdr of the packet*/ - S_CLASSIFIER_RULE *pstClassifierRule ) +/* + * Arg 1 PMINI_ADAPTER Adapter is a pointer ot the driver contorl structure + * Arg 2 PVOID pcIpHeader is a pointer to the IP header of the packet + */ +USHORT IpVersion6(PMINI_ADAPTER Adapter, PVOID pcIpHeader, + S_CLASSIFIER_RULE *pstClassifierRule) { USHORT ushDestPort = 0; USHORT ushSrcPort = 0; - UCHAR ucNextProtocolAboveIP =0; + UCHAR ucNextProtocolAboveIP = 0; IPV6Header *pstIpv6Header = NULL; BOOLEAN bClassificationSucceed = FALSE; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "IpVersion6 ==========>\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "IpVersion6 ==========>\n"); pstIpv6Header = (IPV6Header *)pcIpHeader; DumpIpv6Header(pstIpv6Header); - //Try to get the next higher layer protocol and the Ports Nos if TCP or UDP + /* + * Try to get the next higher layer protocol + * and the Ports Nos if TCP or UDP + */ ucNextProtocolAboveIP = GetIpv6ProtocolPorts((UCHAR *)(pcIpHeader + sizeof(IPV6Header)), &ushSrcPort, &ushDestPort, pstIpv6Header->usPayloadLength, pstIpv6Header->ucNextHeader); - do - { - if(0 == pstClassifierRule->ucDirection) - { - //cannot be processed for classification. - // it is a down link connection + do { + if (pstClassifierRule->ucDirection == 0) { + /* + * cannot be processed for classification. + * it is a down link connection + */ break; } - if(!pstClassifierRule->bIpv6Protocol) - { - //We are looking for Ipv6 Classifiers . Lets ignore this classifier and try the next one. + if (!pstClassifierRule->bIpv6Protocol) { + /* + * We are looking for Ipv6 Classifiers + * Lets ignore this classifier and try the next one + */ break; } - bClassificationSucceed=MatchSrcIpv6Address(pstClassifierRule,pstIpv6Header); - if(!bClassificationSucceed) - break; + bClassificationSucceed = MatchSrcIpv6Address(pstClassifierRule, + pstIpv6Header); + if (!bClassificationSucceed) + break; - bClassificationSucceed=MatchDestIpv6Address(pstClassifierRule,pstIpv6Header); - if(!bClassificationSucceed) - break; + bClassificationSucceed = MatchDestIpv6Address(pstClassifierRule, + pstIpv6Header); + if (!bClassificationSucceed) + break; - //Match the protocol type.For IPv6 the next protocol at end of Chain of IPv6 prot headers - bClassificationSucceed=MatchProtocol(pstClassifierRule,ucNextProtocolAboveIP); - if(!bClassificationSucceed) - break; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Protocol Matched"); + /* + * Match the protocol type. + * For IPv6 the next protocol at end of + * Chain of IPv6 prot headers + */ + bClassificationSucceed = MatchProtocol(pstClassifierRule, + ucNextProtocolAboveIP); + if (!bClassificationSucceed) + break; - if((ucNextProtocolAboveIP == TCP_HEADER_TYPE) || (ucNextProtocolAboveIP == UDP_HEADER_TYPE)) - { - //Match Src Port - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Source Port:%x\n",ntohs(ushSrcPort)); - bClassificationSucceed=MatchSrcPort(pstClassifierRule,ntohs(ushSrcPort)); - if(!bClassificationSucceed) + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nIPv6 Protocol Matched"); + + if ((ucNextProtocolAboveIP == TCP_HEADER_TYPE) || + (ucNextProtocolAboveIP == UDP_HEADER_TYPE)) { + /* Match Src Port */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nIPv6 Source Port:%x\n", + ntohs(ushSrcPort)); + bClassificationSucceed = MatchSrcPort(pstClassifierRule, + ntohs(ushSrcPort)); + if (!bClassificationSucceed) break; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Src Port Matched"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nIPv6 Src Port Matched"); - //Match Dest Port - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Destination Port:%x\n",ntohs(ushDestPort)); - bClassificationSucceed=MatchDestPort(pstClassifierRule,ntohs(ushDestPort)); - if(!bClassificationSucceed) + /* Match Dest Port */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nIPv6 Destination Port:%x\n", + ntohs(ushDestPort)); + bClassificationSucceed = MatchDestPort(pstClassifierRule, + ntohs(ushDestPort)); + if (!bClassificationSucceed) break; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\nIPv6 Dest Port Matched"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, "\nIPv6 Dest Port Matched"); } - }while(0); + } while (0); - if(TRUE==bClassificationSucceed) - { + if (bClassificationSucceed == TRUE) { INT iMatchedSFQueueIndex = 0; - iMatchedSFQueueIndex = SearchSfid(Adapter,pstClassifierRule->ulSFID); - if(iMatchedSFQueueIndex >= NO_OF_QUEUES) - { + iMatchedSFQueueIndex = SearchSfid(Adapter, pstClassifierRule->ulSFID); + if (iMatchedSFQueueIndex >= NO_OF_QUEUES) { bClassificationSucceed = FALSE; - } - else - { - if(FALSE == Adapter->PackInfo[iMatchedSFQueueIndex].bActive) - { + } else { + if (Adapter->PackInfo[iMatchedSFQueueIndex].bActive == FALSE) bClassificationSucceed = FALSE; - } } } @@ -261,52 +288,55 @@ USHORT IpVersion6(PMINI_ADAPTER Adapter, /**< Pointer to the driver control stru } -static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Header *pstIpv6Header) +static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, + IPV6Header *pstIpv6Header) { - UINT uiLoopIndex=0; - UINT uiIpv6AddIndex=0; - UINT uiIpv6AddrNoLongWords = 4; + UINT uiLoopIndex = 0; + UINT uiIpv6AddIndex = 0; + UINT uiIpv6AddrNoLongWords = 4; ULONG aulSrcIP[4]; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); /* - //This is the no. of Src Addresses ie Range of IP Addresses contained - //in the classifier rule for which we need to match - */ + * This is the no. of Src Addresses ie Range of IP Addresses contained + * in the classifier rule for which we need to match + */ UINT uiCountIPSrcAddresses = (UINT)pstClassifierRule->ucIPSourceAddressLength; - if(0 == uiCountIPSrcAddresses) + if (uiCountIPSrcAddresses == 0) return TRUE; - //First Convert the Ip Address in the packet to Host Endian order - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) - { - aulSrcIP[uiIpv6AddIndex]=ntohl(pstIpv6Header->ulSrcIpAddress[uiIpv6AddIndex]); - } + /* First Convert the Ip Address in the packet to Host Endian order */ + for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) + aulSrcIP[uiIpv6AddIndex] = ntohl(pstIpv6Header->ulSrcIpAddress[uiIpv6AddIndex]); - for(uiLoopIndex=0;uiLoopIndex<uiCountIPSrcAddresses;uiLoopIndex+=uiIpv6AddrNoLongWords) - { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Src Ipv6 Address In Received Packet : \n "); + for (uiLoopIndex = 0; uiLoopIndex < uiCountIPSrcAddresses; uiLoopIndex += uiIpv6AddrNoLongWords) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "\n Src Ipv6 Address In Received Packet :\n "); DumpIpv6Address(aulSrcIP); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Src Ipv6 Mask In Classifier Rule: \n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "\n Src Ipv6 Mask In Classifier Rule:\n"); DumpIpv6Address(&pstClassifierRule->stSrcIpAddress.ulIpv6Mask[uiLoopIndex]); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Src Ipv6 Address In Classifier Rule : \n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "\n Src Ipv6 Address In Classifier Rule :\n"); DumpIpv6Address(&pstClassifierRule->stSrcIpAddress.ulIpv6Addr[uiLoopIndex]); - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) - { - if((pstClassifierRule->stSrcIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulSrcIP[uiIpv6AddIndex]) - != pstClassifierRule->stSrcIpAddress.ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) - { - //Match failed for current Ipv6 Address.Try next Ipv6 Address + for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) { + if ((pstClassifierRule->stSrcIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulSrcIP[uiIpv6AddIndex]) + != pstClassifierRule->stSrcIpAddress.ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) { + /* + * Match failed for current Ipv6 Address + * Try next Ipv6 Address + */ break; } - if(uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) - { - //Match Found - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Ipv6 Src Ip Address Matched\n"); + if (uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) { + /* Match Found */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, + "Ipv6 Src Ip Address Matched\n"); return TRUE; } } @@ -314,52 +344,56 @@ static BOOLEAN MatchSrcIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Head return FALSE; } -static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Header *pstIpv6Header) +static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule, + IPV6Header *pstIpv6Header) { - UINT uiLoopIndex=0; - UINT uiIpv6AddIndex=0; - UINT uiIpv6AddrNoLongWords = 4; + UINT uiLoopIndex = 0; + UINT uiIpv6AddIndex = 0; + UINT uiIpv6AddrNoLongWords = 4; ULONG aulDestIP[4]; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); /* - //This is the no. of Destination Addresses ie Range of IP Addresses contained - //in the classifier rule for which we need to match - */ + * This is the no. of Destination Addresses + * ie Range of IP Addresses contained in the classifier rule + * for which we need to match + */ UINT uiCountIPDestinationAddresses = (UINT)pstClassifierRule->ucIPDestinationAddressLength; - if(0 == uiCountIPDestinationAddresses) + if (uiCountIPDestinationAddresses == 0) return TRUE; - //First Convert the Ip Address in the packet to Host Endian order - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) - { - aulDestIP[uiIpv6AddIndex]=ntohl(pstIpv6Header->ulDestIpAddress[uiIpv6AddIndex]); - } + /* First Convert the Ip Address in the packet to Host Endian order */ + for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) + aulDestIP[uiIpv6AddIndex] = ntohl(pstIpv6Header->ulDestIpAddress[uiIpv6AddIndex]); - for(uiLoopIndex=0;uiLoopIndex<uiCountIPDestinationAddresses;uiLoopIndex+=uiIpv6AddrNoLongWords) - { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Destination Ipv6 Address In Received Packet : \n "); + for (uiLoopIndex = 0; uiLoopIndex < uiCountIPDestinationAddresses; uiLoopIndex += uiIpv6AddrNoLongWords) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "\n Destination Ipv6 Address In Received Packet :\n "); DumpIpv6Address(aulDestIP); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Destination Ipv6 Mask In Classifier Rule: \n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "\n Destination Ipv6 Mask In Classifier Rule :\n"); DumpIpv6Address(&pstClassifierRule->stDestIpAddress.ulIpv6Mask[uiLoopIndex]); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "\n Destination Ipv6 Address In Classifier Rule : \n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "\n Destination Ipv6 Address In Classifier Rule :\n"); DumpIpv6Address(&pstClassifierRule->stDestIpAddress.ulIpv6Addr[uiLoopIndex]); - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) - { - if((pstClassifierRule->stDestIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulDestIP[uiIpv6AddIndex]) - != pstClassifierRule->stDestIpAddress.ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) - { - //Match failed for current Ipv6 Address.Try next Ipv6 Address + for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) { + if ((pstClassifierRule->stDestIpAddress.ulIpv6Mask[uiLoopIndex+uiIpv6AddIndex] & aulDestIP[uiIpv6AddIndex]) + != pstClassifierRule->stDestIpAddress.ulIpv6Addr[uiLoopIndex+uiIpv6AddIndex]) { + /* + * Match failed for current Ipv6 Address. + * Try next Ipv6 Address + */ break; } - if(uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) - { - //Match Found - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Ipv6 Destination Ip Address Matched\n"); + if (uiIpv6AddIndex == uiIpv6AddrNoLongWords-1) { + /* Match Found */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, + DBG_LVL_ALL, + "Ipv6 Destination Ip Address Matched\n"); return TRUE; } } @@ -371,11 +405,11 @@ static BOOLEAN MatchDestIpv6Address(S_CLASSIFIER_RULE *pstClassifierRule,IPV6Hea VOID DumpIpv6Address(ULONG *puIpv6Address) { UINT uiIpv6AddrNoLongWords = 4; - UINT uiIpv6AddIndex=0; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - for(uiIpv6AddIndex=0;uiIpv6AddIndex<uiIpv6AddrNoLongWords;uiIpv6AddIndex++) - { - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, ":%lx",puIpv6Address[uiIpv6AddIndex]); + UINT uiIpv6AddIndex = 0; + PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + for (uiIpv6AddIndex = 0; uiIpv6AddIndex < uiIpv6AddrNoLongWords; uiIpv6AddIndex++) { + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + ":%lx", puIpv6Address[uiIpv6AddIndex]); } } @@ -383,22 +417,35 @@ VOID DumpIpv6Address(ULONG *puIpv6Address) static VOID DumpIpv6Header(IPV6Header *pstIpv6Header) { UCHAR ucVersion; - UCHAR ucPrio ; - PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "----Ipv6 Header---"); + UCHAR ucPrio; + PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "----Ipv6 Header---"); ucVersion = pstIpv6Header->ucVersionPrio & 0xf0; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Version : %x \n",ucVersion); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "Version : %x\n", ucVersion); ucPrio = pstIpv6Header->ucVersionPrio & 0x0f; - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Priority : %x \n",ucPrio); - //BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Flow Label : %x \n",(pstIpv6Header->ucVersionPrio &0xf0); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Payload Length : %x \n",ntohs(pstIpv6Header->usPayloadLength)); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Next Header : %x \n",pstIpv6Header->ucNextHeader); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Hop Limit : %x \n",pstIpv6Header->ucHopLimit); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Src Address :\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "Priority : %x\n", ucPrio); + /* + * BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + * "Flow Label : %x\n",(pstIpv6Header->ucVersionPrio &0xf0); + */ + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "Payload Length : %x\n", + ntohs(pstIpv6Header->usPayloadLength)); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "Next Header : %x\n", pstIpv6Header->ucNextHeader); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "Hop Limit : %x\n", pstIpv6Header->ucHopLimit); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "Src Address :\n"); DumpIpv6Address(pstIpv6Header->ulSrcIpAddress); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "Dest Address :\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "Dest Address :\n"); DumpIpv6Address(pstIpv6Header->ulDestIpAddress); - BCM_DEBUG_PRINT( Adapter,DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, "----Ipv6 Header End---"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_TX, IPV6_DBG, DBG_LVL_ALL, + "----Ipv6 Header End---"); } diff --git a/drivers/staging/bcm/Misc.c b/drivers/staging/bcm/Misc.c index c7725e1..8223a69 100644 --- a/drivers/staging/bcm/Misc.c +++ b/drivers/staging/bcm/Misc.c @@ -835,7 +835,7 @@ int reset_card_proc(PMINI_ADAPTER ps_adapter) Bcm_kill_all_URBs(psIntfAdapter); /* Reset the UMA-B Device */ if (ps_adapter->chip_id >= T3LPB) { - BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Reseting UMA-B\n"); + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_PRINTK, 0, 0, "Resetting UMA-B\n"); retval = usb_reset_device(psIntfAdapter->udev); psIntfAdapter->psAdapter->StopAllXaction = FALSE; |