cxgb - fix stats
Subsystems (2)
PATCH 3/3 cxgb - fix stats
From: Divy Le Ray <[email protected]>
Fix MAC stats accounting.
Fix get_stats.
Signed-off-by Divy Le Ray <[email protected]>
---
drivers/net/chelsio/cxgb2.c | 67 +++++++++++++++++++------ drivers/net/chelsio/pm3393.c | 112 +++++++++++++++++------------------------- drivers/net/chelsio/sge.c | 4 -- drivers/net/chelsio/sge.h | 2 - 4 files changed, 96 insertions(+), 89 deletions(-)
drivers/net/chelsio/cxgb2.c +51 -16
@@ -374,7 +374,9 @@ static char stats_strings[][ETH_GSTRING_LEN] = {"TxInternalMACXmitError" ,"TxFramesWithExcessiveDeferral" ,"TxFCSErrors" , - +"TxJumboFramesOk" , +"TxJumboOctetsOk" , +"RxOctetsOK" ,"RxOctetsBad" , "RxUnicastFramesOK",
@@ -392,11 +394,11 @@ static char stats_strings[][ETH_GSTRING_LEN] = {"RxInRangeLengthErrors" ,"RxOutOfRangeLengthField" ,"RxFrameTooLongErrors" , +"RxJumboFramesOk" , +"RxJumboOctetsOk" ,/* Port stats */ -"RxPackets" ,"RxCsumGood" , -"TxPackets" ,"TxCsumOffload" ,"TxTso" , "RxVlan",
@@ -464,23 +466,56 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,const struct cmac_statistics *s;const struct sge_intr_counts *t;struct sge_port_stats ss; -unsigned int len; s = mac->ops->statistics_update (mac,MAC_STATS_UPDATE_FULL ); - - len =sizeof (u64)*(&s->TxFCSErrors +1 - &s->TxOctetsOK); -memcpy (data, &s->TxOctetsOK, len); - data += len; - - len =sizeof (u64)*(&s->RxFrameTooLongErrors +1 - &s->RxOctetsOK); -memcpy (data, &s->RxOctetsOK, len); - data += len; - + t =t1_sge_get_intr_counts (adapter->sge);t1_sge_get_port_stats (adapter->sge, dev->if_port, &ss); -memcpy (data, &ss,sizeof (ss)); - data +=sizeof (ss); - t =t1_sge_get_intr_counts (adapter->sge); + *data++ = s->TxOctetsOK; + *data++ = s->TxOctetsBad; + *data++ = s->TxUnicastFramesOK; + *data++ = s->TxMulticastFramesOK; + *data++ = s->TxBroadcastFramesOK; + *data++ = s->TxPauseFrames; + *data++ = s->TxFramesWithDeferredXmissions; + *data++ = s->TxLateCollisions; + *data++ = s->TxTotalCollisions; + *data++ = s->TxFramesAbortedDueToXSCollisions; + *data++ = s->TxUnderrun; + *data++ = s->TxLengthErrors; + *data++ = s->TxInternalMACXmitError; + *data++ = s->TxFramesWithExcessiveDeferral; + *data++ = s->TxFCSErrors; + *data++ = s->TxJumboFramesOK; + *data++ = s->TxJumboOctetsOK; + + *data++ = s->RxOctetsOK; + *data++ = s->RxOctetsBad; + *data++ = s->RxUnicastFramesOK; + *data++ = s->RxMulticastFramesOK; + *data++ = s->RxBroadcastFramesOK; + *data++ = s->RxPauseFrames; + *data++ = s->RxFCSErrors; + *data++ = s->RxAlignErrors; + *data++ = s->RxSymbolErrors; + *data++ = s->RxDataErrors; + *data++ = s->RxSequenceErrors; + *data++ = s->RxRuntErrors; + *data++ = s->RxJabberErrors; + *data++ = s->RxInternalMACRcvError; + *data++ = s->RxInRangeLengthErrors; + *data++ = s->RxOutOfRangeLengthField; + *data++ = s->RxFrameTooLongErrors; + *data++ = s->RxJumboFramesOK; + *data++ = s->RxJumboOctetsOK; + + *data++ = ss.rx_cso_good; + *data++ = ss.tx_cso; + *data++ = ss.tx_tso; + *data++ = ss.vlan_xtract; + *data++ = ss.vlan_insert; + *data++ = ss.tx_need_hdrroom; + *data++ = t->rx_drops; *data++ = t->pure_rsps; *data++ = t->unhandled_irqs;
drivers/net/chelsio/pm3393.c +45 -67
135 lines not on this page · raw message
drivers/net/chelsio/sge.c +0 -4
@@ -986,9 +986,7 @@ void t1_sge_get_port_stats(const struct sge *sge, int port,for_each_possible_cpu (cpu) {struct sge_port_stats *st =per_cpu_ptr (sge->port_stats[port], cpu); - ss->rx_packets += st->rx_packets; ss->rx_cso_good += st->rx_cso_good; - ss->tx_packets += st->tx_packets; ss->tx_cso += st->tx_cso; ss->tx_tso += st->tx_tso; ss->tx_need_hdrroom += st->tx_need_hdrroom;
@@ -1381,7 +1379,6 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)__skb_pull (skb,sizeof (*p)); st =per_cpu_ptr (sge->port_stats[p->iff],smp_processor_id ()); - st->rx_packets++; skb->protocol =eth_type_trans (skb, adapter->port[p->iff].dev); skb->dev->last_rx = jiffies;
@@ -1946,7 +1943,6 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) cpl->vlan_valid =0 ; send: - st->tx_packets++; dev->trans_start = jiffies; ret =t1_sge_tx (skb, adapter,0 , dev);
drivers/net/chelsio/sge.h +0 -2
@@ -57,9 +57,7 @@ struct sge_intr_counts { };struct sge_port_stats { -u64 rx_packets;/* # of Ethernet packets received */ u64 rx_cso_good;/* # of successful RX csum offloads */ -u64 tx_packets;/* # of TX packets */ u64 tx_cso;/* # of TX checksum offloads */ u64 tx_tso;/* # of TSO requests */ u64 vlan_xtract;/* # of VLAN tag extractions */