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