Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hostmibs.c
Go to the documentation of this file.
1 /*
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.
8  */
9 
10 #include "headers.h"
11 
13 {
14  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;
19 
20  UINT nClassifierIndex = 0, nPhsTableIndex = 0, nSfIndex = 0, uiIndex = 0;
21 
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;
25  }
26 
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],
32  (PVOID) & Adapter->
33  astClassifierTable[nClassifierIndex],
34  sizeof(S_MIBS_CLASSIFIER_RULE));
35  }
36 
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(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  }
50 
51  /* Retrieve the SFID Entry Index for requested Service Flow */
53  GetServiceFlowEntry(pDeviceExtension->
54  pstServiceFlowPhsRulesTable,
55  Adapter->PackInfo[nSfIndex].
56  usVCID_Value, &pstServiceFlowEntry))
57 
58  continue;
59 
60  pstClassifierTable = pstServiceFlowEntry->pstClassifierTable;
61 
62  for (uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++) {
63  pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[uiIndex];
64 
65  if (pstClassifierRule->bUsed) {
66  pstPhsRule = pstClassifierRule->pstPhsRule;
67 
68  pstHostMibs->astPhsRulesTable[nPhsTableIndex].
69  ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
70 
71  memcpy(&pstHostMibs->
72  astPhsRulesTable[nPhsTableIndex].u8PHSI,
73  &pstPhsRule->u8PHSI, sizeof(S_PHS_RULE));
74  nPhsTableIndex++;
75 
76  }
77 
78  }
79 
80  }
81 
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;
90 
92  memcpy(pstHostMibs->stHostInfo.aRxPktSizeHist, Adapter->aRxPktSizeHist, sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
93 
94  return STATUS_SUCCESS;
95 }
96 
98 {
99  memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs),
100  &(pTarang->stDroppedAppCntrlMsgs),
102 }
103 
105 {
106  S_MIBS_EXTSERVICEFLOW_PARAMETERS *t = &Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable;
107 
108  t->wmanIfSfid = psfLocalSet->u32SFID;
113  t->wmanIfCmnCpsMaxLatency = psfLocalSet->u32MaximumLatency;
116  t->wmanIfCmnCpsSduSize = psfLocalSet->u8SDUSize;
120  t->wmanIfCmnCpsArqEnable = psfLocalSet->u8ARQEnable;
138  t->wmanIfCmnCpsTargetSaid = ntohs(psfLocalSet->u16TargetSAID);
140 
141 }