diff options
author | Ajit Khaparde <ajit.khaparde@emulex.com> | 2011-05-16 03:36:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-16 14:13:52 -0400 |
commit | 89a88ab84b946a90839fb66ca3583a2504c11292 (patch) | |
tree | 68ee672b503efdcd24a94500229bbde1393cd402 /drivers/net/benet/be_ethtool.c | |
parent | 538dd2e3976a7c572ee927d6bbebe01bf4d6f128 (diff) |
be2net: Support for version 1 of stats for BE3
Added support to get version 1 of the stats for BE3.
Use old stats command for BE2.
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: Selvin Xavier <selvin.xavier@emulex.com>
Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_ethtool.c')
-rw-r--r-- | drivers/net/benet/be_ethtool.c | 108 |
1 files changed, 41 insertions, 67 deletions
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index 8e770e8275df..facfe3ca5c40 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
@@ -26,8 +26,8 @@ struct be_ethtool_stat { | |||
26 | int offset; | 26 | int offset; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | enum {NETSTAT, PORTSTAT, MISCSTAT, DRVSTAT_TX, DRVSTAT_RX, ERXSTAT, | 29 | enum {NETSTAT, DRVSTAT_TX, DRVSTAT_RX, ERXSTAT, |
30 | PMEMSTAT, DRVSTAT}; | 30 | DRVSTAT}; |
31 | #define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \ | 31 | #define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \ |
32 | offsetof(_struct, field) | 32 | offsetof(_struct, field) |
33 | #define NETSTAT_INFO(field) #field, NETSTAT,\ | 33 | #define NETSTAT_INFO(field) #field, NETSTAT,\ |
@@ -37,15 +37,8 @@ enum {NETSTAT, PORTSTAT, MISCSTAT, DRVSTAT_TX, DRVSTAT_RX, ERXSTAT, | |||
37 | FIELDINFO(struct be_tx_stats, field) | 37 | FIELDINFO(struct be_tx_stats, field) |
38 | #define DRVSTAT_RX_INFO(field) #field, DRVSTAT_RX,\ | 38 | #define DRVSTAT_RX_INFO(field) #field, DRVSTAT_RX,\ |
39 | FIELDINFO(struct be_rx_stats, field) | 39 | FIELDINFO(struct be_rx_stats, field) |
40 | #define MISCSTAT_INFO(field) #field, MISCSTAT,\ | 40 | #define ERXSTAT_INFO(field) #field, ERXSTAT,\ |
41 | FIELDINFO(struct be_rxf_stats, field) | 41 | FIELDINFO(struct be_erx_stats_v1, field) |
42 | #define PORTSTAT_INFO(field) #field, PORTSTAT,\ | ||
43 | FIELDINFO(struct be_port_rxf_stats, \ | ||
44 | field) | ||
45 | #define ERXSTAT_INFO(field) #field, ERXSTAT,\ | ||
46 | FIELDINFO(struct be_erx_stats, field) | ||
47 | #define PMEMSTAT_INFO(field) #field, PMEMSTAT,\ | ||
48 | FIELDINFO(struct be_pmem_stats, field) | ||
49 | #define DRVSTAT_INFO(field) #field, DRVSTAT,\ | 42 | #define DRVSTAT_INFO(field) #field, DRVSTAT,\ |
50 | FIELDINFO(struct be_drv_stats, \ | 43 | FIELDINFO(struct be_drv_stats, \ |
51 | field) | 44 | field) |
@@ -65,50 +58,41 @@ static const struct be_ethtool_stat et_stats[] = { | |||
65 | {DRVSTAT_TX_INFO(be_tx_stops)}, | 58 | {DRVSTAT_TX_INFO(be_tx_stops)}, |
66 | {DRVSTAT_TX_INFO(be_tx_events)}, | 59 | {DRVSTAT_TX_INFO(be_tx_events)}, |
67 | {DRVSTAT_TX_INFO(be_tx_compl)}, | 60 | {DRVSTAT_TX_INFO(be_tx_compl)}, |
68 | {PORTSTAT_INFO(rx_unicast_frames)}, | 61 | {DRVSTAT_INFO(rx_crc_errors)}, |
69 | {PORTSTAT_INFO(rx_multicast_frames)}, | 62 | {DRVSTAT_INFO(rx_alignment_symbol_errors)}, |
70 | {PORTSTAT_INFO(rx_broadcast_frames)}, | 63 | {DRVSTAT_INFO(rx_pause_frames)}, |
71 | {PORTSTAT_INFO(rx_crc_errors)}, | 64 | {DRVSTAT_INFO(rx_control_frames)}, |
72 | {PORTSTAT_INFO(rx_alignment_symbol_errors)}, | 65 | {DRVSTAT_INFO(rx_in_range_errors)}, |
73 | {PORTSTAT_INFO(rx_pause_frames)}, | 66 | {DRVSTAT_INFO(rx_out_range_errors)}, |
74 | {PORTSTAT_INFO(rx_control_frames)}, | 67 | {DRVSTAT_INFO(rx_frame_too_long)}, |
75 | {PORTSTAT_INFO(rx_in_range_errors)}, | 68 | {DRVSTAT_INFO(rx_address_match_errors)}, |
76 | {PORTSTAT_INFO(rx_out_range_errors)}, | 69 | {DRVSTAT_INFO(rx_dropped_too_small)}, |
77 | {PORTSTAT_INFO(rx_frame_too_long)}, | 70 | {DRVSTAT_INFO(rx_dropped_too_short)}, |
78 | {PORTSTAT_INFO(rx_address_match_errors)}, | 71 | {DRVSTAT_INFO(rx_dropped_header_too_small)}, |
79 | {PORTSTAT_INFO(rx_vlan_mismatch)}, | 72 | {DRVSTAT_INFO(rx_dropped_tcp_length)}, |
80 | {PORTSTAT_INFO(rx_dropped_too_small)}, | 73 | {DRVSTAT_INFO(rx_dropped_runt)}, |
81 | {PORTSTAT_INFO(rx_dropped_too_short)}, | 74 | {DRVSTAT_INFO(rxpp_fifo_overflow_drop)}, |
82 | {PORTSTAT_INFO(rx_dropped_header_too_small)}, | 75 | {DRVSTAT_INFO(rx_input_fifo_overflow_drop)}, |
83 | {PORTSTAT_INFO(rx_dropped_tcp_length)}, | 76 | {DRVSTAT_INFO(rx_ip_checksum_errs)}, |
84 | {PORTSTAT_INFO(rx_dropped_runt)}, | 77 | {DRVSTAT_INFO(rx_tcp_checksum_errs)}, |
85 | {PORTSTAT_INFO(rx_fifo_overflow)}, | 78 | {DRVSTAT_INFO(rx_udp_checksum_errs)}, |
86 | {PORTSTAT_INFO(rx_input_fifo_overflow)}, | 79 | {DRVSTAT_INFO(rx_switched_unicast_packets)}, |
87 | {PORTSTAT_INFO(rx_ip_checksum_errs)}, | 80 | {DRVSTAT_INFO(rx_switched_multicast_packets)}, |
88 | {PORTSTAT_INFO(rx_tcp_checksum_errs)}, | 81 | {DRVSTAT_INFO(rx_switched_broadcast_packets)}, |
89 | {PORTSTAT_INFO(rx_udp_checksum_errs)}, | 82 | {DRVSTAT_INFO(tx_pauseframes)}, |
90 | {PORTSTAT_INFO(rx_non_rss_packets)}, | 83 | {DRVSTAT_INFO(tx_controlframes)}, |
91 | {PORTSTAT_INFO(rx_ipv4_packets)}, | 84 | {DRVSTAT_INFO(rx_priority_pause_frames)}, |
92 | {PORTSTAT_INFO(rx_ipv6_packets)}, | 85 | {DRVSTAT_INFO(pmem_fifo_overflow_drop)}, |
93 | {PORTSTAT_INFO(rx_switched_unicast_packets)}, | 86 | {DRVSTAT_INFO(jabber_events)}, |
94 | {PORTSTAT_INFO(rx_switched_multicast_packets)}, | 87 | {DRVSTAT_INFO(rx_drops_no_pbuf)}, |
95 | {PORTSTAT_INFO(rx_switched_broadcast_packets)}, | 88 | {DRVSTAT_INFO(rx_drops_no_txpb)}, |
96 | {PORTSTAT_INFO(tx_unicastframes)}, | 89 | {DRVSTAT_INFO(rx_drops_no_erx_descr)}, |
97 | {PORTSTAT_INFO(tx_multicastframes)}, | 90 | {DRVSTAT_INFO(rx_drops_no_tpre_descr)}, |
98 | {PORTSTAT_INFO(tx_broadcastframes)}, | 91 | {DRVSTAT_INFO(rx_drops_too_many_frags)}, |
99 | {PORTSTAT_INFO(tx_pauseframes)}, | 92 | {DRVSTAT_INFO(rx_drops_invalid_ring)}, |
100 | {PORTSTAT_INFO(tx_controlframes)}, | 93 | {DRVSTAT_INFO(forwarded_packets)}, |
101 | {MISCSTAT_INFO(rx_drops_no_pbuf)}, | 94 | {DRVSTAT_INFO(rx_drops_mtu)}, |
102 | {MISCSTAT_INFO(rx_drops_no_txpb)}, | 95 | {DRVSTAT_INFO(eth_red_drops)}, |
103 | {MISCSTAT_INFO(rx_drops_no_erx_descr)}, | ||
104 | {MISCSTAT_INFO(rx_drops_no_tpre_descr)}, | ||
105 | {MISCSTAT_INFO(rx_drops_too_many_frags)}, | ||
106 | {MISCSTAT_INFO(rx_drops_invalid_ring)}, | ||
107 | {MISCSTAT_INFO(forwarded_packets)}, | ||
108 | {MISCSTAT_INFO(rx_drops_mtu)}, | ||
109 | {MISCSTAT_INFO(port0_jabber_events)}, | ||
110 | {MISCSTAT_INFO(port1_jabber_events)}, | ||
111 | {PMEMSTAT_INFO(eth_red_drops)}, | ||
112 | {DRVSTAT_INFO(be_on_die_temperature)} | 96 | {DRVSTAT_INFO(be_on_die_temperature)} |
113 | }; | 97 | }; |
114 | #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats) | 98 | #define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats) |
@@ -268,8 +252,6 @@ be_get_ethtool_stats(struct net_device *netdev, | |||
268 | struct ethtool_stats *stats, uint64_t *data) | 252 | struct ethtool_stats *stats, uint64_t *data) |
269 | { | 253 | { |
270 | struct be_adapter *adapter = netdev_priv(netdev); | 254 | struct be_adapter *adapter = netdev_priv(netdev); |
271 | struct be_hw_stats *hw_stats = hw_stats_from_cmd(adapter->stats_cmd.va); | ||
272 | struct be_erx_stats *erx_stats = &hw_stats->erx; | ||
273 | struct be_rx_obj *rxo; | 255 | struct be_rx_obj *rxo; |
274 | void *p = NULL; | 256 | void *p = NULL; |
275 | int i, j; | 257 | int i, j; |
@@ -282,15 +264,6 @@ be_get_ethtool_stats(struct net_device *netdev, | |||
282 | case DRVSTAT_TX: | 264 | case DRVSTAT_TX: |
283 | p = &adapter->tx_stats; | 265 | p = &adapter->tx_stats; |
284 | break; | 266 | break; |
285 | case PORTSTAT: | ||
286 | p = &hw_stats->rxf.port[adapter->port_num]; | ||
287 | break; | ||
288 | case MISCSTAT: | ||
289 | p = &hw_stats->rxf; | ||
290 | break; | ||
291 | case PMEMSTAT: | ||
292 | p = &hw_stats->pmem; | ||
293 | break; | ||
294 | case DRVSTAT: | 267 | case DRVSTAT: |
295 | p = &adapter->drv_stats; | 268 | p = &adapter->drv_stats; |
296 | break; | 269 | break; |
@@ -308,7 +281,8 @@ be_get_ethtool_stats(struct net_device *netdev, | |||
308 | p = (u8 *)&rxo->stats + et_rx_stats[i].offset; | 281 | p = (u8 *)&rxo->stats + et_rx_stats[i].offset; |
309 | break; | 282 | break; |
310 | case ERXSTAT: | 283 | case ERXSTAT: |
311 | p = (u32 *)erx_stats + rxo->q.id; | 284 | p = (u32 *)be_erx_stats_from_cmd(adapter) + |
285 | rxo->q.id; | ||
312 | break; | 286 | break; |
313 | } | 287 | } |
314 | data[ETHTOOL_STATS_NUM + j * ETHTOOL_RXSTATS_NUM + i] = | 288 | data[ETHTOOL_STATS_NUM + j * ETHTOOL_RXSTATS_NUM + i] = |