2 * File Name: hostmibs.c
4 * Author: Beceem Communications Pvt. Ltd
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.
12 INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
13 struct bcm_host_stats_mibs *pstHostMibs)
15 struct bcm_phs_entry *pstServiceFlowEntry = NULL;
16 struct bcm_phs_rule *pstPhsRule = NULL;
17 struct bcm_phs_classifier_table *pstClassifierTable = NULL;
18 struct bcm_phs_classifier_entry *pstClassifierRule = NULL;
19 struct bcm_phs_extension *pDeviceExtension = &Adapter->stBCMPhsContext;
20 UINT nClassifierIndex = 0;
21 UINT nPhsTableIndex = 0;
25 if (pDeviceExtension == NULL) {
26 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, HOST_MIBS,
27 DBG_LVL_ALL, "Invalid Device Extension\n");
28 return STATUS_FAILURE;
31 /* Copy the classifier Table */
32 for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS;
34 if (Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
35 memcpy(&pstHostMibs->astClassifierTable[nClassifierIndex],
36 &Adapter->astClassifierTable[nClassifierIndex],
37 sizeof(struct bcm_mibs_classifier_rule));
40 /* Copy the SF Table */
41 for (nSfIndex = 0; nSfIndex < NO_OF_QUEUES; nSfIndex++) {
42 if (Adapter->PackInfo[nSfIndex].bValid) {
43 memcpy(&pstHostMibs->astSFtable[nSfIndex],
44 &Adapter->PackInfo[nSfIndex],
45 sizeof(struct bcm_mibs_table));
47 /* If index in not valid,
48 * don't process this for the PHS table.
49 * Go For the next entry.
54 /* Retrieve the SFID Entry Index for requested Service Flow */
55 if (PHS_INVALID_TABLE_INDEX ==
56 GetServiceFlowEntry(pDeviceExtension->
57 pstServiceFlowPhsRulesTable,
58 Adapter->PackInfo[nSfIndex].
59 usVCID_Value, &pstServiceFlowEntry))
63 pstClassifierTable = pstServiceFlowEntry->pstClassifierTable;
65 for (uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++) {
66 pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[uiIndex];
68 if (pstClassifierRule->bUsed) {
69 pstPhsRule = pstClassifierRule->pstPhsRule;
71 pstHostMibs->astPhsRulesTable[nPhsTableIndex].
72 ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
74 memcpy(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI,
76 sizeof(struct bcm_phs_rule));
85 /* Copy other Host Statistics parameters */
86 pstHostMibs->stHostInfo.GoodTransmits = Adapter->dev->stats.tx_packets;
87 pstHostMibs->stHostInfo.GoodReceives = Adapter->dev->stats.rx_packets;
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;
95 memcpy(pstHostMibs->stHostInfo.aTxPktSizeHist, Adapter->aTxPktSizeHist,
96 sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
97 memcpy(pstHostMibs->stHostInfo.aRxPktSizeHist, Adapter->aRxPktSizeHist,
98 sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
100 return STATUS_SUCCESS;
103 VOID GetDroppedAppCntrlPktMibs(struct bcm_host_stats_mibs *pstHostMibs,
104 struct bcm_tarang_data *pTarang)
106 memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs),
107 &(pTarang->stDroppedAppCntrlMsgs),
108 sizeof(struct bcm_mibs_dropped_cntrl_msg));
111 VOID CopyMIBSExtendedSFParameters(struct bcm_mini_adapter *Adapter,
112 struct bcm_connect_mgr_params *psfLocalSet,
113 UINT uiSearchRuleIndex)
115 struct bcm_mibs_parameters *t = &Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable;
117 t->wmanIfSfid = psfLocalSet->u32SFID;
118 t->wmanIfCmnCpsMaxSustainedRate = psfLocalSet->u32MaxSustainedTrafficRate;
119 t->wmanIfCmnCpsMaxTrafficBurst = psfLocalSet->u32MaxTrafficBurst;
120 t->wmanIfCmnCpsMinReservedRate = psfLocalSet->u32MinReservedTrafficRate;
121 t->wmanIfCmnCpsToleratedJitter = psfLocalSet->u32ToleratedJitter;
122 t->wmanIfCmnCpsMaxLatency = psfLocalSet->u32MaximumLatency;
123 t->wmanIfCmnCpsFixedVsVariableSduInd = psfLocalSet->u8FixedLengthVSVariableLengthSDUIndicator;
124 t->wmanIfCmnCpsFixedVsVariableSduInd = ntohl(t->wmanIfCmnCpsFixedVsVariableSduInd);
125 t->wmanIfCmnCpsSduSize = psfLocalSet->u8SDUSize;
126 t->wmanIfCmnCpsSduSize = ntohl(t->wmanIfCmnCpsSduSize);
127 t->wmanIfCmnCpsSfSchedulingType = psfLocalSet->u8ServiceFlowSchedulingType;
128 t->wmanIfCmnCpsSfSchedulingType = ntohl(t->wmanIfCmnCpsSfSchedulingType);
129 t->wmanIfCmnCpsArqEnable = psfLocalSet->u8ARQEnable;
130 t->wmanIfCmnCpsArqEnable = ntohl(t->wmanIfCmnCpsArqEnable);
131 t->wmanIfCmnCpsArqWindowSize = ntohs(psfLocalSet->u16ARQWindowSize);
132 t->wmanIfCmnCpsArqWindowSize = ntohl(t->wmanIfCmnCpsArqWindowSize);
133 t->wmanIfCmnCpsArqBlockLifetime = ntohs(psfLocalSet->u16ARQBlockLifeTime);
134 t->wmanIfCmnCpsArqBlockLifetime = ntohl(t->wmanIfCmnCpsArqBlockLifetime);
135 t->wmanIfCmnCpsArqSyncLossTimeout = ntohs(psfLocalSet->u16ARQSyncLossTimeOut);
136 t->wmanIfCmnCpsArqSyncLossTimeout = ntohl(t->wmanIfCmnCpsArqSyncLossTimeout);
137 t->wmanIfCmnCpsArqDeliverInOrder = psfLocalSet->u8ARQDeliverInOrder;
138 t->wmanIfCmnCpsArqDeliverInOrder = ntohl(t->wmanIfCmnCpsArqDeliverInOrder);
139 t->wmanIfCmnCpsArqRxPurgeTimeout = ntohs(psfLocalSet->u16ARQRxPurgeTimeOut);
140 t->wmanIfCmnCpsArqRxPurgeTimeout = ntohl(t->wmanIfCmnCpsArqRxPurgeTimeout);
141 t->wmanIfCmnCpsArqBlockSize = ntohs(psfLocalSet->u16ARQBlockSize);
142 t->wmanIfCmnCpsArqBlockSize = ntohl(t->wmanIfCmnCpsArqBlockSize);
143 t->wmanIfCmnCpsReqTxPolicy = psfLocalSet->u8RequesttransmissionPolicy;
144 t->wmanIfCmnCpsReqTxPolicy = ntohl(t->wmanIfCmnCpsReqTxPolicy);
145 t->wmanIfCmnSfCsSpecification = psfLocalSet->u8CSSpecification;
146 t->wmanIfCmnSfCsSpecification = ntohl(t->wmanIfCmnSfCsSpecification);
147 t->wmanIfCmnCpsTargetSaid = ntohs(psfLocalSet->u16TargetSAID);
148 t->wmanIfCmnCpsTargetSaid = ntohl(t->wmanIfCmnCpsTargetSaid);