blob: 6faa39e9d7a605ca8c555e64c96e06e0a531f790 [file] [log] [blame]
Ramkrishna Vepad26078f2009-04-01 18:15:16 +00001/******************************************************************************
2 * This software may be used and distributed according to the terms of
3 * the GNU General Public License (GPL), incorporated herein by reference.
4 * Drivers based on or derived from this code fall under the GPL and must
5 * retain the authorship, copyright and license notice. This file is not
6 * a complete program and may only be used when the entire operating
7 * system is licensed under the GPL.
8 * See the file COPYING in this distribution for more information.
9 *
10 * vxge-ethtool.c: Driver for Neterion Inc's X3100 Series 10GbE PCIe I/O
11 * Virtualized Server Adapter.
12 * Copyright(c) 2002-2009 Neterion Inc.
13 ******************************************************************************/
14#include<linux/ethtool.h>
15#include <linux/pci.h>
16#include <linux/etherdevice.h>
17
18#include "vxge-ethtool.h"
19
20/**
21 * vxge_ethtool_sset - Sets different link parameters.
22 * @dev: device pointer.
23 * @info: pointer to the structure with parameters given by ethtool to set
24 * link information.
25 *
26 * The function sets different link parameters provided by the user onto
27 * the NIC.
28 * Return value:
29 * 0 on success.
30 */
31
32static int vxge_ethtool_sset(struct net_device *dev, struct ethtool_cmd *info)
33{
34 /* We currently only support 10Gb/FULL */
35 if ((info->autoneg == AUTONEG_ENABLE) ||
36 (info->speed != SPEED_10000) || (info->duplex != DUPLEX_FULL))
37 return -EINVAL;
38
39 return 0;
40}
41
42/**
43 * vxge_ethtool_gset - Return link specific information.
44 * @dev: device pointer.
45 * @info: pointer to the structure with parameters given by ethtool
46 * to return link information.
47 *
48 * Returns link specific information like speed, duplex etc.. to ethtool.
49 * Return value :
50 * return 0 on success.
51 */
52static int vxge_ethtool_gset(struct net_device *dev, struct ethtool_cmd *info)
53{
54 info->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);
55 info->advertising = (ADVERTISED_10000baseT_Full | ADVERTISED_FIBRE);
56 info->port = PORT_FIBRE;
57
58 info->transceiver = XCVR_EXTERNAL;
59
60 if (netif_carrier_ok(dev)) {
61 info->speed = SPEED_10000;
62 info->duplex = DUPLEX_FULL;
63 } else {
64 info->speed = -1;
65 info->duplex = -1;
66 }
67
68 info->autoneg = AUTONEG_DISABLE;
69 return 0;
70}
71
72/**
73 * vxge_ethtool_gdrvinfo - Returns driver specific information.
74 * @dev: device pointer.
75 * @info: pointer to the structure with parameters given by ethtool to
76 * return driver information.
77 *
78 * Returns driver specefic information like name, version etc.. to ethtool.
79 */
80static void vxge_ethtool_gdrvinfo(struct net_device *dev,
81 struct ethtool_drvinfo *info)
82{
83 struct vxgedev *vdev;
84 vdev = (struct vxgedev *)netdev_priv(dev);
85 strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(VXGE_DRIVER_NAME));
86 strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION));
87 strlcpy(info->fw_version, vdev->fw_version, VXGE_HW_FW_STRLEN);
88 strlcpy(info->bus_info, pci_name(vdev->pdev), sizeof(info->bus_info));
89 info->regdump_len = sizeof(struct vxge_hw_vpath_reg)
90 * vdev->no_of_vpath;
91
92 info->n_stats = STAT_LEN;
93}
94
95/**
96 * vxge_ethtool_gregs - dumps the entire space of Titan into the buffer.
97 * @dev: device pointer.
98 * @regs: pointer to the structure with parameters given by ethtool for
99 * dumping the registers.
100 * @reg_space: The input argumnet into which all the registers are dumped.
101 *
102 * Dumps the vpath register space of Titan NIC into the user given
103 * buffer area.
104 */
105static void vxge_ethtool_gregs(struct net_device *dev,
106 struct ethtool_regs *regs, void *space)
107{
108 int index, offset;
109 enum vxge_hw_status status;
110 u64 reg;
Sreenivasa Honnur4c5f3b22010-03-28 22:10:33 +0000111 u64 *reg_space = (u64 *) space;
Ramkrishna Vepad26078f2009-04-01 18:15:16 +0000112 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
113 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
114 pci_get_drvdata(vdev->pdev);
115
116 regs->len = sizeof(struct vxge_hw_vpath_reg) * vdev->no_of_vpath;
117 regs->version = vdev->pdev->subsystem_device;
118 for (index = 0; index < vdev->no_of_vpath; index++) {
119 for (offset = 0; offset < sizeof(struct vxge_hw_vpath_reg);
120 offset += 8) {
121 status = vxge_hw_mgmt_reg_read(hldev,
122 vxge_hw_mgmt_reg_type_vpath,
123 vdev->vpaths[index].device_id,
124 offset, &reg);
125 if (status != VXGE_HW_OK) {
126 vxge_debug_init(VXGE_ERR,
127 "%s:%d Getting reg dump Failed",
128 __func__, __LINE__);
129 return;
130 }
Sreenivasa Honnur4c5f3b22010-03-28 22:10:33 +0000131 *reg_space++ = reg;
Ramkrishna Vepad26078f2009-04-01 18:15:16 +0000132 }
133 }
134}
135
136/**
137 * vxge_ethtool_idnic - To physically identify the nic on the system.
138 * @dev : device pointer.
139 * @id : pointer to the structure with identification parameters given by
140 * ethtool.
141 *
142 * Used to physically identify the NIC on the system.
143 * The Link LED will blink for a time specified by the user.
144 * Return value:
145 * 0 on success
146 */
147static int vxge_ethtool_idnic(struct net_device *dev, u32 data)
148{
149 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
150 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
151 pci_get_drvdata(vdev->pdev);
152
153 vxge_hw_device_flick_link_led(hldev, VXGE_FLICKER_ON);
154 msleep_interruptible(data ? (data * HZ) : VXGE_MAX_FLICKER_TIME);
155 vxge_hw_device_flick_link_led(hldev, VXGE_FLICKER_OFF);
156
157 return 0;
158}
159
160/**
161 * vxge_ethtool_getpause_data - Pause frame frame generation and reception.
162 * @dev : device pointer.
163 * @ep : pointer to the structure with pause parameters given by ethtool.
164 * Description:
165 * Returns the Pause frame generation and reception capability of the NIC.
166 * Return value:
167 * void
168 */
169static void vxge_ethtool_getpause_data(struct net_device *dev,
170 struct ethtool_pauseparam *ep)
171{
172 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
173 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
174 pci_get_drvdata(vdev->pdev);
175
176 vxge_hw_device_getpause_data(hldev, 0, &ep->tx_pause, &ep->rx_pause);
177}
178
179/**
180 * vxge_ethtool_setpause_data - set/reset pause frame generation.
181 * @dev : device pointer.
182 * @ep : pointer to the structure with pause parameters given by ethtool.
183 * Description:
184 * It can be used to set or reset Pause frame generation or reception
185 * support of the NIC.
186 * Return value:
187 * int, returns 0 on Success
188 */
189static int vxge_ethtool_setpause_data(struct net_device *dev,
190 struct ethtool_pauseparam *ep)
191{
192 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
193 struct __vxge_hw_device *hldev = (struct __vxge_hw_device *)
194 pci_get_drvdata(vdev->pdev);
195
196 vxge_hw_device_setpause_data(hldev, 0, ep->tx_pause, ep->rx_pause);
197
198 vdev->config.tx_pause_enable = ep->tx_pause;
199 vdev->config.rx_pause_enable = ep->rx_pause;
200
201 return 0;
202}
203
204static void vxge_get_ethtool_stats(struct net_device *dev,
205 struct ethtool_stats *estats, u64 *tmp_stats)
206{
207 int j, k;
208 enum vxge_hw_status status;
209 enum vxge_hw_status swstatus;
210 struct vxge_vpath *vpath = NULL;
211
212 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
213 struct __vxge_hw_device *hldev = vdev->devh;
214 struct vxge_hw_xmac_stats *xmac_stats;
215 struct vxge_hw_device_stats_sw_info *sw_stats;
216 struct vxge_hw_device_stats_hw_info *hw_stats;
217
218 u64 *ptr = tmp_stats;
219
220 memset(tmp_stats, 0,
221 vxge_ethtool_get_sset_count(dev, ETH_SS_STATS) * sizeof(u64));
222
223 xmac_stats = kzalloc(sizeof(struct vxge_hw_xmac_stats), GFP_KERNEL);
224 if (xmac_stats == NULL) {
225 vxge_debug_init(VXGE_ERR,
226 "%s : %d Memory Allocation failed for xmac_stats",
227 __func__, __LINE__);
228 return;
229 }
230
231 sw_stats = kzalloc(sizeof(struct vxge_hw_device_stats_sw_info),
232 GFP_KERNEL);
233 if (sw_stats == NULL) {
234 kfree(xmac_stats);
235 vxge_debug_init(VXGE_ERR,
236 "%s : %d Memory Allocation failed for sw_stats",
237 __func__, __LINE__);
238 return;
239 }
240
241 hw_stats = kzalloc(sizeof(struct vxge_hw_device_stats_hw_info),
242 GFP_KERNEL);
243 if (hw_stats == NULL) {
244 kfree(xmac_stats);
245 kfree(sw_stats);
246 vxge_debug_init(VXGE_ERR,
247 "%s : %d Memory Allocation failed for hw_stats",
248 __func__, __LINE__);
249 return;
250 }
251
252 *ptr++ = 0;
253 status = vxge_hw_device_xmac_stats_get(hldev, xmac_stats);
254 if (status != VXGE_HW_OK) {
255 if (status != VXGE_HW_ERR_PRIVILAGED_OPEARATION) {
256 vxge_debug_init(VXGE_ERR,
257 "%s : %d Failure in getting xmac stats",
258 __func__, __LINE__);
259 }
260 }
261 swstatus = vxge_hw_driver_stats_get(hldev, sw_stats);
262 if (swstatus != VXGE_HW_OK) {
263 vxge_debug_init(VXGE_ERR,
264 "%s : %d Failure in getting sw stats",
265 __func__, __LINE__);
266 }
267
268 status = vxge_hw_device_stats_get(hldev, hw_stats);
269 if (status != VXGE_HW_OK) {
270 vxge_debug_init(VXGE_ERR,
271 "%s : %d hw_stats_get error", __func__, __LINE__);
272 }
273
274 for (k = 0; k < vdev->no_of_vpath; k++) {
275 struct vxge_hw_vpath_stats_hw_info *vpath_info;
276
277 vpath = &vdev->vpaths[k];
278 j = vpath->device_id;
279 vpath_info = hw_stats->vpath_info[j];
280 if (!vpath_info) {
281 memset(ptr, 0, (VXGE_HW_VPATH_TX_STATS_LEN +
282 VXGE_HW_VPATH_RX_STATS_LEN) * sizeof(u64));
283 ptr += (VXGE_HW_VPATH_TX_STATS_LEN +
284 VXGE_HW_VPATH_RX_STATS_LEN);
285 continue;
286 }
287
288 *ptr++ = vpath_info->tx_stats.tx_ttl_eth_frms;
289 *ptr++ = vpath_info->tx_stats.tx_ttl_eth_octets;
290 *ptr++ = vpath_info->tx_stats.tx_data_octets;
291 *ptr++ = vpath_info->tx_stats.tx_mcast_frms;
292 *ptr++ = vpath_info->tx_stats.tx_bcast_frms;
293 *ptr++ = vpath_info->tx_stats.tx_ucast_frms;
294 *ptr++ = vpath_info->tx_stats.tx_tagged_frms;
295 *ptr++ = vpath_info->tx_stats.tx_vld_ip;
296 *ptr++ = vpath_info->tx_stats.tx_vld_ip_octets;
297 *ptr++ = vpath_info->tx_stats.tx_icmp;
298 *ptr++ = vpath_info->tx_stats.tx_tcp;
299 *ptr++ = vpath_info->tx_stats.tx_rst_tcp;
300 *ptr++ = vpath_info->tx_stats.tx_udp;
301 *ptr++ = vpath_info->tx_stats.tx_unknown_protocol;
302 *ptr++ = vpath_info->tx_stats.tx_lost_ip;
303 *ptr++ = vpath_info->tx_stats.tx_parse_error;
304 *ptr++ = vpath_info->tx_stats.tx_tcp_offload;
305 *ptr++ = vpath_info->tx_stats.tx_retx_tcp_offload;
306 *ptr++ = vpath_info->tx_stats.tx_lost_ip_offload;
307 *ptr++ = vpath_info->rx_stats.rx_ttl_eth_frms;
308 *ptr++ = vpath_info->rx_stats.rx_vld_frms;
309 *ptr++ = vpath_info->rx_stats.rx_offload_frms;
310 *ptr++ = vpath_info->rx_stats.rx_ttl_eth_octets;
311 *ptr++ = vpath_info->rx_stats.rx_data_octets;
312 *ptr++ = vpath_info->rx_stats.rx_offload_octets;
313 *ptr++ = vpath_info->rx_stats.rx_vld_mcast_frms;
314 *ptr++ = vpath_info->rx_stats.rx_vld_bcast_frms;
315 *ptr++ = vpath_info->rx_stats.rx_accepted_ucast_frms;
316 *ptr++ = vpath_info->rx_stats.rx_accepted_nucast_frms;
317 *ptr++ = vpath_info->rx_stats.rx_tagged_frms;
318 *ptr++ = vpath_info->rx_stats.rx_long_frms;
319 *ptr++ = vpath_info->rx_stats.rx_usized_frms;
320 *ptr++ = vpath_info->rx_stats.rx_osized_frms;
321 *ptr++ = vpath_info->rx_stats.rx_frag_frms;
322 *ptr++ = vpath_info->rx_stats.rx_jabber_frms;
323 *ptr++ = vpath_info->rx_stats.rx_ttl_64_frms;
324 *ptr++ = vpath_info->rx_stats.rx_ttl_65_127_frms;
325 *ptr++ = vpath_info->rx_stats.rx_ttl_128_255_frms;
326 *ptr++ = vpath_info->rx_stats.rx_ttl_256_511_frms;
327 *ptr++ = vpath_info->rx_stats.rx_ttl_512_1023_frms;
328 *ptr++ = vpath_info->rx_stats.rx_ttl_1024_1518_frms;
329 *ptr++ = vpath_info->rx_stats.rx_ttl_1519_4095_frms;
330 *ptr++ = vpath_info->rx_stats.rx_ttl_4096_8191_frms;
331 *ptr++ = vpath_info->rx_stats.rx_ttl_8192_max_frms;
332 *ptr++ = vpath_info->rx_stats.rx_ttl_gt_max_frms;
333 *ptr++ = vpath_info->rx_stats.rx_ip;
334 *ptr++ = vpath_info->rx_stats.rx_accepted_ip;
335 *ptr++ = vpath_info->rx_stats.rx_ip_octets;
336 *ptr++ = vpath_info->rx_stats.rx_err_ip;
337 *ptr++ = vpath_info->rx_stats.rx_icmp;
338 *ptr++ = vpath_info->rx_stats.rx_tcp;
339 *ptr++ = vpath_info->rx_stats.rx_udp;
340 *ptr++ = vpath_info->rx_stats.rx_err_tcp;
341 *ptr++ = vpath_info->rx_stats.rx_lost_frms;
342 *ptr++ = vpath_info->rx_stats.rx_lost_ip;
343 *ptr++ = vpath_info->rx_stats.rx_lost_ip_offload;
344 *ptr++ = vpath_info->rx_stats.rx_various_discard;
345 *ptr++ = vpath_info->rx_stats.rx_sleep_discard;
346 *ptr++ = vpath_info->rx_stats.rx_red_discard;
347 *ptr++ = vpath_info->rx_stats.rx_queue_full_discard;
348 *ptr++ = vpath_info->rx_stats.rx_mpa_ok_frms;
349 }
350 *ptr++ = 0;
351 for (k = 0; k < vdev->max_config_port; k++) {
352 *ptr++ = xmac_stats->aggr_stats[k].tx_frms;
353 *ptr++ = xmac_stats->aggr_stats[k].tx_data_octets;
354 *ptr++ = xmac_stats->aggr_stats[k].tx_mcast_frms;
355 *ptr++ = xmac_stats->aggr_stats[k].tx_bcast_frms;
356 *ptr++ = xmac_stats->aggr_stats[k].tx_discarded_frms;
357 *ptr++ = xmac_stats->aggr_stats[k].tx_errored_frms;
358 *ptr++ = xmac_stats->aggr_stats[k].rx_frms;
359 *ptr++ = xmac_stats->aggr_stats[k].rx_data_octets;
360 *ptr++ = xmac_stats->aggr_stats[k].rx_mcast_frms;
361 *ptr++ = xmac_stats->aggr_stats[k].rx_bcast_frms;
362 *ptr++ = xmac_stats->aggr_stats[k].rx_discarded_frms;
363 *ptr++ = xmac_stats->aggr_stats[k].rx_errored_frms;
364 *ptr++ = xmac_stats->aggr_stats[k].rx_unknown_slow_proto_frms;
365 }
366 *ptr++ = 0;
367 for (k = 0; k < vdev->max_config_port; k++) {
368 *ptr++ = xmac_stats->port_stats[k].tx_ttl_frms;
369 *ptr++ = xmac_stats->port_stats[k].tx_ttl_octets;
370 *ptr++ = xmac_stats->port_stats[k].tx_data_octets;
371 *ptr++ = xmac_stats->port_stats[k].tx_mcast_frms;
372 *ptr++ = xmac_stats->port_stats[k].tx_bcast_frms;
373 *ptr++ = xmac_stats->port_stats[k].tx_ucast_frms;
374 *ptr++ = xmac_stats->port_stats[k].tx_tagged_frms;
375 *ptr++ = xmac_stats->port_stats[k].tx_vld_ip;
376 *ptr++ = xmac_stats->port_stats[k].tx_vld_ip_octets;
377 *ptr++ = xmac_stats->port_stats[k].tx_icmp;
378 *ptr++ = xmac_stats->port_stats[k].tx_tcp;
379 *ptr++ = xmac_stats->port_stats[k].tx_rst_tcp;
380 *ptr++ = xmac_stats->port_stats[k].tx_udp;
381 *ptr++ = xmac_stats->port_stats[k].tx_parse_error;
382 *ptr++ = xmac_stats->port_stats[k].tx_unknown_protocol;
383 *ptr++ = xmac_stats->port_stats[k].tx_pause_ctrl_frms;
384 *ptr++ = xmac_stats->port_stats[k].tx_marker_pdu_frms;
385 *ptr++ = xmac_stats->port_stats[k].tx_lacpdu_frms;
386 *ptr++ = xmac_stats->port_stats[k].tx_drop_ip;
387 *ptr++ = xmac_stats->port_stats[k].tx_marker_resp_pdu_frms;
388 *ptr++ = xmac_stats->port_stats[k].tx_xgmii_char2_match;
389 *ptr++ = xmac_stats->port_stats[k].tx_xgmii_char1_match;
390 *ptr++ = xmac_stats->port_stats[k].tx_xgmii_column2_match;
391 *ptr++ = xmac_stats->port_stats[k].tx_xgmii_column1_match;
392 *ptr++ = xmac_stats->port_stats[k].tx_any_err_frms;
393 *ptr++ = xmac_stats->port_stats[k].tx_drop_frms;
394 *ptr++ = xmac_stats->port_stats[k].rx_ttl_frms;
395 *ptr++ = xmac_stats->port_stats[k].rx_vld_frms;
396 *ptr++ = xmac_stats->port_stats[k].rx_offload_frms;
397 *ptr++ = xmac_stats->port_stats[k].rx_ttl_octets;
398 *ptr++ = xmac_stats->port_stats[k].rx_data_octets;
399 *ptr++ = xmac_stats->port_stats[k].rx_offload_octets;
400 *ptr++ = xmac_stats->port_stats[k].rx_vld_mcast_frms;
401 *ptr++ = xmac_stats->port_stats[k].rx_vld_bcast_frms;
402 *ptr++ = xmac_stats->port_stats[k].rx_accepted_ucast_frms;
403 *ptr++ = xmac_stats->port_stats[k].rx_accepted_nucast_frms;
404 *ptr++ = xmac_stats->port_stats[k].rx_tagged_frms;
405 *ptr++ = xmac_stats->port_stats[k].rx_long_frms;
406 *ptr++ = xmac_stats->port_stats[k].rx_usized_frms;
407 *ptr++ = xmac_stats->port_stats[k].rx_osized_frms;
408 *ptr++ = xmac_stats->port_stats[k].rx_frag_frms;
409 *ptr++ = xmac_stats->port_stats[k].rx_jabber_frms;
410 *ptr++ = xmac_stats->port_stats[k].rx_ttl_64_frms;
411 *ptr++ = xmac_stats->port_stats[k].rx_ttl_65_127_frms;
412 *ptr++ = xmac_stats->port_stats[k].rx_ttl_128_255_frms;
413 *ptr++ = xmac_stats->port_stats[k].rx_ttl_256_511_frms;
414 *ptr++ = xmac_stats->port_stats[k].rx_ttl_512_1023_frms;
415 *ptr++ = xmac_stats->port_stats[k].rx_ttl_1024_1518_frms;
416 *ptr++ = xmac_stats->port_stats[k].rx_ttl_1519_4095_frms;
417 *ptr++ = xmac_stats->port_stats[k].rx_ttl_4096_8191_frms;
418 *ptr++ = xmac_stats->port_stats[k].rx_ttl_8192_max_frms;
419 *ptr++ = xmac_stats->port_stats[k].rx_ttl_gt_max_frms;
420 *ptr++ = xmac_stats->port_stats[k].rx_ip;
421 *ptr++ = xmac_stats->port_stats[k].rx_accepted_ip;
422 *ptr++ = xmac_stats->port_stats[k].rx_ip_octets;
423 *ptr++ = xmac_stats->port_stats[k].rx_err_ip;
424 *ptr++ = xmac_stats->port_stats[k].rx_icmp;
425 *ptr++ = xmac_stats->port_stats[k].rx_tcp;
426 *ptr++ = xmac_stats->port_stats[k].rx_udp;
427 *ptr++ = xmac_stats->port_stats[k].rx_err_tcp;
428 *ptr++ = xmac_stats->port_stats[k].rx_pause_count;
429 *ptr++ = xmac_stats->port_stats[k].rx_pause_ctrl_frms;
430 *ptr++ = xmac_stats->port_stats[k].rx_unsup_ctrl_frms;
431 *ptr++ = xmac_stats->port_stats[k].rx_fcs_err_frms;
432 *ptr++ = xmac_stats->port_stats[k].rx_in_rng_len_err_frms;
433 *ptr++ = xmac_stats->port_stats[k].rx_out_rng_len_err_frms;
434 *ptr++ = xmac_stats->port_stats[k].rx_drop_frms;
435 *ptr++ = xmac_stats->port_stats[k].rx_discarded_frms;
436 *ptr++ = xmac_stats->port_stats[k].rx_drop_ip;
437 *ptr++ = xmac_stats->port_stats[k].rx_drop_udp;
438 *ptr++ = xmac_stats->port_stats[k].rx_marker_pdu_frms;
439 *ptr++ = xmac_stats->port_stats[k].rx_lacpdu_frms;
440 *ptr++ = xmac_stats->port_stats[k].rx_unknown_pdu_frms;
441 *ptr++ = xmac_stats->port_stats[k].rx_marker_resp_pdu_frms;
442 *ptr++ = xmac_stats->port_stats[k].rx_fcs_discard;
443 *ptr++ = xmac_stats->port_stats[k].rx_illegal_pdu_frms;
444 *ptr++ = xmac_stats->port_stats[k].rx_switch_discard;
445 *ptr++ = xmac_stats->port_stats[k].rx_len_discard;
446 *ptr++ = xmac_stats->port_stats[k].rx_rpa_discard;
447 *ptr++ = xmac_stats->port_stats[k].rx_l2_mgmt_discard;
448 *ptr++ = xmac_stats->port_stats[k].rx_rts_discard;
449 *ptr++ = xmac_stats->port_stats[k].rx_trash_discard;
450 *ptr++ = xmac_stats->port_stats[k].rx_buff_full_discard;
451 *ptr++ = xmac_stats->port_stats[k].rx_red_discard;
452 *ptr++ = xmac_stats->port_stats[k].rx_xgmii_ctrl_err_cnt;
453 *ptr++ = xmac_stats->port_stats[k].rx_xgmii_data_err_cnt;
454 *ptr++ = xmac_stats->port_stats[k].rx_xgmii_char1_match;
455 *ptr++ = xmac_stats->port_stats[k].rx_xgmii_err_sym;
456 *ptr++ = xmac_stats->port_stats[k].rx_xgmii_column1_match;
457 *ptr++ = xmac_stats->port_stats[k].rx_xgmii_char2_match;
458 *ptr++ = xmac_stats->port_stats[k].rx_local_fault;
459 *ptr++ = xmac_stats->port_stats[k].rx_xgmii_column2_match;
460 *ptr++ = xmac_stats->port_stats[k].rx_jettison;
461 *ptr++ = xmac_stats->port_stats[k].rx_remote_fault;
462 }
463
464 *ptr++ = 0;
465 for (k = 0; k < vdev->no_of_vpath; k++) {
466 struct vxge_hw_vpath_stats_sw_info *vpath_info;
467
468 vpath = &vdev->vpaths[k];
469 j = vpath->device_id;
470 vpath_info = (struct vxge_hw_vpath_stats_sw_info *)
471 &sw_stats->vpath_info[j];
472 *ptr++ = vpath_info->soft_reset_cnt;
473 *ptr++ = vpath_info->error_stats.unknown_alarms;
474 *ptr++ = vpath_info->error_stats.network_sustained_fault;
475 *ptr++ = vpath_info->error_stats.network_sustained_ok;
476 *ptr++ = vpath_info->error_stats.kdfcctl_fifo0_overwrite;
477 *ptr++ = vpath_info->error_stats.kdfcctl_fifo0_poison;
478 *ptr++ = vpath_info->error_stats.kdfcctl_fifo0_dma_error;
479 *ptr++ = vpath_info->error_stats.dblgen_fifo0_overflow;
480 *ptr++ = vpath_info->error_stats.statsb_pif_chain_error;
481 *ptr++ = vpath_info->error_stats.statsb_drop_timeout;
482 *ptr++ = vpath_info->error_stats.target_illegal_access;
483 *ptr++ = vpath_info->error_stats.ini_serr_det;
484 *ptr++ = vpath_info->error_stats.prc_ring_bumps;
485 *ptr++ = vpath_info->error_stats.prc_rxdcm_sc_err;
486 *ptr++ = vpath_info->error_stats.prc_rxdcm_sc_abort;
487 *ptr++ = vpath_info->error_stats.prc_quanta_size_err;
488 *ptr++ = vpath_info->ring_stats.common_stats.full_cnt;
489 *ptr++ = vpath_info->ring_stats.common_stats.usage_cnt;
490 *ptr++ = vpath_info->ring_stats.common_stats.usage_max;
491 *ptr++ = vpath_info->ring_stats.common_stats.
492 reserve_free_swaps_cnt;
493 *ptr++ = vpath_info->ring_stats.common_stats.total_compl_cnt;
494 for (j = 0; j < VXGE_HW_DTR_MAX_T_CODE; j++)
495 *ptr++ = vpath_info->ring_stats.rxd_t_code_err_cnt[j];
496 *ptr++ = vpath_info->fifo_stats.common_stats.full_cnt;
497 *ptr++ = vpath_info->fifo_stats.common_stats.usage_cnt;
498 *ptr++ = vpath_info->fifo_stats.common_stats.usage_max;
499 *ptr++ = vpath_info->fifo_stats.common_stats.
500 reserve_free_swaps_cnt;
501 *ptr++ = vpath_info->fifo_stats.common_stats.total_compl_cnt;
502 *ptr++ = vpath_info->fifo_stats.total_posts;
503 *ptr++ = vpath_info->fifo_stats.total_buffers;
504 for (j = 0; j < VXGE_HW_DTR_MAX_T_CODE; j++)
505 *ptr++ = vpath_info->fifo_stats.txd_t_code_err_cnt[j];
506 }
507
508 *ptr++ = 0;
509 for (k = 0; k < vdev->no_of_vpath; k++) {
510 struct vxge_hw_vpath_stats_hw_info *vpath_info;
511 vpath = &vdev->vpaths[k];
512 j = vpath->device_id;
513 vpath_info = hw_stats->vpath_info[j];
514 if (!vpath_info) {
515 memset(ptr, 0, VXGE_HW_VPATH_STATS_LEN * sizeof(u64));
516 ptr += VXGE_HW_VPATH_STATS_LEN;
517 continue;
518 }
519 *ptr++ = vpath_info->ini_num_mwr_sent;
520 *ptr++ = vpath_info->ini_num_mrd_sent;
521 *ptr++ = vpath_info->ini_num_cpl_rcvd;
522 *ptr++ = vpath_info->ini_num_mwr_byte_sent;
523 *ptr++ = vpath_info->ini_num_cpl_byte_rcvd;
524 *ptr++ = vpath_info->wrcrdtarb_xoff;
525 *ptr++ = vpath_info->rdcrdtarb_xoff;
526 *ptr++ = vpath_info->vpath_genstats_count0;
527 *ptr++ = vpath_info->vpath_genstats_count1;
528 *ptr++ = vpath_info->vpath_genstats_count2;
529 *ptr++ = vpath_info->vpath_genstats_count3;
530 *ptr++ = vpath_info->vpath_genstats_count4;
531 *ptr++ = vpath_info->vpath_genstats_count5;
532 *ptr++ = vpath_info->prog_event_vnum0;
533 *ptr++ = vpath_info->prog_event_vnum1;
534 *ptr++ = vpath_info->prog_event_vnum2;
535 *ptr++ = vpath_info->prog_event_vnum3;
536 *ptr++ = vpath_info->rx_multi_cast_frame_discard;
537 *ptr++ = vpath_info->rx_frm_transferred;
538 *ptr++ = vpath_info->rxd_returned;
539 *ptr++ = vpath_info->rx_mpa_len_fail_frms;
540 *ptr++ = vpath_info->rx_mpa_mrk_fail_frms;
541 *ptr++ = vpath_info->rx_mpa_crc_fail_frms;
542 *ptr++ = vpath_info->rx_permitted_frms;
543 *ptr++ = vpath_info->rx_vp_reset_discarded_frms;
544 *ptr++ = vpath_info->rx_wol_frms;
545 *ptr++ = vpath_info->tx_vp_reset_discarded_frms;
546 }
547
548 *ptr++ = 0;
549 *ptr++ = vdev->stats.vpaths_open;
550 *ptr++ = vdev->stats.vpath_open_fail;
551 *ptr++ = vdev->stats.link_up;
552 *ptr++ = vdev->stats.link_down;
553
554 for (k = 0; k < vdev->no_of_vpath; k++) {
555 *ptr += vdev->vpaths[k].fifo.stats.tx_frms;
556 *(ptr + 1) += vdev->vpaths[k].fifo.stats.tx_errors;
557 *(ptr + 2) += vdev->vpaths[k].fifo.stats.tx_bytes;
558 *(ptr + 3) += vdev->vpaths[k].fifo.stats.txd_not_free;
559 *(ptr + 4) += vdev->vpaths[k].fifo.stats.txd_out_of_desc;
560 *(ptr + 5) += vdev->vpaths[k].ring.stats.rx_frms;
561 *(ptr + 6) += vdev->vpaths[k].ring.stats.rx_errors;
562 *(ptr + 7) += vdev->vpaths[k].ring.stats.rx_bytes;
563 *(ptr + 8) += vdev->vpaths[k].ring.stats.rx_mcast;
564 *(ptr + 9) += vdev->vpaths[k].fifo.stats.pci_map_fail +
565 vdev->vpaths[k].ring.stats.pci_map_fail;
566 *(ptr + 10) += vdev->vpaths[k].ring.stats.skb_alloc_fail;
567 }
568
569 ptr += 12;
570
571 kfree(xmac_stats);
572 kfree(sw_stats);
573 kfree(hw_stats);
574}
575
576static void vxge_ethtool_get_strings(struct net_device *dev,
577 u32 stringset, u8 *data)
578{
579 int stat_size = 0;
580 int i, j;
581 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
582 switch (stringset) {
583 case ETH_SS_STATS:
584 vxge_add_string("VPATH STATISTICS%s\t\t\t",
585 &stat_size, data, "");
586 for (i = 0; i < vdev->no_of_vpath; i++) {
587 vxge_add_string("tx_ttl_eth_frms_%d\t\t\t",
588 &stat_size, data, i);
589 vxge_add_string("tx_ttl_eth_octects_%d\t\t",
590 &stat_size, data, i);
591 vxge_add_string("tx_data_octects_%d\t\t\t",
592 &stat_size, data, i);
593 vxge_add_string("tx_mcast_frms_%d\t\t\t",
594 &stat_size, data, i);
595 vxge_add_string("tx_bcast_frms_%d\t\t\t",
596 &stat_size, data, i);
597 vxge_add_string("tx_ucast_frms_%d\t\t\t",
598 &stat_size, data, i);
599 vxge_add_string("tx_tagged_frms_%d\t\t\t",
600 &stat_size, data, i);
601 vxge_add_string("tx_vld_ip_%d\t\t\t",
602 &stat_size, data, i);
603 vxge_add_string("tx_vld_ip_octects_%d\t\t",
604 &stat_size, data, i);
605 vxge_add_string("tx_icmp_%d\t\t\t\t",
606 &stat_size, data, i);
607 vxge_add_string("tx_tcp_%d\t\t\t\t",
608 &stat_size, data, i);
609 vxge_add_string("tx_rst_tcp_%d\t\t\t",
610 &stat_size, data, i);
611 vxge_add_string("tx_udp_%d\t\t\t\t",
612 &stat_size, data, i);
613 vxge_add_string("tx_unknown_proto_%d\t\t\t",
614 &stat_size, data, i);
615 vxge_add_string("tx_lost_ip_%d\t\t\t",
616 &stat_size, data, i);
617 vxge_add_string("tx_parse_error_%d\t\t\t",
618 &stat_size, data, i);
619 vxge_add_string("tx_tcp_offload_%d\t\t\t",
620 &stat_size, data, i);
621 vxge_add_string("tx_retx_tcp_offload_%d\t\t",
622 &stat_size, data, i);
623 vxge_add_string("tx_lost_ip_offload_%d\t\t",
624 &stat_size, data, i);
625 vxge_add_string("rx_ttl_eth_frms_%d\t\t\t",
626 &stat_size, data, i);
627 vxge_add_string("rx_vld_frms_%d\t\t\t",
628 &stat_size, data, i);
629 vxge_add_string("rx_offload_frms_%d\t\t\t",
630 &stat_size, data, i);
631 vxge_add_string("rx_ttl_eth_octects_%d\t\t",
632 &stat_size, data, i);
633 vxge_add_string("rx_data_octects_%d\t\t\t",
634 &stat_size, data, i);
635 vxge_add_string("rx_offload_octects_%d\t\t",
636 &stat_size, data, i);
637 vxge_add_string("rx_vld_mcast_frms_%d\t\t",
638 &stat_size, data, i);
639 vxge_add_string("rx_vld_bcast_frms_%d\t\t",
640 &stat_size, data, i);
641 vxge_add_string("rx_accepted_ucast_frms_%d\t\t",
642 &stat_size, data, i);
643 vxge_add_string("rx_accepted_nucast_frms_%d\t\t",
644 &stat_size, data, i);
645 vxge_add_string("rx_tagged_frms_%d\t\t\t",
646 &stat_size, data, i);
647 vxge_add_string("rx_long_frms_%d\t\t\t",
648 &stat_size, data, i);
649 vxge_add_string("rx_usized_frms_%d\t\t\t",
650 &stat_size, data, i);
651 vxge_add_string("rx_osized_frms_%d\t\t\t",
652 &stat_size, data, i);
653 vxge_add_string("rx_frag_frms_%d\t\t\t",
654 &stat_size, data, i);
655 vxge_add_string("rx_jabber_frms_%d\t\t\t",
656 &stat_size, data, i);
657 vxge_add_string("rx_ttl_64_frms_%d\t\t\t",
658 &stat_size, data, i);
659 vxge_add_string("rx_ttl_65_127_frms_%d\t\t",
660 &stat_size, data, i);
661 vxge_add_string("rx_ttl_128_255_frms_%d\t\t",
662 &stat_size, data, i);
663 vxge_add_string("rx_ttl_256_511_frms_%d\t\t",
664 &stat_size, data, i);
665 vxge_add_string("rx_ttl_512_1023_frms_%d\t\t",
666 &stat_size, data, i);
667 vxge_add_string("rx_ttl_1024_1518_frms_%d\t\t",
668 &stat_size, data, i);
669 vxge_add_string("rx_ttl_1519_4095_frms_%d\t\t",
670 &stat_size, data, i);
671 vxge_add_string("rx_ttl_4096_8191_frms_%d\t\t",
672 &stat_size, data, i);
673 vxge_add_string("rx_ttl_8192_max_frms_%d\t\t",
674 &stat_size, data, i);
675 vxge_add_string("rx_ttl_gt_max_frms_%d\t\t",
676 &stat_size, data, i);
677 vxge_add_string("rx_ip%d\t\t\t\t",
678 &stat_size, data, i);
679 vxge_add_string("rx_accepted_ip_%d\t\t\t",
680 &stat_size, data, i);
681 vxge_add_string("rx_ip_octects_%d\t\t\t",
682 &stat_size, data, i);
683 vxge_add_string("rx_err_ip_%d\t\t\t",
684 &stat_size, data, i);
685 vxge_add_string("rx_icmp_%d\t\t\t\t",
686 &stat_size, data, i);
687 vxge_add_string("rx_tcp_%d\t\t\t\t",
688 &stat_size, data, i);
689 vxge_add_string("rx_udp_%d\t\t\t\t",
690 &stat_size, data, i);
691 vxge_add_string("rx_err_tcp_%d\t\t\t",
692 &stat_size, data, i);
693 vxge_add_string("rx_lost_frms_%d\t\t\t",
694 &stat_size, data, i);
695 vxge_add_string("rx_lost_ip_%d\t\t\t",
696 &stat_size, data, i);
697 vxge_add_string("rx_lost_ip_offload_%d\t\t",
698 &stat_size, data, i);
699 vxge_add_string("rx_various_discard_%d\t\t",
700 &stat_size, data, i);
701 vxge_add_string("rx_sleep_discard_%d\t\t\t",
702 &stat_size, data, i);
703 vxge_add_string("rx_red_discard_%d\t\t\t",
704 &stat_size, data, i);
705 vxge_add_string("rx_queue_full_discard_%d\t\t",
706 &stat_size, data, i);
707 vxge_add_string("rx_mpa_ok_frms_%d\t\t\t",
708 &stat_size, data, i);
709 }
710
711 vxge_add_string("\nAGGR STATISTICS%s\t\t\t\t",
712 &stat_size, data, "");
713 for (i = 0; i < vdev->max_config_port; i++) {
714 vxge_add_string("tx_frms_%d\t\t\t\t",
715 &stat_size, data, i);
716 vxge_add_string("tx_data_octects_%d\t\t\t",
717 &stat_size, data, i);
718 vxge_add_string("tx_mcast_frms_%d\t\t\t",
719 &stat_size, data, i);
720 vxge_add_string("tx_bcast_frms_%d\t\t\t",
721 &stat_size, data, i);
722 vxge_add_string("tx_discarded_frms_%d\t\t",
723 &stat_size, data, i);
724 vxge_add_string("tx_errored_frms_%d\t\t\t",
725 &stat_size, data, i);
726 vxge_add_string("rx_frms_%d\t\t\t\t",
727 &stat_size, data, i);
728 vxge_add_string("rx_data_octects_%d\t\t\t",
729 &stat_size, data, i);
730 vxge_add_string("rx_mcast_frms_%d\t\t\t",
731 &stat_size, data, i);
732 vxge_add_string("rx_bcast_frms_%d\t\t\t",
733 &stat_size, data, i);
734 vxge_add_string("rx_discarded_frms_%d\t\t",
735 &stat_size, data, i);
736 vxge_add_string("rx_errored_frms_%d\t\t\t",
737 &stat_size, data, i);
738 vxge_add_string("rx_unknown_slow_proto_frms_%d\t",
739 &stat_size, data, i);
740 }
741
742 vxge_add_string("\nPORT STATISTICS%s\t\t\t\t",
743 &stat_size, data, "");
744 for (i = 0; i < vdev->max_config_port; i++) {
745 vxge_add_string("tx_ttl_frms_%d\t\t\t",
746 &stat_size, data, i);
747 vxge_add_string("tx_ttl_octects_%d\t\t\t",
748 &stat_size, data, i);
749 vxge_add_string("tx_data_octects_%d\t\t\t",
750 &stat_size, data, i);
751 vxge_add_string("tx_mcast_frms_%d\t\t\t",
752 &stat_size, data, i);
753 vxge_add_string("tx_bcast_frms_%d\t\t\t",
754 &stat_size, data, i);
755 vxge_add_string("tx_ucast_frms_%d\t\t\t",
756 &stat_size, data, i);
757 vxge_add_string("tx_tagged_frms_%d\t\t\t",
758 &stat_size, data, i);
759 vxge_add_string("tx_vld_ip_%d\t\t\t",
760 &stat_size, data, i);
761 vxge_add_string("tx_vld_ip_octects_%d\t\t",
762 &stat_size, data, i);
763 vxge_add_string("tx_icmp_%d\t\t\t\t",
764 &stat_size, data, i);
765 vxge_add_string("tx_tcp_%d\t\t\t\t",
766 &stat_size, data, i);
767 vxge_add_string("tx_rst_tcp_%d\t\t\t",
768 &stat_size, data, i);
769 vxge_add_string("tx_udp_%d\t\t\t\t",
770 &stat_size, data, i);
771 vxge_add_string("tx_parse_error_%d\t\t\t",
772 &stat_size, data, i);
773 vxge_add_string("tx_unknown_protocol_%d\t\t",
774 &stat_size, data, i);
775 vxge_add_string("tx_pause_ctrl_frms_%d\t\t",
776 &stat_size, data, i);
777 vxge_add_string("tx_marker_pdu_frms_%d\t\t",
778 &stat_size, data, i);
779 vxge_add_string("tx_lacpdu_frms_%d\t\t\t",
780 &stat_size, data, i);
781 vxge_add_string("tx_drop_ip_%d\t\t\t",
782 &stat_size, data, i);
783 vxge_add_string("tx_marker_resp_pdu_frms_%d\t\t",
784 &stat_size, data, i);
785 vxge_add_string("tx_xgmii_char2_match_%d\t\t",
786 &stat_size, data, i);
787 vxge_add_string("tx_xgmii_char1_match_%d\t\t",
788 &stat_size, data, i);
789 vxge_add_string("tx_xgmii_column2_match_%d\t\t",
790 &stat_size, data, i);
791 vxge_add_string("tx_xgmii_column1_match_%d\t\t",
792 &stat_size, data, i);
793 vxge_add_string("tx_any_err_frms_%d\t\t\t",
794 &stat_size, data, i);
795 vxge_add_string("tx_drop_frms_%d\t\t\t",
796 &stat_size, data, i);
797 vxge_add_string("rx_ttl_frms_%d\t\t\t",
798 &stat_size, data, i);
799 vxge_add_string("rx_vld_frms_%d\t\t\t",
800 &stat_size, data, i);
801 vxge_add_string("rx_offload_frms_%d\t\t\t",
802 &stat_size, data, i);
803 vxge_add_string("rx_ttl_octects_%d\t\t\t",
804 &stat_size, data, i);
805 vxge_add_string("rx_data_octects_%d\t\t\t",
806 &stat_size, data, i);
807 vxge_add_string("rx_offload_octects_%d\t\t",
808 &stat_size, data, i);
809 vxge_add_string("rx_vld_mcast_frms_%d\t\t",
810 &stat_size, data, i);
811 vxge_add_string("rx_vld_bcast_frms_%d\t\t",
812 &stat_size, data, i);
813 vxge_add_string("rx_accepted_ucast_frms_%d\t\t",
814 &stat_size, data, i);
815 vxge_add_string("rx_accepted_nucast_frms_%d\t\t",
816 &stat_size, data, i);
817 vxge_add_string("rx_tagged_frms_%d\t\t\t",
818 &stat_size, data, i);
819 vxge_add_string("rx_long_frms_%d\t\t\t",
820 &stat_size, data, i);
821 vxge_add_string("rx_usized_frms_%d\t\t\t",
822 &stat_size, data, i);
823 vxge_add_string("rx_osized_frms_%d\t\t\t",
824 &stat_size, data, i);
825 vxge_add_string("rx_frag_frms_%d\t\t\t",
826 &stat_size, data, i);
827 vxge_add_string("rx_jabber_frms_%d\t\t\t",
828 &stat_size, data, i);
829 vxge_add_string("rx_ttl_64_frms_%d\t\t\t",
830 &stat_size, data, i);
831 vxge_add_string("rx_ttl_65_127_frms_%d\t\t",
832 &stat_size, data, i);
833 vxge_add_string("rx_ttl_128_255_frms_%d\t\t",
834 &stat_size, data, i);
835 vxge_add_string("rx_ttl_256_511_frms_%d\t\t",
836 &stat_size, data, i);
837 vxge_add_string("rx_ttl_512_1023_frms_%d\t\t",
838 &stat_size, data, i);
839 vxge_add_string("rx_ttl_1024_1518_frms_%d\t\t",
840 &stat_size, data, i);
841 vxge_add_string("rx_ttl_1519_4095_frms_%d\t\t",
842 &stat_size, data, i);
843 vxge_add_string("rx_ttl_4096_8191_frms_%d\t\t",
844 &stat_size, data, i);
845 vxge_add_string("rx_ttl_8192_max_frms_%d\t\t",
846 &stat_size, data, i);
847 vxge_add_string("rx_ttl_gt_max_frms_%d\t\t",
848 &stat_size, data, i);
849 vxge_add_string("rx_ip_%d\t\t\t\t",
850 &stat_size, data, i);
851 vxge_add_string("rx_accepted_ip_%d\t\t\t",
852 &stat_size, data, i);
853 vxge_add_string("rx_ip_octets_%d\t\t\t",
854 &stat_size, data, i);
855 vxge_add_string("rx_err_ip_%d\t\t\t",
856 &stat_size, data, i);
857 vxge_add_string("rx_icmp_%d\t\t\t\t",
858 &stat_size, data, i);
859 vxge_add_string("rx_tcp_%d\t\t\t\t",
860 &stat_size, data, i);
861 vxge_add_string("rx_udp_%d\t\t\t\t",
862 &stat_size, data, i);
863 vxge_add_string("rx_err_tcp_%d\t\t\t",
864 &stat_size, data, i);
865 vxge_add_string("rx_pause_count_%d\t\t\t",
866 &stat_size, data, i);
867 vxge_add_string("rx_pause_ctrl_frms_%d\t\t",
868 &stat_size, data, i);
869 vxge_add_string("rx_unsup_ctrl_frms_%d\t\t",
870 &stat_size, data, i);
871 vxge_add_string("rx_fcs_err_frms_%d\t\t\t",
872 &stat_size, data, i);
873 vxge_add_string("rx_in_rng_len_err_frms_%d\t\t",
874 &stat_size, data, i);
875 vxge_add_string("rx_out_rng_len_err_frms_%d\t\t",
876 &stat_size, data, i);
877 vxge_add_string("rx_drop_frms_%d\t\t\t",
878 &stat_size, data, i);
879 vxge_add_string("rx_discard_frms_%d\t\t\t",
880 &stat_size, data, i);
881 vxge_add_string("rx_drop_ip_%d\t\t\t",
882 &stat_size, data, i);
883 vxge_add_string("rx_drop_udp_%d\t\t\t",
884 &stat_size, data, i);
885 vxge_add_string("rx_marker_pdu_frms_%d\t\t",
886 &stat_size, data, i);
887 vxge_add_string("rx_lacpdu_frms_%d\t\t\t",
888 &stat_size, data, i);
889 vxge_add_string("rx_unknown_pdu_frms_%d\t\t",
890 &stat_size, data, i);
891 vxge_add_string("rx_marker_resp_pdu_frms_%d\t\t",
892 &stat_size, data, i);
893 vxge_add_string("rx_fcs_discard_%d\t\t\t",
894 &stat_size, data, i);
895 vxge_add_string("rx_illegal_pdu_frms_%d\t\t",
896 &stat_size, data, i);
897 vxge_add_string("rx_switch_discard_%d\t\t",
898 &stat_size, data, i);
899 vxge_add_string("rx_len_discard_%d\t\t\t",
900 &stat_size, data, i);
901 vxge_add_string("rx_rpa_discard_%d\t\t\t",
902 &stat_size, data, i);
903 vxge_add_string("rx_l2_mgmt_discard_%d\t\t",
904 &stat_size, data, i);
905 vxge_add_string("rx_rts_discard_%d\t\t\t",
906 &stat_size, data, i);
907 vxge_add_string("rx_trash_discard_%d\t\t\t",
908 &stat_size, data, i);
909 vxge_add_string("rx_buff_full_discard_%d\t\t",
910 &stat_size, data, i);
911 vxge_add_string("rx_red_discard_%d\t\t\t",
912 &stat_size, data, i);
913 vxge_add_string("rx_xgmii_ctrl_err_cnt_%d\t\t",
914 &stat_size, data, i);
915 vxge_add_string("rx_xgmii_data_err_cnt_%d\t\t",
916 &stat_size, data, i);
917 vxge_add_string("rx_xgmii_char1_match_%d\t\t",
918 &stat_size, data, i);
919 vxge_add_string("rx_xgmii_err_sym_%d\t\t\t",
920 &stat_size, data, i);
921 vxge_add_string("rx_xgmii_column1_match_%d\t\t",
922 &stat_size, data, i);
923 vxge_add_string("rx_xgmii_char2_match_%d\t\t",
924 &stat_size, data, i);
925 vxge_add_string("rx_local_fault_%d\t\t\t",
926 &stat_size, data, i);
927 vxge_add_string("rx_xgmii_column2_match_%d\t\t",
928 &stat_size, data, i);
929 vxge_add_string("rx_jettison_%d\t\t\t",
930 &stat_size, data, i);
931 vxge_add_string("rx_remote_fault_%d\t\t\t",
932 &stat_size, data, i);
933 }
934
935 vxge_add_string("\n SOFTWARE STATISTICS%s\t\t\t",
936 &stat_size, data, "");
937 for (i = 0; i < vdev->no_of_vpath; i++) {
938 vxge_add_string("soft_reset_cnt_%d\t\t\t",
939 &stat_size, data, i);
940 vxge_add_string("unknown_alarms_%d\t\t\t",
941 &stat_size, data, i);
942 vxge_add_string("network_sustained_fault_%d\t\t",
943 &stat_size, data, i);
944 vxge_add_string("network_sustained_ok_%d\t\t",
945 &stat_size, data, i);
946 vxge_add_string("kdfcctl_fifo0_overwrite_%d\t\t",
947 &stat_size, data, i);
948 vxge_add_string("kdfcctl_fifo0_poison_%d\t\t",
949 &stat_size, data, i);
950 vxge_add_string("kdfcctl_fifo0_dma_error_%d\t\t",
951 &stat_size, data, i);
952 vxge_add_string("dblgen_fifo0_overflow_%d\t\t",
953 &stat_size, data, i);
954 vxge_add_string("statsb_pif_chain_error_%d\t\t",
955 &stat_size, data, i);
956 vxge_add_string("statsb_drop_timeout_%d\t\t",
957 &stat_size, data, i);
958 vxge_add_string("target_illegal_access_%d\t\t",
959 &stat_size, data, i);
960 vxge_add_string("ini_serr_det_%d\t\t\t",
961 &stat_size, data, i);
962 vxge_add_string("prc_ring_bumps_%d\t\t\t",
963 &stat_size, data, i);
964 vxge_add_string("prc_rxdcm_sc_err_%d\t\t\t",
965 &stat_size, data, i);
966 vxge_add_string("prc_rxdcm_sc_abort_%d\t\t",
967 &stat_size, data, i);
968 vxge_add_string("prc_quanta_size_err_%d\t\t",
969 &stat_size, data, i);
970 vxge_add_string("ring_full_cnt_%d\t\t\t",
971 &stat_size, data, i);
972 vxge_add_string("ring_usage_cnt_%d\t\t\t",
973 &stat_size, data, i);
974 vxge_add_string("ring_usage_max_%d\t\t\t",
975 &stat_size, data, i);
976 vxge_add_string("ring_reserve_free_swaps_cnt_%d\t",
977 &stat_size, data, i);
978 vxge_add_string("ring_total_compl_cnt_%d\t\t",
979 &stat_size, data, i);
980 for (j = 0; j < VXGE_HW_DTR_MAX_T_CODE; j++)
981 vxge_add_string("rxd_t_code_err_cnt%d_%d\t\t",
982 &stat_size, data, j, i);
983 vxge_add_string("fifo_full_cnt_%d\t\t\t",
984 &stat_size, data, i);
985 vxge_add_string("fifo_usage_cnt_%d\t\t\t",
986 &stat_size, data, i);
987 vxge_add_string("fifo_usage_max_%d\t\t\t",
988 &stat_size, data, i);
989 vxge_add_string("fifo_reserve_free_swaps_cnt_%d\t",
990 &stat_size, data, i);
991 vxge_add_string("fifo_total_compl_cnt_%d\t\t",
992 &stat_size, data, i);
993 vxge_add_string("fifo_total_posts_%d\t\t\t",
994 &stat_size, data, i);
995 vxge_add_string("fifo_total_buffers_%d\t\t",
996 &stat_size, data, i);
997 for (j = 0; j < VXGE_HW_DTR_MAX_T_CODE; j++)
998 vxge_add_string("txd_t_code_err_cnt%d_%d\t\t",
999 &stat_size, data, j, i);
1000 }
1001
1002 vxge_add_string("\n HARDWARE STATISTICS%s\t\t\t",
1003 &stat_size, data, "");
1004 for (i = 0; i < vdev->no_of_vpath; i++) {
1005 vxge_add_string("ini_num_mwr_sent_%d\t\t\t",
1006 &stat_size, data, i);
1007 vxge_add_string("ini_num_mrd_sent_%d\t\t\t",
1008 &stat_size, data, i);
1009 vxge_add_string("ini_num_cpl_rcvd_%d\t\t\t",
1010 &stat_size, data, i);
1011 vxge_add_string("ini_num_mwr_byte_sent_%d\t\t",
1012 &stat_size, data, i);
1013 vxge_add_string("ini_num_cpl_byte_rcvd_%d\t\t",
1014 &stat_size, data, i);
1015 vxge_add_string("wrcrdtarb_xoff_%d\t\t\t",
1016 &stat_size, data, i);
1017 vxge_add_string("rdcrdtarb_xoff_%d\t\t\t",
1018 &stat_size, data, i);
1019 vxge_add_string("vpath_genstats_count0_%d\t\t",
1020 &stat_size, data, i);
1021 vxge_add_string("vpath_genstats_count1_%d\t\t",
1022 &stat_size, data, i);
1023 vxge_add_string("vpath_genstats_count2_%d\t\t",
1024 &stat_size, data, i);
1025 vxge_add_string("vpath_genstats_count3_%d\t\t",
1026 &stat_size, data, i);
1027 vxge_add_string("vpath_genstats_count4_%d\t\t",
1028 &stat_size, data, i);
1029 vxge_add_string("vpath_genstats_count5_%d\t\t",
1030 &stat_size, data, i);
1031 vxge_add_string("prog_event_vnum0_%d\t\t\t",
1032 &stat_size, data, i);
1033 vxge_add_string("prog_event_vnum1_%d\t\t\t",
1034 &stat_size, data, i);
1035 vxge_add_string("prog_event_vnum2_%d\t\t\t",
1036 &stat_size, data, i);
1037 vxge_add_string("prog_event_vnum3_%d\t\t\t",
1038 &stat_size, data, i);
1039 vxge_add_string("rx_multi_cast_frame_discard_%d\t",
1040 &stat_size, data, i);
1041 vxge_add_string("rx_frm_transferred_%d\t\t",
1042 &stat_size, data, i);
1043 vxge_add_string("rxd_returned_%d\t\t\t",
1044 &stat_size, data, i);
1045 vxge_add_string("rx_mpa_len_fail_frms_%d\t\t",
1046 &stat_size, data, i);
1047 vxge_add_string("rx_mpa_mrk_fail_frms_%d\t\t",
1048 &stat_size, data, i);
1049 vxge_add_string("rx_mpa_crc_fail_frms_%d\t\t",
1050 &stat_size, data, i);
1051 vxge_add_string("rx_permitted_frms_%d\t\t",
1052 &stat_size, data, i);
1053 vxge_add_string("rx_vp_reset_discarded_frms_%d\t",
1054 &stat_size, data, i);
1055 vxge_add_string("rx_wol_frms_%d\t\t\t",
1056 &stat_size, data, i);
1057 vxge_add_string("tx_vp_reset_discarded_frms_%d\t",
1058 &stat_size, data, i);
1059 }
1060
1061 memcpy(data + stat_size, &ethtool_driver_stats_keys,
1062 sizeof(ethtool_driver_stats_keys));
1063 }
1064}
1065
1066static int vxge_ethtool_get_regs_len(struct net_device *dev)
1067{
1068 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
1069
1070 return sizeof(struct vxge_hw_vpath_reg) * vdev->no_of_vpath;
1071}
1072
1073static u32 vxge_get_rx_csum(struct net_device *dev)
1074{
1075 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
1076
1077 return vdev->rx_csum;
1078}
1079
1080static int vxge_set_rx_csum(struct net_device *dev, u32 data)
1081{
1082 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
1083
1084 if (data)
1085 vdev->rx_csum = 1;
1086 else
1087 vdev->rx_csum = 0;
1088
1089 return 0;
1090}
1091
1092static int vxge_ethtool_op_set_tso(struct net_device *dev, u32 data)
1093{
1094 if (data)
1095 dev->features |= (NETIF_F_TSO | NETIF_F_TSO6);
1096 else
1097 dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
1098
1099 return 0;
1100}
1101
1102static int vxge_ethtool_get_sset_count(struct net_device *dev, int sset)
1103{
1104 struct vxgedev *vdev = (struct vxgedev *)netdev_priv(dev);
1105
1106 switch (sset) {
1107 case ETH_SS_STATS:
1108 return VXGE_TITLE_LEN +
1109 (vdev->no_of_vpath * VXGE_HW_VPATH_STATS_LEN) +
1110 (vdev->max_config_port * VXGE_HW_AGGR_STATS_LEN) +
1111 (vdev->max_config_port * VXGE_HW_PORT_STATS_LEN) +
1112 (vdev->no_of_vpath * VXGE_HW_VPATH_TX_STATS_LEN) +
1113 (vdev->no_of_vpath * VXGE_HW_VPATH_RX_STATS_LEN) +
1114 (vdev->no_of_vpath * VXGE_SW_STATS_LEN) +
1115 DRIVER_STAT_LEN;
1116 default:
1117 return -EOPNOTSUPP;
1118 }
1119}
1120
1121static const struct ethtool_ops vxge_ethtool_ops = {
1122 .get_settings = vxge_ethtool_gset,
1123 .set_settings = vxge_ethtool_sset,
1124 .get_drvinfo = vxge_ethtool_gdrvinfo,
1125 .get_regs_len = vxge_ethtool_get_regs_len,
1126 .get_regs = vxge_ethtool_gregs,
1127 .get_link = ethtool_op_get_link,
1128 .get_pauseparam = vxge_ethtool_getpause_data,
1129 .set_pauseparam = vxge_ethtool_setpause_data,
1130 .get_rx_csum = vxge_get_rx_csum,
1131 .set_rx_csum = vxge_set_rx_csum,
1132 .get_tx_csum = ethtool_op_get_tx_csum,
1133 .set_tx_csum = ethtool_op_set_tx_hw_csum,
1134 .get_sg = ethtool_op_get_sg,
1135 .set_sg = ethtool_op_set_sg,
1136 .get_tso = ethtool_op_get_tso,
1137 .set_tso = vxge_ethtool_op_set_tso,
1138 .get_strings = vxge_ethtool_get_strings,
1139 .phys_id = vxge_ethtool_idnic,
1140 .get_sset_count = vxge_ethtool_get_sset_count,
1141 .get_ethtool_stats = vxge_get_ethtool_stats,
1142};
1143
1144void initialize_ethtool_ops(struct net_device *ndev)
1145{
1146 SET_ETHTOOL_OPS(ndev, &vxge_ethtool_ops);
1147}