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