📄 mib.c
字号:
}
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"54M: ALL[%d], OK[%d]\n", (INT)pStatistic->CustomStat.ullRsr54M, (INT)pStatistic->CustomStat.ullRsr54MCRCOk);
}
else {
DEVICE_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Unknown: Total[%d], CRCOK[%d]\n", (INT)pStatistic->dwRsrRxPacket+1, (INT)pStatistic->dwRsrCRCOk);
}
if (BITbIsBitOn(byRSR, RSR_BSSIDOK))
pStatistic->dwRsrBSSIDOk++;
if (BITbIsBitOn(byRSR, RSR_BCNSSIDOK))
pStatistic->dwRsrBCNSSIDOk++;
if (BITbIsBitOn(byRSR, RSR_IVLDLEN)) //invalid len (> 2312 byte)
pStatistic->dwRsrLENErr++;
if (BITbIsBitOn(byRSR, RSR_IVLDTYP)) //invalid packet type
pStatistic->dwRsrTYPErr++;
if (BITbIsBitOn(byRSR, (RSR_IVLDTYP | RSR_IVLDLEN)))
pStatistic->dwRsrErr++;
if (BITbIsBitOn(byNewRSR, NEWRSR_DECRYPTOK))
pStatistic->dwNewRsrDECRYPTOK++;
if (BITbIsBitOn(byNewRSR, NEWRSR_CFPIND))
pStatistic->dwNewRsrCFP++;
if (BITbIsBitOn(byNewRSR, NEWRSR_HWUTSF))
pStatistic->dwNewRsrUTSF++;
if (BITbIsBitOn(byNewRSR, NEWRSR_BCNHITAID))
pStatistic->dwNewRsrHITAID++;
if (BITbIsBitOn(byNewRSR, NEWRSR_BCNHITAID0))
pStatistic->dwNewRsrHITAID0++;
// increase rx packet count
pStatistic->dwRsrRxPacket++;
pStatistic->dwRsrRxOctet += cbFrameLength;
if (IS_TYPE_DATA(pbyBuffer)) {
pStatistic->dwRsrRxData++;
} else if (IS_TYPE_MGMT(pbyBuffer)){
pStatistic->dwRsrRxManage++;
} else if (IS_TYPE_CONTROL(pbyBuffer)){
pStatistic->dwRsrRxControl++;
}
if (BITbIsBitOn(byRSR, RSR_ADDRBROAD))
pStatistic->dwRsrBroadcast++;
else if (BITbIsBitOn(byRSR, RSR_ADDRMULTI))
pStatistic->dwRsrMulticast++;
else
pStatistic->dwRsrDirected++;
if (WLAN_GET_FC_MOREFRAG(pHeader->wFrameCtl))
pStatistic->dwRsrRxFragment++;
if (cbFrameLength < MIN_PACKET_LEN + 4) {
pStatistic->dwRsrRunt++;
}
else if (cbFrameLength == MIN_PACKET_LEN + 4) {
pStatistic->dwRsrRxFrmLen64++;
}
else if ((65 <= cbFrameLength) && (cbFrameLength <= 127)) {
pStatistic->dwRsrRxFrmLen65_127++;
}
else if ((128 <= cbFrameLength) && (cbFrameLength <= 255)) {
pStatistic->dwRsrRxFrmLen128_255++;
}
else if ((256 <= cbFrameLength) && (cbFrameLength <= 511)) {
pStatistic->dwRsrRxFrmLen256_511++;
}
else if ((512 <= cbFrameLength) && (cbFrameLength <= 1023)) {
pStatistic->dwRsrRxFrmLen512_1023++;
}
else if ((1024 <= cbFrameLength) && (cbFrameLength <= MAX_PACKET_LEN + 4)) {
pStatistic->dwRsrRxFrmLen1024_1518++;
} else if (cbFrameLength > MAX_PACKET_LEN + 4) {
pStatistic->dwRsrLong++;
}
}
/*
* Description: Update Rx Statistic Counter and copy Rx buffer
*
* Parameters:
* In:
* pStatistic - Pointer to Statistic Counter Data Structure
* byRSR - Rx Status
* byNewRSR - Rx Status
* pbyBuffer - Rx Buffer
* cbFrameLength - Rx Length
* Out:
* none
*
* Return Value: none
*
*/
void
STAvUpdateRDStatCounterEx (
PSStatCounter pStatistic,
BYTE byRSR,
BYTE byNewRSR,
BYTE byRxRate,
PBYTE pbyBuffer,
UINT cbFrameLength
)
{
STAvUpdateRDStatCounter(
pStatistic,
byRSR,
byNewRSR,
byRxRate,
pbyBuffer,
cbFrameLength
);
// rx length
pStatistic->dwCntRxFrmLength = cbFrameLength;
// rx pattern, we just see 10 bytes for sample
MEMvCopy(pStatistic->abyCntRxPattern, (PBYTE)pbyBuffer, 10);
}
/*
* Description: Update Tx Statistic Counter
*
* Parameters:
* In:
* pStatistic - Pointer to Statistic Counter Data Structure
* byTSR0 - Tx Status
* byTSR1 - Tx Status
* pbyBuffer - Tx Buffer
* cbFrameLength - Tx Length
* uIdx - Index of Tx DMA
* Out:
* none
*
* Return Value: none
*
*/
void
STAvUpdateTDStatCounter (
PSStatCounter pStatistic,
BYTE byTSR0,
BYTE byTSR1,
PBYTE pbyBuffer,
UINT cbFrameLength,
UINT uIdx
)
{
PWLAN_80211HDR_A4 pHeader;
PBYTE pbyDestAddr;
BYTE byTSR0_NCR = byTSR0 & TSR0_NCR;
pHeader = (PWLAN_80211HDR_A4) pbyBuffer;
if (WLAN_GET_FC_TODS(pHeader->wFrameCtl) == 0) {
pbyDestAddr = &(pHeader->abyAddr1[0]);
}
else {
pbyDestAddr = &(pHeader->abyAddr3[0]);
}
// increase tx packet count
pStatistic->dwTsrTxPacket[uIdx]++;
pStatistic->dwTsrTxOctet[uIdx] += cbFrameLength;
if (byTSR0_NCR != 0) {
pStatistic->dwTsrRetry[uIdx]++;
pStatistic->dwTsrTotalRetry[uIdx] += byTSR0_NCR;
if (byTSR0_NCR == 1)
pStatistic->dwTsrOnceRetry[uIdx]++;
else
pStatistic->dwTsrMoreThanOnceRetry[uIdx]++;
}
if ((byTSR1&(TSR1_TERR|TSR1_RETRYTMO|TSR1_TMO|ACK_DATA)) == 0) {
pStatistic->ullTsrOK[uIdx]++;
pStatistic->CustomStat.ullTsrAllOK =
(pStatistic->ullTsrOK[TYPE_AC0DMA] + pStatistic->ullTsrOK[TYPE_TXDMA0]);
// update counters in case that successful transmit
if (IS_BROADCAST_ADDRESS(pbyDestAddr)) {
pStatistic->ullTxBroadcastFrames[uIdx]++;
pStatistic->ullTxBroadcastBytes[uIdx] += (ULONGLONG)cbFrameLength;
}
else if (IS_MULTICAST_ADDRESS(pbyDestAddr)) {
pStatistic->ullTxMulticastFrames[uIdx]++;
pStatistic->ullTxMulticastBytes[uIdx] += (ULONGLONG)cbFrameLength;
}
else {
pStatistic->ullTxDirectedFrames[uIdx]++;
pStatistic->ullTxDirectedBytes[uIdx] += (ULONGLONG)cbFrameLength;
}
}
else {
if (BITbIsBitOn(byTSR1, TSR1_TERR))
pStatistic->dwTsrErr[uIdx]++;
if (BITbIsBitOn(byTSR1, TSR1_RETRYTMO))
pStatistic->dwTsrRetryTimeout[uIdx]++;
if (BITbIsBitOn(byTSR1, TSR1_TMO))
pStatistic->dwTsrTransmitTimeout[uIdx]++;
if (BITbIsBitOn(byTSR1, ACK_DATA))
pStatistic->dwTsrACKData[uIdx]++;
}
if (IS_BROADCAST_ADDRESS(pbyDestAddr))
pStatistic->dwTsrBroadcast[uIdx]++;
else if (IS_MULTICAST_ADDRESS(pbyDestAddr))
pStatistic->dwTsrMulticast[uIdx]++;
else
pStatistic->dwTsrDirected[uIdx]++;
}
/*
* Description: Update Tx Statistic Counter and copy Tx buffer
*
* Parameters:
* In:
* pStatistic - Pointer to Statistic Counter Data Structure
* pbyBuffer - Tx Buffer
* cbFrameLength - Tx Length
* Out:
* none
*
* Return Value: none
*
*/
void
STAvUpdateTDStatCounterEx (
PSStatCounter pStatistic,
PBYTE pbyBuffer,
DWORD cbFrameLength
)
{
UINT uPktLength;
uPktLength = (UINT)cbFrameLength;
// tx length
pStatistic->dwCntTxBufLength = uPktLength;
// tx pattern, we just see 16 bytes for sample
MEMvCopy(pStatistic->abyCntTxPattern, pbyBuffer, 16);
}
/*
* Description: Update 802.11 mib counter
*
* Parameters:
* In:
* p802_11Counter - Pointer to 802.11 mib counter
* pStatistic - Pointer to Statistic Counter Data Structure
* dwCounter - hardware counter for 802.11 mib
* Out:
* none
*
* Return Value: none
*
*/
void
STAvUpdate802_11Counter(
PSDot11Counters p802_11Counter,
PSStatCounter pStatistic,
DWORD dwCounter
)
{
//p802_11Counter->TransmittedFragmentCount
p802_11Counter->MulticastTransmittedFrameCount = (ULONGLONG) (pStatistic->dwTsrBroadcast[TYPE_AC0DMA] +
pStatistic->dwTsrBroadcast[TYPE_TXDMA0] +
pStatistic->dwTsrMulticast[TYPE_AC0DMA] +
pStatistic->dwTsrMulticast[TYPE_TXDMA0]);
p802_11Counter->FailedCount = (ULONGLONG) (pStatistic->dwTsrErr[TYPE_AC0DMA] + pStatistic->dwTsrErr[TYPE_TXDMA0]);
p802_11Counter->RetryCount = (ULONGLONG) (pStatistic->dwTsrRetry[TYPE_AC0DMA] + pStatistic->dwTsrRetry[TYPE_TXDMA0]);
p802_11Counter->MultipleRetryCount = (ULONGLONG) (pStatistic->dwTsrMoreThanOnceRetry[TYPE_AC0DMA] +
pStatistic->dwTsrMoreThanOnceRetry[TYPE_TXDMA0]);
//p802_11Counter->FrameDuplicateCount
p802_11Counter->RTSSuccessCount += (ULONGLONG) (dwCounter & 0x000000ff);
p802_11Counter->RTSFailureCount += (ULONGLONG) ((dwCounter & 0x0000ff00) >> 8);
p802_11Counter->ACKFailureCount += (ULONGLONG) ((dwCounter & 0x00ff0000) >> 16);
p802_11Counter->FCSErrorCount += (ULONGLONG) ((dwCounter & 0xff000000) >> 24);
//p802_11Counter->ReceivedFragmentCount
p802_11Counter->MulticastReceivedFrameCount = (ULONGLONG) (pStatistic->dwRsrBroadcast +
pStatistic->dwRsrMulticast);
}
/*
* Description: Clear 802.11 mib counter
*
* Parameters:
* In:
* p802_11Counter - Pointer to 802.11 mib counter
* Out:
* none
*
* Return Value: none
*
*/
void
STAvClear802_11Counter(PSDot11Counters p802_11Counter)
{
// set memory to zero
ZERO_MEMORY(p802_11Counter, sizeof(SDot11Counters));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -