chelsio: tabulate the update of the statistic counters
[linux-3.10.git] / drivers / net / chelsio / cxgb2.c
index c3b1648618c883e745fc990268b5f890a2e5953a..7d0f24f697770c734701bb7c8f7a835a5d559a0b 100644 (file)
@@ -454,51 +454,21 @@ 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);
 
-       *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->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;
+       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;
 
        t1_sge_get_port_stats(adapter->sge, dev->if_port, &ss);
-       *data++ = ss.rx_packets;
-       *data++ = ss.rx_cso_good;
-       *data++ = ss.tx_packets;
-       *data++ = ss.tx_cso;
-       *data++ = ss.tx_tso;
-       *data++ = ss.vlan_xtract;
-       *data++ = ss.vlan_insert;
+       memcpy(data, &ss, sizeof(ss));
+       data += sizeof(ss);
 
        t = t1_sge_get_intr_counts(adapter->sge);
        *data++ = t->rx_drops;