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
, struct bcm_host_stats_mibs
*pstHostMibs
)
14 struct bcm_phs_entry
*pstServiceFlowEntry
= NULL
;
15 struct bcm_phs_rule
*pstPhsRule
= NULL
;
16 struct bcm_phs_classifier_table
*pstClassifierTable
= NULL
;
17 struct bcm_phs_classifier_entry
*pstClassifierRule
= NULL
;
18 struct bcm_phs_extension
*pDeviceExtension
= (struct bcm_phs_extension
*) &Adapter
->stBCMPhsContext
;
20 UINT nClassifierIndex
= 0, nPhsTableIndex
= 0, nSfIndex
= 0, uiIndex
= 0;
22 if (pDeviceExtension
== NULL
) {
23 BCM_DEBUG_PRINT(Adapter
, DBG_TYPE_OTHERS
, HOST_MIBS
, DBG_LVL_ALL
, "Invalid Device Extension\n");
24 return STATUS_FAILURE
;
27 /* Copy the classifier Table */
28 for (nClassifierIndex
= 0; nClassifierIndex
< MAX_CLASSIFIERS
; nClassifierIndex
++) {
29 if (Adapter
->astClassifierTable
[nClassifierIndex
].bUsed
== TRUE
)
30 memcpy((PVOID
) & pstHostMibs
->
31 astClassifierTable
[nClassifierIndex
],
33 astClassifierTable
[nClassifierIndex
],
34 sizeof(struct bcm_mibs_classifier_rule
));
37 /* 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(struct bcm_mibs_table
));
44 /* If index in not valid,
45 * don't process this for the PHS table.
46 * Go For the next entry.
51 /* Retrieve the SFID Entry Index for requested Service Flow */
52 if (PHS_INVALID_TABLE_INDEX
==
53 GetServiceFlowEntry(pDeviceExtension
->
54 pstServiceFlowPhsRulesTable
,
55 Adapter
->PackInfo
[nSfIndex
].
56 usVCID_Value
, &pstServiceFlowEntry
))
60 pstClassifierTable
= pstServiceFlowEntry
->pstClassifierTable
;
62 for (uiIndex
= 0; uiIndex
< MAX_PHSRULE_PER_SF
; uiIndex
++) {
63 pstClassifierRule
= &pstClassifierTable
->stActivePhsRulesList
[uiIndex
];
65 if (pstClassifierRule
->bUsed
) {
66 pstPhsRule
= pstClassifierRule
->pstPhsRule
;
68 pstHostMibs
->astPhsRulesTable
[nPhsTableIndex
].
69 ulSFID
= Adapter
->PackInfo
[nSfIndex
].ulSFID
;
72 astPhsRulesTable
[nPhsTableIndex
].u8PHSI
,
73 &pstPhsRule
->u8PHSI
, sizeof(struct bcm_phs_rule
));
82 /* Copy other Host Statistics parameters */
83 pstHostMibs
->stHostInfo
.GoodTransmits
= Adapter
->dev
->stats
.tx_packets
;
84 pstHostMibs
->stHostInfo
.GoodReceives
= Adapter
->dev
->stats
.rx_packets
;
85 pstHostMibs
->stHostInfo
.CurrNumFreeDesc
= atomic_read(&Adapter
->CurrNumFreeTxDesc
);
86 pstHostMibs
->stHostInfo
.BEBucketSize
= Adapter
->BEBucketSize
;
87 pstHostMibs
->stHostInfo
.rtPSBucketSize
= Adapter
->rtPSBucketSize
;
88 pstHostMibs
->stHostInfo
.TimerActive
= Adapter
->TimerActive
;
89 pstHostMibs
->stHostInfo
.u32TotalDSD
= Adapter
->u32TotalDSD
;
91 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
);
94 return STATUS_SUCCESS
;
97 VOID
GetDroppedAppCntrlPktMibs(struct bcm_host_stats_mibs
*pstHostMibs
, struct bcm_tarang_data
*pTarang
)
99 memcpy(&(pstHostMibs
->stDroppedAppCntrlMsgs
),
100 &(pTarang
->stDroppedAppCntrlMsgs
),
101 sizeof(struct bcm_mibs_dropped_cntrl_msg
));
104 VOID
CopyMIBSExtendedSFParameters(struct bcm_mini_adapter
*Adapter
, struct bcm_connect_mgr_params
*psfLocalSet
, UINT uiSearchRuleIndex
)
106 struct bcm_mibs_parameters
*t
= &Adapter
->PackInfo
[uiSearchRuleIndex
].stMibsExtServiceFlowTable
;
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
);