blob: f9b08a5d8ce85032fdfad6177e86fdad4edc83d9 [file] [log] [blame]
Stephen Hemmingerf8942e02010-09-08 14:46:36 -07001/*
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 Hemmingerf8942e02010-09-08 14:46:36 -07008 */
Diego F. Marfiled8e9bb2011-11-03 12:25:35 -03009
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070010#include "headers.h"
11
Jake Edge32f21ce2014-04-04 12:25:55 -060012INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
13 struct bcm_host_stats_mibs *pstHostMibs)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070014{
Kevin McKinneydb134a62012-12-20 00:31:30 -050015 struct bcm_phs_entry *pstServiceFlowEntry = NULL;
Kevin McKinneya903d652012-12-20 00:31:34 -050016 struct bcm_phs_rule *pstPhsRule = NULL;
Kevin McKinneya700dbd2012-12-20 00:31:31 -050017 struct bcm_phs_classifier_table *pstClassifierTable = NULL;
Kevin McKinney2212e932012-12-20 00:31:32 -050018 struct bcm_phs_classifier_entry *pstClassifierRule = NULL;
Jake Edge32f21ce2014-04-04 12:25:55 -060019 struct bcm_phs_extension *pDeviceExtension = &Adapter->stBCMPhsContext;
Matthias Beyerecf97442014-06-23 21:50:44 +020020 struct bcm_mibs_host_info *host_info;
Jake Edge32f21ce2014-04-04 12:25:55 -060021 UINT nClassifierIndex = 0;
22 UINT nPhsTableIndex = 0;
23 UINT nSfIndex = 0;
24 UINT uiIndex = 0;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070025
Diego F. Marfil94abda92011-11-03 12:25:36 -030026 if (pDeviceExtension == NULL) {
Jake Edge32f21ce2014-04-04 12:25:55 -060027 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, HOST_MIBS,
28 DBG_LVL_ALL, "Invalid Device Extension\n");
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070029 return STATUS_FAILURE;
30 }
31
Diego F. Marfiled8e9bb2011-11-03 12:25:35 -030032 /* Copy the classifier Table */
Jake Edge32f21ce2014-04-04 12:25:55 -060033 for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS;
34 nClassifierIndex++) {
Diego F. Marfil94abda92011-11-03 12:25:36 -030035 if (Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
Jake Edge32f21ce2014-04-04 12:25:55 -060036 memcpy(&pstHostMibs->astClassifierTable[nClassifierIndex],
37 &Adapter->astClassifierTable[nClassifierIndex],
Kevin McKinney4aca2842012-11-25 19:29:01 -050038 sizeof(struct bcm_mibs_classifier_rule));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070039 }
40
Diego F. Marfil94abda92011-11-03 12:25:36 -030041 /* Copy the SF Table */
42 for (nSfIndex = 0; nSfIndex < NO_OF_QUEUES; nSfIndex++) {
43 if (Adapter->PackInfo[nSfIndex].bValid) {
Jake Edge32f21ce2014-04-04 12:25:55 -060044 memcpy(&pstHostMibs->astSFtable[nSfIndex],
45 &Adapter->PackInfo[nSfIndex],
46 sizeof(struct bcm_mibs_table));
Diego F. Marfil94abda92011-11-03 12:25:36 -030047 } 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 Hemmingerf8942e02010-09-08 14:46:36 -070054
Diego F. Marfiled8e9bb2011-11-03 12:25:35 -030055 /* Retrieve the SFID Entry Index for requested Service Flow */
Diego F. Marfil94abda92011-11-03 12:25:36 -030056 if (PHS_INVALID_TABLE_INDEX ==
57 GetServiceFlowEntry(pDeviceExtension->
58 pstServiceFlowPhsRulesTable,
59 Adapter->PackInfo[nSfIndex].
60 usVCID_Value, &pstServiceFlowEntry))
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070061
Diego F. Marfil94abda92011-11-03 12:25:36 -030062 continue;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070063
64 pstClassifierTable = pstServiceFlowEntry->pstClassifierTable;
65
Diego F. Marfil94abda92011-11-03 12:25:36 -030066 for (uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++) {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070067 pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[uiIndex];
68
Diego F. Marfil94abda92011-11-03 12:25:36 -030069 if (pstClassifierRule->bUsed) {
70 pstPhsRule = pstClassifierRule->pstPhsRule;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070071
Diego F. Marfil94abda92011-11-03 12:25:36 -030072 pstHostMibs->astPhsRulesTable[nPhsTableIndex].
73 ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070074
Jake Edge32f21ce2014-04-04 12:25:55 -060075 memcpy(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI,
76 &pstPhsRule->u8PHSI,
77 sizeof(struct bcm_phs_rule));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070078 nPhsTableIndex++;
79
80 }
81
82 }
83
84 }
85
Diego F. Marfiled8e9bb2011-11-03 12:25:35 -030086 /* Copy other Host Statistics parameters */
Matthias Beyerecf97442014-06-23 21:50:44 +020087 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 Hemmingerf8942e02010-09-08 14:46:36 -070095
Matthias Beyerecf97442014-06-23 21:50:44 +020096 memcpy(host_info->aTxPktSizeHist, Adapter->aTxPktSizeHist,
Jake Edge32f21ce2014-04-04 12:25:55 -060097 sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
Matthias Beyerecf97442014-06-23 21:50:44 +020098 memcpy(host_info->aRxPktSizeHist, Adapter->aRxPktSizeHist,
Jake Edge32f21ce2014-04-04 12:25:55 -060099 sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700100
101 return STATUS_SUCCESS;
102}
103
Jake Edge32f21ce2014-04-04 12:25:55 -0600104VOID GetDroppedAppCntrlPktMibs(struct bcm_host_stats_mibs *pstHostMibs,
105 struct bcm_tarang_data *pTarang)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700106{
Stephen Hemmingerada692b2010-11-01 09:26:47 -0400107 memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs),
Diego F. Marfil94abda92011-11-03 12:25:36 -0300108 &(pTarang->stDroppedAppCntrlMsgs),
Kevin McKinney2790a3c2012-11-25 19:28:57 -0500109 sizeof(struct bcm_mibs_dropped_cntrl_msg));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700110}
111
Jake Edge32f21ce2014-04-04 12:25:55 -0600112VOID CopyMIBSExtendedSFParameters(struct bcm_mini_adapter *Adapter,
113 struct bcm_connect_mgr_params *psfLocalSet,
114 UINT uiSearchRuleIndex)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700115{
Matthias Beyerfa1e4a72014-06-23 21:50:47 +0200116 struct bcm_mibs_parameters *t =
117 &Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable;
Diego F. Marfil57bfa9d2011-11-03 12:25:37 -0300118
119 t->wmanIfSfid = psfLocalSet->u32SFID;
Matthias Beyerfa1e4a72014-06-23 21:50:47 +0200120 t->wmanIfCmnCpsMaxSustainedRate =
121 psfLocalSet->u32MaxSustainedTrafficRate;
Diego F. Marfil57bfa9d2011-11-03 12:25:37 -0300122 t->wmanIfCmnCpsMaxTrafficBurst = psfLocalSet->u32MaxTrafficBurst;
123 t->wmanIfCmnCpsMinReservedRate = psfLocalSet->u32MinReservedTrafficRate;
124 t->wmanIfCmnCpsToleratedJitter = psfLocalSet->u32ToleratedJitter;
125 t->wmanIfCmnCpsMaxLatency = psfLocalSet->u32MaximumLatency;
Matthias Beyerfa1e4a72014-06-23 21:50:47 +0200126 t->wmanIfCmnCpsFixedVsVariableSduInd =
127 psfLocalSet->u8FixedLengthVSVariableLengthSDUIndicator;
128 t->wmanIfCmnCpsFixedVsVariableSduInd =
129 ntohl(t->wmanIfCmnCpsFixedVsVariableSduInd);
Diego F. Marfil57bfa9d2011-11-03 12:25:37 -0300130 t->wmanIfCmnCpsSduSize = psfLocalSet->u8SDUSize;
131 t->wmanIfCmnCpsSduSize = ntohl(t->wmanIfCmnCpsSduSize);
Matthias Beyerfa1e4a72014-06-23 21:50:47 +0200132 t->wmanIfCmnCpsSfSchedulingType =
133 psfLocalSet->u8ServiceFlowSchedulingType;
134 t->wmanIfCmnCpsSfSchedulingType =
135 ntohl(t->wmanIfCmnCpsSfSchedulingType);
Diego F. Marfil57bfa9d2011-11-03 12:25:37 -0300136 t->wmanIfCmnCpsArqEnable = psfLocalSet->u8ARQEnable;
137 t->wmanIfCmnCpsArqEnable = ntohl(t->wmanIfCmnCpsArqEnable);
138 t->wmanIfCmnCpsArqWindowSize = ntohs(psfLocalSet->u16ARQWindowSize);
139 t->wmanIfCmnCpsArqWindowSize = ntohl(t->wmanIfCmnCpsArqWindowSize);
Matthias Beyerfa1e4a72014-06-23 21:50:47 +0200140 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. Marfil57bfa9d2011-11-03 12:25:37 -0300148 t->wmanIfCmnCpsArqDeliverInOrder = psfLocalSet->u8ARQDeliverInOrder;
Matthias Beyerfa1e4a72014-06-23 21:50:47 +0200149 t->wmanIfCmnCpsArqDeliverInOrder =
150 ntohl(t->wmanIfCmnCpsArqDeliverInOrder);
151 t->wmanIfCmnCpsArqRxPurgeTimeout =
152 ntohs(psfLocalSet->u16ARQRxPurgeTimeOut);
153 t->wmanIfCmnCpsArqRxPurgeTimeout =
154 ntohl(t->wmanIfCmnCpsArqRxPurgeTimeout);
Diego F. Marfil57bfa9d2011-11-03 12:25:37 -0300155 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 Hemmingerf8942e02010-09-08 14:46:36 -0700163
164}