4 *Copyright (C) 2010 Beceem Communications, Inc.
6 *This program is free software: you can redistribute it and/or modify
7 *it under the terms of the GNU General Public License version 2 as
8 *published by the Free Software Foundation.
10 *This program is distributed in the hope that it will be useful,but
11 *WITHOUT ANY WARRANTY; without even the implied warranty of
12 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 *See the GNU General Public License for more details.
15 *You should have received a copy of the GNU General Public License
16 *along with this program. If not, write to the Free Software Foundation, Inc.,
17 *51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 /************************************************************
23 * This file contains the routines to copy the statistics used by
24 * the driver to the Host MIBS structure and giving the same to Application.
25 ************************************************************/
30 INT
ProcessGetHostMibs(PMINI_ADAPTER Adapter
,
32 ULONG inputBufferLength
)
35 S_MIBS_HOST_STATS_MIBS
*pstHostMibs
= NULL
;
36 S_SERVICEFLOW_ENTRY
*pstServiceFlowEntry
= NULL
;
37 S_PHS_RULE
*pstPhsRule
= NULL
;
38 S_CLASSIFIER_TABLE
*pstClassifierTable
= NULL
;
39 S_CLASSIFIER_ENTRY
*pstClassifierRule
= NULL
;
40 PPHS_DEVICE_EXTENSION pDeviceExtension
= (PPHS_DEVICE_EXTENSION
)&Adapter
->stBCMPhsContext
;
42 UINT nClassifierIndex
= 0, nPhsTableIndex
= 0,nSfIndex
= 0, uiIndex
= 0;
44 if(pDeviceExtension
== NULL
)
46 BCM_DEBUG_PRINT(Adapter
,DBG_TYPE_OTHERS
, HOST_MIBS
, DBG_LVL_ALL
, "Invalid Device Extension\n");
47 return STATUS_FAILURE
;
54 memset(ioBuffer
,0,sizeof(S_MIBS_HOST_STATS_MIBS
));
56 pstHostMibs
= (S_MIBS_HOST_STATS_MIBS
*)ioBuffer
;
59 //Copy the classifier Table
60 for(nClassifierIndex
=0; nClassifierIndex
< MAX_CLASSIFIERS
;
63 if(Adapter
->astClassifierTable
[nClassifierIndex
].bUsed
== TRUE
)
64 memcpy((PVOID
)&pstHostMibs
->astClassifierTable
[nClassifierIndex
],
65 (PVOID
)&Adapter
->astClassifierTable
[nClassifierIndex
],
66 sizeof(S_MIBS_CLASSIFIER_RULE
));
70 for(nSfIndex
=0; nSfIndex
< NO_OF_QUEUES
; nSfIndex
++)
72 if(Adapter
->PackInfo
[nSfIndex
].bValid
)
74 OsalMemMove((PVOID
)&pstHostMibs
->astSFtable
[nSfIndex
],(PVOID
)&Adapter
->PackInfo
[nSfIndex
],sizeof(S_MIBS_SERVICEFLOW_TABLE
));
78 //if index in not valid, don't process this for the PHS table. Go For the next entry.
82 //Retrieve the SFID Entry Index for requested Service Flow
83 if(PHS_INVALID_TABLE_INDEX
== GetServiceFlowEntry(pDeviceExtension
->pstServiceFlowPhsRulesTable
,
84 Adapter
->PackInfo
[nSfIndex
].usVCID_Value
,&pstServiceFlowEntry
))
90 pstClassifierTable
= pstServiceFlowEntry
->pstClassifierTable
;
93 for(uiIndex
= 0; uiIndex
< MAX_PHSRULE_PER_SF
; uiIndex
++)
95 pstClassifierRule
= &pstClassifierTable
->stActivePhsRulesList
[uiIndex
];
97 if(pstClassifierRule
->bUsed
)
99 pstPhsRule
= pstClassifierRule
->pstPhsRule
;
101 pstHostMibs
->astPhsRulesTable
[nPhsTableIndex
].ulSFID
= Adapter
->PackInfo
[nSfIndex
].ulSFID
;
103 OsalMemMove(&pstHostMibs
->astPhsRulesTable
[nPhsTableIndex
].u8PHSI
,
116 //copy other Host Statistics parameters
117 pstHostMibs
->stHostInfo
.GoodTransmits
=
118 atomic_read(&Adapter
->TxTotalPacketCount
);
119 pstHostMibs
->stHostInfo
.GoodReceives
=
120 atomic_read(&Adapter
->GoodRxPktCount
);
121 pstHostMibs
->stHostInfo
.CurrNumFreeDesc
=
122 atomic_read(&Adapter
->CurrNumFreeTxDesc
);
123 pstHostMibs
->stHostInfo
.BEBucketSize
= Adapter
->BEBucketSize
;
124 pstHostMibs
->stHostInfo
.rtPSBucketSize
= Adapter
->rtPSBucketSize
;
125 pstHostMibs
->stHostInfo
.TimerActive
= Adapter
->TimerActive
;
126 pstHostMibs
->stHostInfo
.u32TotalDSD
= Adapter
->u32TotalDSD
;
128 memcpy(pstHostMibs
->stHostInfo
.aTxPktSizeHist
,Adapter
->aTxPktSizeHist
,sizeof(UINT32
)*MIBS_MAX_HIST_ENTRIES
);
129 memcpy(pstHostMibs
->stHostInfo
.aRxPktSizeHist
,Adapter
->aRxPktSizeHist
,sizeof(UINT32
)*MIBS_MAX_HIST_ENTRIES
);
131 return STATUS_SUCCESS
;
135 INT
GetDroppedAppCntrlPktMibs(PVOID ioBuffer
, PPER_TARANG_DATA pTarang
)
137 S_MIBS_HOST_STATS_MIBS
*pstHostMibs
= (S_MIBS_HOST_STATS_MIBS
*)ioBuffer
;
139 memcpy((PVOID
)&(pstHostMibs
->stDroppedAppCntrlMsgs
),(PVOID
)&(pTarang
->stDroppedAppCntrlMsgs
),sizeof(S_MIBS_DROPPED_APP_CNTRL_MESSAGES
));
141 return STATUS_SUCCESS
;
145 VOID
CopyMIBSExtendedSFParameters(PMINI_ADAPTER Adapter
,
146 CServiceFlowParamSI
*psfLocalSet
, UINT uiSearchRuleIndex
)
148 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfSfid
= psfLocalSet
->u32SFID
;
149 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsMaxSustainedRate
= psfLocalSet
->u32MaxSustainedTrafficRate
;
150 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsMaxTrafficBurst
= psfLocalSet
->u32MaxTrafficBurst
;
151 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsMinReservedRate
= psfLocalSet
->u32MinReservedTrafficRate
;
152 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsToleratedJitter
= psfLocalSet
->u32ToleratedJitter
;
153 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsMaxLatency
= psfLocalSet
->u32MaximumLatency
;
154 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsFixedVsVariableSduInd
= psfLocalSet
->u8FixedLengthVSVariableLengthSDUIndicator
;
155 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsFixedVsVariableSduInd
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsFixedVsVariableSduInd
);
156 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsSduSize
= psfLocalSet
->u8SDUSize
;
157 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsSduSize
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsSduSize
);
158 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsSfSchedulingType
= psfLocalSet
->u8ServiceFlowSchedulingType
;
159 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsSfSchedulingType
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsSfSchedulingType
);
160 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqEnable
= psfLocalSet
->u8ARQEnable
;
161 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqEnable
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqEnable
);
162 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqWindowSize
= ntohs(psfLocalSet
->u16ARQWindowSize
);
163 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqWindowSize
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqWindowSize
);
164 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqBlockLifetime
= ntohs(psfLocalSet
->u16ARQBlockLifeTime
);
165 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqBlockLifetime
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqBlockLifetime
);
166 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqSyncLossTimeout
= ntohs(psfLocalSet
->u16ARQSyncLossTimeOut
);
167 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqSyncLossTimeout
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqSyncLossTimeout
);
168 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqDeliverInOrder
= psfLocalSet
->u8ARQDeliverInOrder
;
169 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqDeliverInOrder
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqDeliverInOrder
);
170 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqRxPurgeTimeout
= ntohs(psfLocalSet
->u16ARQRxPurgeTimeOut
);
171 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqRxPurgeTimeout
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqRxPurgeTimeout
);
172 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqBlockSize
= ntohs(psfLocalSet
->u16ARQBlockSize
);
173 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqBlockSize
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsArqBlockSize
);
174 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsReqTxPolicy
= psfLocalSet
->u8RequesttransmissionPolicy
;
175 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsReqTxPolicy
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsReqTxPolicy
);
176 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnSfCsSpecification
= psfLocalSet
->u8CSSpecification
;
177 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnSfCsSpecification
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnSfCsSpecification
);
178 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsTargetSaid
= ntohs(psfLocalSet
->u16TargetSAID
);
179 Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsTargetSaid
= ntohl(Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
.wmanIfCmnCpsTargetSaid
);