|
@@ -21,12 +21,13 @@
|
|
|
|
|
|
#include "main.h"
|
|
|
|
|
|
-struct xge_gstrings_stats {
|
|
|
- char name[ETH_GSTRING_LEN];
|
|
|
- int offset;
|
|
|
-};
|
|
|
-
|
|
|
#define XGE_STAT(m) { #m, offsetof(struct xge_pdata, stats.m) }
|
|
|
+#define XGE_EXTD_STAT(m, n) \
|
|
|
+ { \
|
|
|
+ #m, \
|
|
|
+ n, \
|
|
|
+ 0 \
|
|
|
+ }
|
|
|
|
|
|
static const struct xge_gstrings_stats gstrings_stats[] = {
|
|
|
XGE_STAT(rx_packets),
|
|
@@ -36,7 +37,62 @@ static const struct xge_gstrings_stats gstrings_stats[] = {
|
|
|
XGE_STAT(rx_errors)
|
|
|
};
|
|
|
|
|
|
+static struct xge_gstrings_extd_stats gstrings_extd_stats[] = {
|
|
|
+ XGE_EXTD_STAT(tx_rx_64b_frame_cntr, TR64),
|
|
|
+ XGE_EXTD_STAT(tx_rx_127b_frame_cntr, TR127),
|
|
|
+ XGE_EXTD_STAT(tx_rx_255b_frame_cntr, TR255),
|
|
|
+ XGE_EXTD_STAT(tx_rx_511b_frame_cntr, TR511),
|
|
|
+ XGE_EXTD_STAT(tx_rx_1023b_frame_cntr, TR1K),
|
|
|
+ XGE_EXTD_STAT(tx_rx_1518b_frame_cntr, TRMAX),
|
|
|
+ XGE_EXTD_STAT(tx_rx_1522b_frame_cntr, TRMGV),
|
|
|
+ XGE_EXTD_STAT(rx_fcs_error_cntr, RFCS),
|
|
|
+ XGE_EXTD_STAT(rx_multicast_pkt_cntr, RMCA),
|
|
|
+ XGE_EXTD_STAT(rx_broadcast_pkt_cntr, RBCA),
|
|
|
+ XGE_EXTD_STAT(rx_ctrl_frame_pkt_cntr, RXCF),
|
|
|
+ XGE_EXTD_STAT(rx_pause_frame_pkt_cntr, RXPF),
|
|
|
+ XGE_EXTD_STAT(rx_unk_opcode_cntr, RXUO),
|
|
|
+ XGE_EXTD_STAT(rx_align_err_cntr, RALN),
|
|
|
+ XGE_EXTD_STAT(rx_frame_len_err_cntr, RFLR),
|
|
|
+ XGE_EXTD_STAT(rx_code_err_cntr, RCDE),
|
|
|
+ XGE_EXTD_STAT(rx_carrier_sense_err_cntr, RCSE),
|
|
|
+ XGE_EXTD_STAT(rx_undersize_pkt_cntr, RUND),
|
|
|
+ XGE_EXTD_STAT(rx_oversize_pkt_cntr, ROVR),
|
|
|
+ XGE_EXTD_STAT(rx_fragments_cntr, RFRG),
|
|
|
+ XGE_EXTD_STAT(rx_jabber_cntr, RJBR),
|
|
|
+ XGE_EXTD_STAT(rx_dropped_pkt_cntr, RDRP),
|
|
|
+ XGE_EXTD_STAT(tx_multicast_pkt_cntr, TMCA),
|
|
|
+ XGE_EXTD_STAT(tx_broadcast_pkt_cntr, TBCA),
|
|
|
+ XGE_EXTD_STAT(tx_pause_ctrl_frame_cntr, TXPF),
|
|
|
+ XGE_EXTD_STAT(tx_defer_pkt_cntr, TDFR),
|
|
|
+ XGE_EXTD_STAT(tx_excv_defer_pkt_cntr, TEDF),
|
|
|
+ XGE_EXTD_STAT(tx_single_col_pkt_cntr, TSCL),
|
|
|
+ XGE_EXTD_STAT(tx_multi_col_pkt_cntr, TMCL),
|
|
|
+ XGE_EXTD_STAT(tx_late_col_pkt_cntr, TLCL),
|
|
|
+ XGE_EXTD_STAT(tx_excv_col_pkt_cntr, TXCL),
|
|
|
+ XGE_EXTD_STAT(tx_total_col_cntr, TNCL),
|
|
|
+ XGE_EXTD_STAT(tx_pause_frames_hnrd_cntr, TPFH),
|
|
|
+ XGE_EXTD_STAT(tx_drop_frame_cntr, TDRP),
|
|
|
+ XGE_EXTD_STAT(tx_jabber_frame_cntr, TJBR),
|
|
|
+ XGE_EXTD_STAT(tx_fcs_error_cntr, TFCS),
|
|
|
+ XGE_EXTD_STAT(tx_ctrl_frame_cntr, TXCF),
|
|
|
+ XGE_EXTD_STAT(tx_oversize_frame_cntr, TOVR),
|
|
|
+ XGE_EXTD_STAT(tx_undersize_frame_cntr, TUND),
|
|
|
+ XGE_EXTD_STAT(tx_fragments_cntr, TFRG)
|
|
|
+};
|
|
|
+
|
|
|
#define XGE_STATS_LEN ARRAY_SIZE(gstrings_stats)
|
|
|
+#define XGE_EXTD_STATS_LEN ARRAY_SIZE(gstrings_extd_stats)
|
|
|
+
|
|
|
+static void xge_mac_get_extd_stats(struct xge_pdata *pdata)
|
|
|
+{
|
|
|
+ u32 data;
|
|
|
+ int i;
|
|
|
+
|
|
|
+ for (i = 0; i < XGE_EXTD_STATS_LEN; i++) {
|
|
|
+ data = xge_rd_csr(pdata, gstrings_extd_stats[i].addr);
|
|
|
+ gstrings_extd_stats[i].value += data;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
static void xge_get_drvinfo(struct net_device *ndev,
|
|
|
struct ethtool_drvinfo *info)
|
|
@@ -62,6 +118,11 @@ static void xge_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
|
|
|
memcpy(p, gstrings_stats[i].name, ETH_GSTRING_LEN);
|
|
|
p += ETH_GSTRING_LEN;
|
|
|
}
|
|
|
+
|
|
|
+ for (i = 0; i < XGE_EXTD_STATS_LEN; i++) {
|
|
|
+ memcpy(p, gstrings_extd_stats[i].name, ETH_GSTRING_LEN);
|
|
|
+ p += ETH_GSTRING_LEN;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static int xge_get_sset_count(struct net_device *ndev, int sset)
|
|
@@ -69,7 +130,7 @@ static int xge_get_sset_count(struct net_device *ndev, int sset)
|
|
|
if (sset != ETH_SS_STATS)
|
|
|
return -EINVAL;
|
|
|
|
|
|
- return XGE_STATS_LEN;
|
|
|
+ return XGE_STATS_LEN + XGE_EXTD_STATS_LEN;
|
|
|
}
|
|
|
|
|
|
static void xge_get_ethtool_stats(struct net_device *ndev,
|
|
@@ -81,6 +142,11 @@ static void xge_get_ethtool_stats(struct net_device *ndev,
|
|
|
|
|
|
for (i = 0; i < XGE_STATS_LEN; i++)
|
|
|
*data++ = *(u64 *)(pdata + gstrings_stats[i].offset);
|
|
|
+
|
|
|
+ xge_mac_get_extd_stats(pdata);
|
|
|
+
|
|
|
+ for (i = 0; i < XGE_EXTD_STATS_LEN; i++)
|
|
|
+ *data++ = gstrings_extd_stats[i].value;
|
|
|
}
|
|
|
|
|
|
static int xge_get_link_ksettings(struct net_device *ndev,
|