mirror of https://gitee.com/openkylin/linux.git
beceem: statistics and transmit queue changes
Use standard network statistics variables and routines. Transmit counters are per queue, and skb mapping is already in skb and does not need to be recomputed. Move SearchVcId to only place it is used. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
This commit is contained in:
parent
b5ebd85b2b
commit
cacd92222d
|
@ -414,17 +414,8 @@ struct _MINI_ADAPTER
|
|||
// this to keep track of the Tx and Rx MailBox Registers.
|
||||
atomic_t CurrNumFreeTxDesc;
|
||||
// to keep track the no of byte recieved
|
||||
atomic_t RxRollOverCount;
|
||||
USHORT PrevNumRecvDescs;
|
||||
USHORT CurrNumRecvDescs;
|
||||
atomic_t GoodRxByteCount;
|
||||
atomic_t GoodRxPktCount;
|
||||
atomic_t BadRxByteCount;
|
||||
atomic_t RxPacketDroppedCount;
|
||||
atomic_t GoodTxByteCount;
|
||||
atomic_t TxTotalPacketCount;
|
||||
atomic_t TxDroppedPacketCount;
|
||||
|
||||
UINT u32TotalDSD;
|
||||
PacketInfo PackInfo[NO_OF_QUEUES];
|
||||
S_CLASSIFIER_RULE astClassifierTable[MAX_CLASSIFIERS];
|
||||
|
|
|
@ -48,25 +48,6 @@ static INT bcm_close(struct net_device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_stats *bcm_get_stats(struct net_device *dev)
|
||||
{
|
||||
PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(dev);
|
||||
struct net_device_stats* netstats = &dev->stats;
|
||||
|
||||
netstats->rx_packets = atomic_read(&Adapter->RxRollOverCount)*64*1024
|
||||
+ Adapter->PrevNumRecvDescs;
|
||||
netstats->rx_bytes = atomic_read(&Adapter->GoodRxByteCount)
|
||||
+ atomic_read(&Adapter->BadRxByteCount);
|
||||
|
||||
netstats->rx_dropped = atomic_read(&Adapter->RxPacketDroppedCount);
|
||||
netstats->rx_errors = atomic_read(&Adapter->RxPacketDroppedCount);
|
||||
netstats->tx_bytes = atomic_read(&Adapter->GoodTxByteCount);
|
||||
netstats->tx_packets = atomic_read(&Adapter->TxTotalPacketCount);
|
||||
netstats->tx_dropped = atomic_read(&Adapter->TxDroppedPacketCount);
|
||||
|
||||
return netstats;
|
||||
}
|
||||
|
||||
static u16 bcm_select_queue(struct net_device *dev, struct sk_buff *skb)
|
||||
{
|
||||
return ClassifyPacket(netdev_priv(dev), skb);
|
||||
|
@ -140,7 +121,6 @@ Register other driver entry points with the kernel
|
|||
static const struct net_device_ops bcmNetDevOps = {
|
||||
.ndo_open = bcm_open,
|
||||
.ndo_stop = bcm_close,
|
||||
.ndo_get_stats = bcm_get_stats,
|
||||
.ndo_start_xmit = bcm_transmit,
|
||||
.ndo_change_mtu = eth_change_mtu,
|
||||
.ndo_set_mac_address = eth_mac_addr,
|
||||
|
|
|
@ -58,18 +58,6 @@ static INT SearchFreeSfid(PMINI_ADAPTER Adapter)
|
|||
return NO_OF_QUEUES+1;
|
||||
}
|
||||
|
||||
int SearchVcid(PMINI_ADAPTER Adapter,unsigned short usVcid)
|
||||
{
|
||||
int iIndex=0;
|
||||
|
||||
for(iIndex=(NO_OF_QUEUES-1);iIndex>=0;iIndex--)
|
||||
if(Adapter->PackInfo[iIndex].usVCID_Value == usVcid)
|
||||
return iIndex;
|
||||
return NO_OF_QUEUES+1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Function: SearchClsid
|
||||
Description: This routinue would search Classifier having specified ClassifierID as input parameter
|
||||
|
|
|
@ -1,5 +1,15 @@
|
|||
#include "headers.h"
|
||||
extern int SearchVcid(PMINI_ADAPTER , unsigned short);
|
||||
|
||||
static int SearchVcid(PMINI_ADAPTER Adapter,unsigned short usVcid)
|
||||
{
|
||||
int iIndex=0;
|
||||
|
||||
for(iIndex=(NO_OF_QUEUES-1);iIndex>=0;iIndex--)
|
||||
if(Adapter->PackInfo[iIndex].usVCID_Value == usVcid)
|
||||
return iIndex;
|
||||
return NO_OF_QUEUES+1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
static PUSB_RCB
|
||||
|
@ -88,8 +98,7 @@ static void read_bulk_callback(struct urb *urb)
|
|||
if (netif_msg_rx_err(Adapter))
|
||||
pr_info(PFX "%s: corrupted leader length...%d\n",
|
||||
Adapter->dev->name, pLeader->PLength);
|
||||
atomic_inc(&Adapter->RxPacketDroppedCount);
|
||||
atomic_add(pLeader->PLength, &Adapter->BadRxByteCount);
|
||||
++Adapter->dev->stats.rx_dropped;
|
||||
atomic_dec(&psIntfAdapter->uNumRcbUsed);
|
||||
return;
|
||||
}
|
||||
|
@ -142,7 +151,6 @@ static void read_bulk_callback(struct urb *urb)
|
|||
skb_put (skb, pLeader->PLength + ETH_HLEN);
|
||||
Adapter->PackInfo[QueueIndex].uiTotalRxBytes+=pLeader->PLength;
|
||||
Adapter->PackInfo[QueueIndex].uiThisPeriodRxBytes+= pLeader->PLength;
|
||||
atomic_add(pLeader->PLength, &Adapter->GoodRxByteCount);
|
||||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "Recived Data pkt of len :0x%X", pLeader->PLength);
|
||||
|
||||
if(netif_running(Adapter->dev))
|
||||
|
@ -172,7 +180,10 @@ static void read_bulk_callback(struct urb *urb)
|
|||
BCM_DEBUG_PRINT(psIntfAdapter->psAdapter,DBG_TYPE_RX, RX_DATA, DBG_LVL_ALL, "i/f not up hance freeing SKB...");
|
||||
dev_kfree_skb(skb);
|
||||
}
|
||||
atomic_inc(&Adapter->GoodRxPktCount);
|
||||
|
||||
++Adapter->dev->stats.rx_packets;
|
||||
Adapter->dev->stats.rx_bytes += pLeader->PLength;
|
||||
|
||||
for(uiIndex = 0 ; uiIndex < MIBS_MAX_HIST_ENTRIES ; uiIndex++)
|
||||
{
|
||||
if((pLeader->PLength <= MIBS_PKTSIZEHIST_RANGE*(uiIndex+1))
|
||||
|
|
|
@ -1859,8 +1859,6 @@ void flush_queue(PMINI_ADAPTER Adapter, UINT iQIndex)
|
|||
|
||||
dev_kfree_skb(PacketToDrop);
|
||||
atomic_dec(&Adapter->TotalPacketCount);
|
||||
atomic_inc(&Adapter->TxDroppedPacketCount);
|
||||
|
||||
}
|
||||
}
|
||||
spin_unlock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock);
|
||||
|
|
|
@ -93,8 +93,6 @@ void beceem_parse_target_struct(PMINI_ADAPTER Adapter);
|
|||
|
||||
int bcm_ioctl_fw_download(PMINI_ADAPTER Adapter, FIRMWARE_INFO *psFwInfo);
|
||||
|
||||
int SearchVcid(PMINI_ADAPTER Adapter,unsigned short usVcid);
|
||||
|
||||
void CopyMIBSExtendedSFParameters(PMINI_ADAPTER Adapter,
|
||||
CServiceFlowParamSI *psfLocalSet, UINT uiSearchRuleIndex);
|
||||
|
||||
|
|
|
@ -359,12 +359,13 @@ static VOID PruneQueue(PMINI_ADAPTER Adapter, INT iIndex)
|
|||
|
||||
if(PacketToDrop)
|
||||
{
|
||||
struct netdev_queue *txq = netdev_get_tx_queue(Adapter->dev, iIndex);
|
||||
if (netif_msg_tx_err(Adapter))
|
||||
pr_info(PFX "%s: tx queue %d overlimit\n",
|
||||
Adapter->dev->name, iIndex);
|
||||
|
||||
netstats->tx_dropped++;
|
||||
atomic_inc(&Adapter->TxDroppedPacketCount);
|
||||
txq->tx_dropped++;
|
||||
|
||||
DEQUEUEPACKET(Adapter->PackInfo[iIndex].FirstTxQueue,
|
||||
Adapter->PackInfo[iIndex].LastTxQueue);
|
||||
/// update current bytes and packets count
|
||||
|
@ -397,14 +398,15 @@ VOID flush_all_queues(PMINI_ADAPTER Adapter)
|
|||
{
|
||||
INT iQIndex;
|
||||
UINT uiTotalPacketLength;
|
||||
struct sk_buff* PacketToDrop=NULL;
|
||||
struct net_device_stats* netstats=&Adapter->dev->stats;
|
||||
struct sk_buff* PacketToDrop=NULL;
|
||||
|
||||
BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, DUMP_INFO, DBG_LVL_ALL, "=====>");
|
||||
|
||||
// down(&Adapter->data_packet_queue_lock);
|
||||
for(iQIndex=LowPriority; iQIndex<HiPriority; iQIndex++)
|
||||
{
|
||||
struct netdev_queue *txq = netdev_get_tx_queue(Adapter->dev, iQIndex);
|
||||
|
||||
spin_lock_bh(&Adapter->PackInfo[iQIndex].SFQueueLock);
|
||||
while(Adapter->PackInfo[iQIndex].FirstTxQueue)
|
||||
{
|
||||
|
@ -412,8 +414,7 @@ VOID flush_all_queues(PMINI_ADAPTER Adapter)
|
|||
if(PacketToDrop)
|
||||
{
|
||||
uiTotalPacketLength = PacketToDrop->len;
|
||||
netstats->tx_dropped++;
|
||||
atomic_inc(&Adapter->TxDroppedPacketCount);
|
||||
txq->tx_dropped++;
|
||||
}
|
||||
else
|
||||
uiTotalPacketLength = 0;
|
||||
|
|
|
@ -90,7 +90,7 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid)
|
|||
int status=0;
|
||||
BOOLEAN bHeaderSupressionEnabled = FALSE;
|
||||
B_UINT16 uiClassifierRuleID;
|
||||
int QueueIndex = NO_OF_QUEUES + 1;
|
||||
u16 QueueIndex = skb_get_queue_mapping(Packet);
|
||||
LEADER Leader={0};
|
||||
|
||||
if(Packet->len > MAX_DEVICE_DESC_SIZE)
|
||||
|
@ -101,14 +101,10 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid)
|
|||
|
||||
/* Get the Classifier Rule ID */
|
||||
uiClassifierRuleID = *((UINT32*) (Packet->cb)+SKB_CB_CLASSIFICATION_OFFSET);
|
||||
QueueIndex = SearchVcid( Adapter,Vcid);
|
||||
if(QueueIndex < NO_OF_QUEUES)
|
||||
{
|
||||
bHeaderSupressionEnabled =
|
||||
Adapter->PackInfo[QueueIndex].bHeaderSuppressionEnabled;
|
||||
bHeaderSupressionEnabled =
|
||||
bHeaderSupressionEnabled & Adapter->bPHSEnabled;
|
||||
}
|
||||
|
||||
bHeaderSupressionEnabled = Adapter->PackInfo[QueueIndex].bHeaderSuppressionEnabled
|
||||
& Adapter->bPHSEnabled;
|
||||
|
||||
if(Adapter->device_removed)
|
||||
{
|
||||
status = STATUS_FAILURE;
|
||||
|
@ -162,9 +158,12 @@ INT SetupNextSend(PMINI_ADAPTER Adapter, struct sk_buff *Packet, USHORT Vcid)
|
|||
}
|
||||
else
|
||||
{
|
||||
struct netdev_queue *txq = netdev_get_tx_queue(Adapter->dev, QueueIndex);
|
||||
Adapter->PackInfo[QueueIndex].uiTotalTxBytes += Leader.PLength;
|
||||
Adapter->dev->stats.tx_bytes += Leader.PLength;
|
||||
++Adapter->dev->stats.tx_packets;
|
||||
|
||||
txq->tx_bytes += Leader.PLength;
|
||||
++txq->tx_packets;
|
||||
|
||||
Adapter->PackInfo[QueueIndex].uiCurrentTokenCount -= Leader.PLength << 3;
|
||||
Adapter->PackInfo[QueueIndex].uiSentBytes += (Packet->len);
|
||||
Adapter->PackInfo[QueueIndex].uiSentPackets++;
|
||||
|
|
|
@ -82,12 +82,9 @@ INT ProcessGetHostMibs(PMINI_ADAPTER Adapter, S_MIBS_HOST_STATS_MIBS *pstHostMi
|
|||
}
|
||||
|
||||
|
||||
|
||||
//copy other Host Statistics parameters
|
||||
pstHostMibs->stHostInfo.GoodTransmits =
|
||||
atomic_read(&Adapter->TxTotalPacketCount);
|
||||
pstHostMibs->stHostInfo.GoodReceives =
|
||||
atomic_read(&Adapter->GoodRxPktCount);
|
||||
pstHostMibs->stHostInfo.GoodTransmits = Adapter->dev->stats.tx_packets;
|
||||
pstHostMibs->stHostInfo.GoodReceives = Adapter->dev->stats.rx_packets;
|
||||
pstHostMibs->stHostInfo.CurrNumFreeDesc =
|
||||
atomic_read(&Adapter->CurrNumFreeTxDesc);
|
||||
pstHostMibs->stHostInfo.BEBucketSize = Adapter->BEBucketSize;
|
||||
|
|
|
@ -108,8 +108,9 @@ static INT LED_Proportional_Blink(PMINI_ADAPTER Adapter, UCHAR GPIO_Num_tx,
|
|||
ulong timeout = 0;
|
||||
|
||||
/*Read initial value of packets sent/received */
|
||||
Initial_num_of_packts_tx = atomic_read(&Adapter->TxTotalPacketCount);
|
||||
Initial_num_of_packts_rx = atomic_read(&Adapter->GoodRxPktCount);
|
||||
Initial_num_of_packts_tx = Adapter->dev->stats.tx_packets;
|
||||
Initial_num_of_packts_rx = Adapter->dev->stats.rx_packets;
|
||||
|
||||
/*Scale the rate of transfer to no of blinks.*/
|
||||
num_of_time_tx= ScaleRateofTransfer((ULONG)rate_of_transfer_tx);
|
||||
num_of_time_rx= ScaleRateofTransfer((ULONG)rate_of_transfer_rx);
|
||||
|
@ -212,9 +213,10 @@ static INT LED_Proportional_Blink(PMINI_ADAPTER Adapter, UCHAR GPIO_Num_tx,
|
|||
* Read the Tx & Rx packets transmission after 1 second and
|
||||
* calculate rate of transfer
|
||||
*/
|
||||
Final_num_of_packts_tx = atomic_read(&Adapter->TxTotalPacketCount);
|
||||
Final_num_of_packts_tx = Adapter->dev->stats.tx_packets;
|
||||
Final_num_of_packts_rx = Adapter->dev->stats.rx_packets;
|
||||
|
||||
rate_of_transfer_tx = Final_num_of_packts_tx - Initial_num_of_packts_tx;
|
||||
Final_num_of_packts_rx = atomic_read(&Adapter->GoodRxPktCount);
|
||||
rate_of_transfer_rx = Final_num_of_packts_rx - Initial_num_of_packts_rx;
|
||||
|
||||
/*Read initial value of packets sent/received */
|
||||
|
|
Loading…
Reference in New Issue