blob: c13ea5c9a2aa0823e7e3d0e120ff76fa15a610d6 [file] [log] [blame]
Stephen Hemmingerf8942e02010-09-08 14:46:36 -07001
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 Hemmingerada692b2010-11-01 09:26:47 -040013INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMibs)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070014{
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070015 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 Hemmingerf8942e02010-09-08 14:46:36 -070029 //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 Hemminger082e8892010-11-01 09:35:21 -040044 memcpy((PVOID)&pstHostMibs->astSFtable[nSfIndex],(PVOID)&Adapter->PackInfo[nSfIndex],sizeof(S_MIBS_SERVICEFLOW_TABLE));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070045 }
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 Hemminger082e8892010-11-01 09:35:21 -040073 memcpy(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI,
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070074 &pstPhsRule->u8PHSI,
75 sizeof(S_PHS_RULE));
76 nPhsTableIndex++;
77
78 }
79
80 }
81
82 }
83
84
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070085 //copy other Host Statistics parameters
Stephen Hemmingercacd9222010-11-01 13:34:35 -040086 pstHostMibs->stHostInfo.GoodTransmits = Adapter->dev->stats.tx_packets;
87 pstHostMibs->stHostInfo.GoodReceives = Adapter->dev->stats.rx_packets;
Stephen Hemmingerf8942e02010-09-08 14:46:36 -070088 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 Hemmingerada692b2010-11-01 09:26:47 -0400102VOID GetDroppedAppCntrlPktMibs(S_MIBS_HOST_STATS_MIBS *pstHostMibs, const PPER_TARANG_DATA pTarang)
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700103{
Stephen Hemmingerada692b2010-11-01 09:26:47 -0400104 memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs),
105 &(pTarang->stDroppedAppCntrlMsgs),sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES));
Stephen Hemmingerf8942e02010-09-08 14:46:36 -0700106}
107
108
109VOID 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}