blob: 101c4e31249e02f8381d289c946df3972524bb95 [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
Diego F. Marfil94abda92011-11-03 12:25:36 -030012INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMibs)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070013{
Diego F. Marfil94abda92011-11-03 12:25:36 -030014 S_SERVICEFLOW_ENTRY *pstServiceFlowEntry = NULL;
15 S_PHS_RULE *pstPhsRule = NULL;
16 S_CLASSIFIER_TABLE *pstClassifierTable = NULL;
17 S_CLASSIFIER_ENTRY *pstClassifierRule = NULL;
18 PPHS_DEVICE_EXTENSION pDeviceExtension = (PPHS_DEVICE_EXTENSION) &Adapter->stBCMPhsContext;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070019
Diego F. Marfil94abda92011-11-03 12:25:36 -030020 UINT nClassifierIndex = 0, nPhsTableIndex = 0, nSfIndex = 0, uiIndex = 0;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070021
Diego F. Marfil94abda92011-11-03 12:25:36 -030022 if (pDeviceExtension == NULL) {
23 BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, HOST_MIBS, DBG_LVL_ALL, "Invalid Device Extension\n");
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070024 return STATUS_FAILURE;
25 }
26
Diego F. Marfiled8e9bb2011-11-03 12:25:35 -030027 /* Copy the classifier Table */
Diego F. Marfil94abda92011-11-03 12:25:36 -030028 for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS; nClassifierIndex++) {
29 if (Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
30 memcpy((PVOID) & pstHostMibs->
31 astClassifierTable[nClassifierIndex],
32 (PVOID) & Adapter->
33 astClassifierTable[nClassifierIndex],
34 sizeof(S_MIBS_CLASSIFIER_RULE));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070035 }
36
Diego F. Marfil94abda92011-11-03 12:25:36 -030037 /* Copy the SF Table */
38 for (nSfIndex = 0; nSfIndex < NO_OF_QUEUES; nSfIndex++) {
39 if (Adapter->PackInfo[nSfIndex].bValid) {
40 memcpy((PVOID) & pstHostMibs->astSFtable[nSfIndex],
41 (PVOID) & Adapter->PackInfo[nSfIndex],
42 sizeof(S_MIBS_SERVICEFLOW_TABLE));
43 } else {
44 /* If index in not valid,
45 * don't process this for the PHS table.
46 * Go For the next entry.
47 */
48 continue;
49 }
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070050
Diego F. Marfiled8e9bb2011-11-03 12:25:35 -030051 /* Retrieve the SFID Entry Index for requested Service Flow */
Diego F. Marfil94abda92011-11-03 12:25:36 -030052 if (PHS_INVALID_TABLE_INDEX ==
53 GetServiceFlowEntry(pDeviceExtension->
54 pstServiceFlowPhsRulesTable,
55 Adapter->PackInfo[nSfIndex].
56 usVCID_Value, &pstServiceFlowEntry))
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070057
Diego F. Marfil94abda92011-11-03 12:25:36 -030058 continue;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070059
60 pstClassifierTable = pstServiceFlowEntry->pstClassifierTable;
61
Diego F. Marfil94abda92011-11-03 12:25:36 -030062 for (uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++) {
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070063 pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[uiIndex];
64
Diego F. Marfil94abda92011-11-03 12:25:36 -030065 if (pstClassifierRule->bUsed) {
66 pstPhsRule = pstClassifierRule->pstPhsRule;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070067
Diego F. Marfil94abda92011-11-03 12:25:36 -030068 pstHostMibs->astPhsRulesTable[nPhsTableIndex].
69 ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070070
Diego F. Marfil94abda92011-11-03 12:25:36 -030071 memcpy(&pstHostMibs->
72 astPhsRulesTable[nPhsTableIndex].u8PHSI,
73 &pstPhsRule->u8PHSI, sizeof(S_PHS_RULE));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070074 nPhsTableIndex++;
75
76 }
77
78 }
79
80 }
81
Diego F. Marfiled8e9bb2011-11-03 12:25:35 -030082 /* Copy other Host Statistics parameters */
Stephen Hemmingercacd9222010-11-01 13:34:35 -040083 pstHostMibs->stHostInfo.GoodTransmits = Adapter->dev->stats.tx_packets;
84 pstHostMibs->stHostInfo.GoodReceives = Adapter->dev->stats.rx_packets;
Diego F. Marfil94abda92011-11-03 12:25:36 -030085 pstHostMibs->stHostInfo.CurrNumFreeDesc = atomic_read(&Adapter->CurrNumFreeTxDesc);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070086 pstHostMibs->stHostInfo.BEBucketSize = Adapter->BEBucketSize;
87 pstHostMibs->stHostInfo.rtPSBucketSize = Adapter->rtPSBucketSize;
88 pstHostMibs->stHostInfo.TimerActive = Adapter->TimerActive;
89 pstHostMibs->stHostInfo.u32TotalDSD = Adapter->u32TotalDSD;
90
Diego F. Marfil94abda92011-11-03 12:25:36 -030091 memcpy(pstHostMibs->stHostInfo.aTxPktSizeHist, Adapter->aTxPktSizeHist, sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
92 memcpy(pstHostMibs->stHostInfo.aRxPktSizeHist, Adapter->aRxPktSizeHist, sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070093
94 return STATUS_SUCCESS;
95}
96
Stephen Hemmingerada692b2010-11-01 09:26:47 -040097VOID GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *pstHostMibs, const PPER_TARANG_DATA pTarang)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070098{
Stephen Hemmingerada692b2010-11-01 09:26:47 -040099 memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs),
Diego F. Marfil94abda92011-11-03 12:25:36 -0300100 &(pTarang->stDroppedAppCntrlMsgs),
101 sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700102}
103
Diego F. Marfil94abda92011-11-03 12:25:36 -0300104VOID CopyMIBSExtendedSFParameters(PMINI_ADAPTER Adapter, CServiceFlowParamSI *psfLocalSet, UINT uiSearchRuleIndex)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700105{
Diego F. Marfil57bfa9d2011-11-03 12:25:37 -0300106 S_MIBS_EXTSERVICEFLOW_PARAMETERS *t = &Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable;
107
108 t->wmanIfSfid = psfLocalSet->u32SFID;
109 t->wmanIfCmnCpsMaxSustainedRate = psfLocalSet->u32MaxSustainedTrafficRate;
110 t->wmanIfCmnCpsMaxTrafficBurst = psfLocalSet->u32MaxTrafficBurst;
111 t->wmanIfCmnCpsMinReservedRate = psfLocalSet->u32MinReservedTrafficRate;
112 t->wmanIfCmnCpsToleratedJitter = psfLocalSet->u32ToleratedJitter;
113 t->wmanIfCmnCpsMaxLatency = psfLocalSet->u32MaximumLatency;
114 t->wmanIfCmnCpsFixedVsVariableSduInd = psfLocalSet->u8FixedLengthVSVariableLengthSDUIndicator;
115 t->wmanIfCmnCpsFixedVsVariableSduInd = ntohl(t->wmanIfCmnCpsFixedVsVariableSduInd);
116 t->wmanIfCmnCpsSduSize = psfLocalSet->u8SDUSize;
117 t->wmanIfCmnCpsSduSize = ntohl(t->wmanIfCmnCpsSduSize);
118 t->wmanIfCmnCpsSfSchedulingType = psfLocalSet->u8ServiceFlowSchedulingType;
119 t->wmanIfCmnCpsSfSchedulingType = ntohl(t->wmanIfCmnCpsSfSchedulingType);
120 t->wmanIfCmnCpsArqEnable = psfLocalSet->u8ARQEnable;
121 t->wmanIfCmnCpsArqEnable = ntohl(t->wmanIfCmnCpsArqEnable);
122 t->wmanIfCmnCpsArqWindowSize = ntohs(psfLocalSet->u16ARQWindowSize);
123 t->wmanIfCmnCpsArqWindowSize = ntohl(t->wmanIfCmnCpsArqWindowSize);
124 t->wmanIfCmnCpsArqBlockLifetime = ntohs(psfLocalSet->u16ARQBlockLifeTime);
125 t->wmanIfCmnCpsArqBlockLifetime = ntohl(t->wmanIfCmnCpsArqBlockLifetime);
126 t->wmanIfCmnCpsArqSyncLossTimeout = ntohs(psfLocalSet->u16ARQSyncLossTimeOut);
127 t->wmanIfCmnCpsArqSyncLossTimeout = ntohl(t->wmanIfCmnCpsArqSyncLossTimeout);
128 t->wmanIfCmnCpsArqDeliverInOrder = psfLocalSet->u8ARQDeliverInOrder;
129 t->wmanIfCmnCpsArqDeliverInOrder = ntohl(t->wmanIfCmnCpsArqDeliverInOrder);
130 t->wmanIfCmnCpsArqRxPurgeTimeout = ntohs(psfLocalSet->u16ARQRxPurgeTimeOut);
131 t->wmanIfCmnCpsArqRxPurgeTimeout = ntohl(t->wmanIfCmnCpsArqRxPurgeTimeout);
132 t->wmanIfCmnCpsArqBlockSize = ntohs(psfLocalSet->u16ARQBlockSize);
133 t->wmanIfCmnCpsArqBlockSize = ntohl(t->wmanIfCmnCpsArqBlockSize);
134 t->wmanIfCmnCpsReqTxPolicy = psfLocalSet->u8RequesttransmissionPolicy;
135 t->wmanIfCmnCpsReqTxPolicy = ntohl(t->wmanIfCmnCpsReqTxPolicy);
136 t->wmanIfCmnSfCsSpecification = psfLocalSet->u8CSSpecification;
137 t->wmanIfCmnSfCsSpecification = ntohl(t->wmanIfCmnSfCsSpecification);
138 t->wmanIfCmnCpsTargetSaid = ntohs(psfLocalSet->u16TargetSAID);
139 t->wmanIfCmnCpsTargetSaid = ntohl(t->wmanIfCmnCpsTargetSaid);
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700140
141}