Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 1 | |
| 2 | /* |
| 3 | * File Name: hostmibs.c |
| 4 | * |
| 5 | * Author: Beceem Communications Pvt. Ltd |
| 6 | * |
| 7 | * Abstract: This file contains the routines to copy the statistics used by |
| 8 | * the driver to the Host MIBS structure and giving the same to Application. |
| 9 | * |
| 10 | */ |
| 11 | #include "headers.h" |
| 12 | |
Stephen Hemminger | ada692b | 2010-11-01 09:26:47 -0400 | [diff] [blame] | 13 | INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMibs) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 14 | { |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 15 | S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL; |
| 16 | S_PHS_RULE *pstPhsRule = NULL; |
| 17 | S_CLASSIFIER_TABLE *pstClassifierTable = NULL; |
| 18 | S_CLASSIFIER_ENTRY *pstClassifierRule = NULL; |
| 19 | PPHS_DEVICE_EXTENSION pDeviceExtension = (PPHS_DEVICE_EXTENSION)&Adapter->stBCMPhsContext; |
| 20 | |
| 21 | UINT nClassifierIndex = 0, nPhsTableIndex = 0,nSfIndex = 0, uiIndex = 0; |
| 22 | |
| 23 | if(pDeviceExtension == NULL) |
| 24 | { |
| 25 | BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, HOST_MIBS, DBG_LVL_ALL, "Invalid Device Extension\n"); |
| 26 | return STATUS_FAILURE; |
| 27 | } |
| 28 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 29 | //Copy the classifier Table |
| 30 | for(nClassifierIndex=0; nClassifierIndex < MAX_CLASSIFIERS; |
| 31 | nClassifierIndex++) |
| 32 | { |
| 33 | if(Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE) |
| 34 | memcpy((PVOID)&pstHostMibs->astClassifierTable[nClassifierIndex], |
| 35 | (PVOID)&Adapter->astClassifierTable[nClassifierIndex], |
| 36 | sizeof(S_MIBS_CLASSIFIER_RULE)); |
| 37 | } |
| 38 | |
| 39 | //Copy the SF Table |
| 40 | for(nSfIndex=0; nSfIndex < NO_OF_QUEUES ; nSfIndex++) |
| 41 | { |
| 42 | if(Adapter->PackInfo[nSfIndex].bValid) |
| 43 | { |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 44 | memcpy((PVOID)&pstHostMibs->astSFtable[nSfIndex],(PVOID)&Adapter->PackInfo[nSfIndex],sizeof(S_MIBS_SERVICEFLOW_TABLE)); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 45 | } |
| 46 | else |
| 47 | { |
| 48 | //if index in not valid, don't process this for the PHS table. Go For the next entry. |
| 49 | continue ; |
| 50 | } |
| 51 | |
| 52 | //Retrieve the SFID Entry Index for requested Service Flow |
| 53 | if(PHS_INVALID_TABLE_INDEX == GetServiceFlowEntry(pDeviceExtension->pstServiceFlowPhsRulesTable, |
| 54 | Adapter->PackInfo[nSfIndex].usVCID_Value ,&pstServiceFlowEntry)) |
| 55 | { |
| 56 | |
| 57 | continue; |
| 58 | } |
| 59 | |
| 60 | pstClassifierTable = pstServiceFlowEntry->pstClassifierTable; |
| 61 | |
| 62 | |
| 63 | for(uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++) |
| 64 | { |
| 65 | pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[uiIndex]; |
| 66 | |
| 67 | if(pstClassifierRule->bUsed) |
| 68 | { |
| 69 | pstPhsRule = pstClassifierRule->pstPhsRule; |
| 70 | |
| 71 | pstHostMibs->astPhsRulesTable[nPhsTableIndex].ulSFID = Adapter->PackInfo[nSfIndex].ulSFID; |
| 72 | |
Stephen Hemminger | 082e889 | 2010-11-01 09:35:21 -0400 | [diff] [blame] | 73 | memcpy(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI, |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 74 | &pstPhsRule->u8PHSI, |
| 75 | sizeof(S_PHS_RULE)); |
| 76 | nPhsTableIndex++; |
| 77 | |
| 78 | } |
| 79 | |
| 80 | } |
| 81 | |
| 82 | } |
| 83 | |
| 84 | |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 85 | //copy other Host Statistics parameters |
Stephen Hemminger | cacd922 | 2010-11-01 13:34:35 -0400 | [diff] [blame] | 86 | pstHostMibs->stHostInfo.GoodTransmits = Adapter->dev->stats.tx_packets; |
| 87 | pstHostMibs->stHostInfo.GoodReceives = Adapter->dev->stats.rx_packets; |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 88 | pstHostMibs->stHostInfo.CurrNumFreeDesc = |
| 89 | atomic_read(&Adapter->CurrNumFreeTxDesc); |
| 90 | pstHostMibs->stHostInfo.BEBucketSize = Adapter->BEBucketSize; |
| 91 | pstHostMibs->stHostInfo.rtPSBucketSize = Adapter->rtPSBucketSize; |
| 92 | pstHostMibs->stHostInfo.TimerActive = Adapter->TimerActive; |
| 93 | pstHostMibs->stHostInfo.u32TotalDSD = Adapter->u32TotalDSD; |
| 94 | |
| 95 | memcpy(pstHostMibs->stHostInfo.aTxPktSizeHist,Adapter->aTxPktSizeHist,sizeof(UINT32)*MIBS_MAX_HIST_ENTRIES); |
| 96 | memcpy(pstHostMibs->stHostInfo.aRxPktSizeHist,Adapter->aRxPktSizeHist,sizeof(UINT32)*MIBS_MAX_HIST_ENTRIES); |
| 97 | |
| 98 | return STATUS_SUCCESS; |
| 99 | } |
| 100 | |
| 101 | |
Stephen Hemminger | ada692b | 2010-11-01 09:26:47 -0400 | [diff] [blame] | 102 | VOID GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *pstHostMibs, const PPER_TARANG_DATA pTarang) |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 103 | { |
Stephen Hemminger | ada692b | 2010-11-01 09:26:47 -0400 | [diff] [blame] | 104 | memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs), |
| 105 | &(pTarang->stDroppedAppCntrlMsgs),sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES)); |
Stephen Hemminger | f8942e0 | 2010-09-08 14:46:36 -0700 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | |
| 109 | VOID CopyMIBSExtendedSFParameters(PMINI_ADAPTER Adapter, |
| 110 | CServiceFlowParamSI *psfLocalSet, UINT uiSearchRuleIndex) |
| 111 | { |
| 112 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfSfid = psfLocalSet->u32SFID; |
| 113 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsMaxSustainedRate = psfLocalSet->u32MaxSustainedTrafficRate; |
| 114 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsMaxTrafficBurst = psfLocalSet->u32MaxTrafficBurst; |
| 115 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsMinReservedRate = psfLocalSet->u32MinReservedTrafficRate; |
| 116 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsToleratedJitter = psfLocalSet->u32ToleratedJitter; |
| 117 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsMaxLatency = psfLocalSet->u32MaximumLatency; |
| 118 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsFixedVsVariableSduInd = psfLocalSet->u8FixedLengthVSVariableLengthSDUIndicator; |
| 119 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsFixedVsVariableSduInd = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsFixedVsVariableSduInd); |
| 120 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSduSize = psfLocalSet->u8SDUSize; |
| 121 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSduSize = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSduSize); |
| 122 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSfSchedulingType = psfLocalSet->u8ServiceFlowSchedulingType; |
| 123 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSfSchedulingType = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsSfSchedulingType); |
| 124 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqEnable = psfLocalSet->u8ARQEnable; |
| 125 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqEnable = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqEnable); |
| 126 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqWindowSize = ntohs(psfLocalSet->u16ARQWindowSize); |
| 127 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqWindowSize = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqWindowSize); |
| 128 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockLifetime = ntohs(psfLocalSet->u16ARQBlockLifeTime); |
| 129 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockLifetime = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockLifetime); |
| 130 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqSyncLossTimeout = ntohs(psfLocalSet->u16ARQSyncLossTimeOut); |
| 131 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqSyncLossTimeout = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqSyncLossTimeout); |
| 132 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqDeliverInOrder = psfLocalSet->u8ARQDeliverInOrder; |
| 133 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqDeliverInOrder = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqDeliverInOrder); |
| 134 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqRxPurgeTimeout = ntohs(psfLocalSet->u16ARQRxPurgeTimeOut); |
| 135 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqRxPurgeTimeout = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqRxPurgeTimeout); |
| 136 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockSize = ntohs(psfLocalSet->u16ARQBlockSize); |
| 137 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockSize = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsArqBlockSize); |
| 138 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsReqTxPolicy = psfLocalSet->u8RequesttransmissionPolicy; |
| 139 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsReqTxPolicy = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsReqTxPolicy); |
| 140 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnSfCsSpecification = psfLocalSet->u8CSSpecification; |
| 141 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnSfCsSpecification = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnSfCsSpecification); |
| 142 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsTargetSaid = ntohs(psfLocalSet->u16TargetSAID); |
| 143 | Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsTargetSaid = ntohl(Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable.wmanIfCmnCpsTargetSaid); |
| 144 | |
| 145 | } |