hostmibs.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. #include "headers.h"
  10. INT ProcessGetHostMibs(struct bcm_mini_adapter *Adapter,
  11. struct bcm_host_stats_mibs *pstHostMibs)
  12. {
  13. struct bcm_phs_entry *pstServiceFlowEntry = NULL;
  14. struct bcm_phs_rule *pstPhsRule = NULL;
  15. struct bcm_phs_classifier_table *pstClassifierTable = NULL;
  16. struct bcm_phs_classifier_entry *pstClassifierRule = NULL;
  17. struct bcm_phs_extension *pDeviceExtension = &Adapter->stBCMPhsContext;
  18. struct bcm_mibs_host_info *host_info;
  19. UINT nClassifierIndex = 0;
  20. UINT nPhsTableIndex = 0;
  21. UINT nSfIndex = 0;
  22. UINT uiIndex = 0;
  23. if (pDeviceExtension == NULL) {
  24. BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, HOST_MIBS,
  25. DBG_LVL_ALL, "Invalid Device Extension\n");
  26. return STATUS_FAILURE;
  27. }
  28. /* Copy the classifier Table */
  29. for (nClassifierIndex = 0; nClassifierIndex < MAX_CLASSIFIERS;
  30. nClassifierIndex++) {
  31. if (Adapter->astClassifierTable[nClassifierIndex].bUsed == TRUE)
  32. memcpy(&pstHostMibs->astClassifierTable[nClassifierIndex],
  33. &Adapter->astClassifierTable[nClassifierIndex],
  34. sizeof(struct bcm_mibs_classifier_rule));
  35. }
  36. /* Copy the SF Table */
  37. for (nSfIndex = 0; nSfIndex < NO_OF_QUEUES; nSfIndex++) {
  38. if (Adapter->PackInfo[nSfIndex].bValid) {
  39. memcpy(&pstHostMibs->astSFtable[nSfIndex],
  40. &Adapter->PackInfo[nSfIndex],
  41. sizeof(struct bcm_mibs_table));
  42. } else {
  43. /* If index in not valid,
  44. * don't process this for the PHS table.
  45. * Go For the next entry.
  46. */
  47. continue;
  48. }
  49. /* Retrieve the SFID Entry Index for requested Service Flow */
  50. if (PHS_INVALID_TABLE_INDEX ==
  51. GetServiceFlowEntry(pDeviceExtension->
  52. pstServiceFlowPhsRulesTable,
  53. Adapter->PackInfo[nSfIndex].
  54. usVCID_Value, &pstServiceFlowEntry))
  55. continue;
  56. pstClassifierTable = pstServiceFlowEntry->pstClassifierTable;
  57. for (uiIndex = 0; uiIndex < MAX_PHSRULE_PER_SF; uiIndex++) {
  58. pstClassifierRule = &pstClassifierTable->stActivePhsRulesList[uiIndex];
  59. if (pstClassifierRule->bUsed) {
  60. pstPhsRule = pstClassifierRule->pstPhsRule;
  61. pstHostMibs->astPhsRulesTable[nPhsTableIndex].
  62. ulSFID = Adapter->PackInfo[nSfIndex].ulSFID;
  63. memcpy(&pstHostMibs->astPhsRulesTable[nPhsTableIndex].u8PHSI,
  64. &pstPhsRule->u8PHSI,
  65. sizeof(struct bcm_phs_rule));
  66. nPhsTableIndex++;
  67. }
  68. }
  69. }
  70. /* Copy other Host Statistics parameters */
  71. host_info = &pstHostMibs->stHostInfo;
  72. host_info->GoodTransmits = Adapter->dev->stats.tx_packets;
  73. host_info->GoodReceives = Adapter->dev->stats.rx_packets;
  74. host_info->CurrNumFreeDesc = atomic_read(&Adapter->CurrNumFreeTxDesc);
  75. host_info->BEBucketSize = Adapter->BEBucketSize;
  76. host_info->rtPSBucketSize = Adapter->rtPSBucketSize;
  77. host_info->TimerActive = Adapter->TimerActive;
  78. host_info->u32TotalDSD = Adapter->u32TotalDSD;
  79. memcpy(host_info->aTxPktSizeHist, Adapter->aTxPktSizeHist,
  80. sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
  81. memcpy(host_info->aRxPktSizeHist, Adapter->aRxPktSizeHist,
  82. sizeof(UINT32) * MIBS_MAX_HIST_ENTRIES);
  83. return STATUS_SUCCESS;
  84. }
  85. VOID GetDroppedAppCntrlPktMibs(struct bcm_host_stats_mibs *pstHostMibs,
  86. struct bcm_tarang_data *pTarang)
  87. {
  88. memcpy(&(pstHostMibs->stDroppedAppCntrlMsgs),
  89. &(pTarang->stDroppedAppCntrlMsgs),
  90. sizeof(struct bcm_mibs_dropped_cntrl_msg));
  91. }
  92. VOID CopyMIBSExtendedSFParameters(struct bcm_mini_adapter *Adapter,
  93. struct bcm_connect_mgr_params *psfLocalSet,
  94. UINT uiSearchRuleIndex)
  95. {
  96. struct bcm_mibs_parameters *t =
  97. &Adapter->PackInfo[uiSearchRuleIndex].stMibsExtServiceFlowTable;
  98. t->wmanIfSfid = psfLocalSet->u32SFID;
  99. t->wmanIfCmnCpsMaxSustainedRate =
  100. psfLocalSet->u32MaxSustainedTrafficRate;
  101. t->wmanIfCmnCpsMaxTrafficBurst = psfLocalSet->u32MaxTrafficBurst;
  102. t->wmanIfCmnCpsMinReservedRate = psfLocalSet->u32MinReservedTrafficRate;
  103. t->wmanIfCmnCpsToleratedJitter = psfLocalSet->u32ToleratedJitter;
  104. t->wmanIfCmnCpsMaxLatency = psfLocalSet->u32MaximumLatency;
  105. t->wmanIfCmnCpsFixedVsVariableSduInd =
  106. psfLocalSet->u8FixedLengthVSVariableLengthSDUIndicator;
  107. t->wmanIfCmnCpsFixedVsVariableSduInd =
  108. ntohl(t->wmanIfCmnCpsFixedVsVariableSduInd);
  109. t->wmanIfCmnCpsSduSize = psfLocalSet->u8SDUSize;
  110. t->wmanIfCmnCpsSduSize = ntohl(t->wmanIfCmnCpsSduSize);
  111. t->wmanIfCmnCpsSfSchedulingType =
  112. psfLocalSet->u8ServiceFlowSchedulingType;
  113. t->wmanIfCmnCpsSfSchedulingType =
  114. ntohl(t->wmanIfCmnCpsSfSchedulingType);
  115. t->wmanIfCmnCpsArqEnable = psfLocalSet->u8ARQEnable;
  116. t->wmanIfCmnCpsArqEnable = ntohl(t->wmanIfCmnCpsArqEnable);
  117. t->wmanIfCmnCpsArqWindowSize = ntohs(psfLocalSet->u16ARQWindowSize);
  118. t->wmanIfCmnCpsArqWindowSize = ntohl(t->wmanIfCmnCpsArqWindowSize);
  119. t->wmanIfCmnCpsArqBlockLifetime =
  120. ntohs(psfLocalSet->u16ARQBlockLifeTime);
  121. t->wmanIfCmnCpsArqBlockLifetime =
  122. ntohl(t->wmanIfCmnCpsArqBlockLifetime);
  123. t->wmanIfCmnCpsArqSyncLossTimeout =
  124. ntohs(psfLocalSet->u16ARQSyncLossTimeOut);
  125. t->wmanIfCmnCpsArqSyncLossTimeout =
  126. ntohl(t->wmanIfCmnCpsArqSyncLossTimeout);
  127. t->wmanIfCmnCpsArqDeliverInOrder = psfLocalSet->u8ARQDeliverInOrder;
  128. t->wmanIfCmnCpsArqDeliverInOrder =
  129. ntohl(t->wmanIfCmnCpsArqDeliverInOrder);
  130. t->wmanIfCmnCpsArqRxPurgeTimeout =
  131. ntohs(psfLocalSet->u16ARQRxPurgeTimeOut);
  132. t->wmanIfCmnCpsArqRxPurgeTimeout =
  133. ntohl(t->wmanIfCmnCpsArqRxPurgeTimeout);
  134. t->wmanIfCmnCpsArqBlockSize = ntohs(psfLocalSet->u16ARQBlockSize);
  135. t->wmanIfCmnCpsArqBlockSize = ntohl(t->wmanIfCmnCpsArqBlockSize);
  136. t->wmanIfCmnCpsReqTxPolicy = psfLocalSet->u8RequesttransmissionPolicy;
  137. t->wmanIfCmnCpsReqTxPolicy = ntohl(t->wmanIfCmnCpsReqTxPolicy);
  138. t->wmanIfCmnSfCsSpecification = psfLocalSet->u8CSSpecification;
  139. t->wmanIfCmnSfCsSpecification = ntohl(t->wmanIfCmnSfCsSpecification);
  140. t->wmanIfCmnCpsTargetSaid = ntohs(psfLocalSet->u16TargetSAID);
  141. t->wmanIfCmnCpsTargetSaid = ntohl(t->wmanIfCmnCpsTargetSaid);
  142. }