diff options
Diffstat (limited to 'drivers/net/qlcnic/qlcnic_ethtool.c')
-rw-r--r-- | drivers/net/qlcnic/qlcnic_ethtool.c | 1015 |
1 files changed, 1015 insertions, 0 deletions
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c new file mode 100644 index 00000000000..8da6ec8c13b --- /dev/null +++ b/drivers/net/qlcnic/qlcnic_ethtool.c | |||
@@ -0,0 +1,1015 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2009 - QLogic Corporation. | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License | ||
7 | * as published by the Free Software Foundation; either version 2 | ||
8 | * of the License, or (at your option) any later version. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, | ||
18 | * MA 02111-1307, USA. | ||
19 | * | ||
20 | * The full GNU General Public License is included in this distribution | ||
21 | * in the file called "COPYING". | ||
22 | * | ||
23 | */ | ||
24 | |||
25 | #include <linux/types.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/pci.h> | ||
28 | #include <linux/io.h> | ||
29 | #include <linux/netdevice.h> | ||
30 | #include <linux/ethtool.h> | ||
31 | |||
32 | #include "qlcnic.h" | ||
33 | |||
34 | struct qlcnic_stats { | ||
35 | char stat_string[ETH_GSTRING_LEN]; | ||
36 | int sizeof_stat; | ||
37 | int stat_offset; | ||
38 | }; | ||
39 | |||
40 | #define QLC_SIZEOF(m) FIELD_SIZEOF(struct qlcnic_adapter, m) | ||
41 | #define QLC_OFF(m) offsetof(struct qlcnic_adapter, m) | ||
42 | |||
43 | static const struct qlcnic_stats qlcnic_gstrings_stats[] = { | ||
44 | {"xmit_called", | ||
45 | QLC_SIZEOF(stats.xmitcalled), QLC_OFF(stats.xmitcalled)}, | ||
46 | {"xmit_finished", | ||
47 | QLC_SIZEOF(stats.xmitfinished), QLC_OFF(stats.xmitfinished)}, | ||
48 | {"rx_dropped", | ||
49 | QLC_SIZEOF(stats.rxdropped), QLC_OFF(stats.rxdropped)}, | ||
50 | {"tx_dropped", | ||
51 | QLC_SIZEOF(stats.txdropped), QLC_OFF(stats.txdropped)}, | ||
52 | {"csummed", | ||
53 | QLC_SIZEOF(stats.csummed), QLC_OFF(stats.csummed)}, | ||
54 | {"rx_pkts", | ||
55 | QLC_SIZEOF(stats.rx_pkts), QLC_OFF(stats.rx_pkts)}, | ||
56 | {"lro_pkts", | ||
57 | QLC_SIZEOF(stats.lro_pkts), QLC_OFF(stats.lro_pkts)}, | ||
58 | {"rx_bytes", | ||
59 | QLC_SIZEOF(stats.rxbytes), QLC_OFF(stats.rxbytes)}, | ||
60 | {"tx_bytes", | ||
61 | QLC_SIZEOF(stats.txbytes), QLC_OFF(stats.txbytes)}, | ||
62 | }; | ||
63 | |||
64 | #define QLCNIC_STATS_LEN ARRAY_SIZE(qlcnic_gstrings_stats) | ||
65 | |||
66 | static const char qlcnic_gstrings_test[][ETH_GSTRING_LEN] = { | ||
67 | "Register_Test_on_offline", | ||
68 | "Link_Test_on_offline", | ||
69 | "Interrupt_Test_offline", | ||
70 | "Loopback_Test_offline" | ||
71 | }; | ||
72 | |||
73 | #define QLCNIC_TEST_LEN ARRAY_SIZE(qlcnic_gstrings_test) | ||
74 | |||
75 | #define QLCNIC_RING_REGS_COUNT 20 | ||
76 | #define QLCNIC_RING_REGS_LEN (QLCNIC_RING_REGS_COUNT * sizeof(u32)) | ||
77 | #define QLCNIC_MAX_EEPROM_LEN 1024 | ||
78 | |||
79 | static const u32 diag_registers[] = { | ||
80 | CRB_CMDPEG_STATE, | ||
81 | CRB_RCVPEG_STATE, | ||
82 | CRB_XG_STATE_P3, | ||
83 | CRB_FW_CAPABILITIES_1, | ||
84 | ISR_INT_STATE_REG, | ||
85 | QLCNIC_CRB_DEV_REF_COUNT, | ||
86 | QLCNIC_CRB_DEV_STATE, | ||
87 | QLCNIC_CRB_DRV_STATE, | ||
88 | QLCNIC_CRB_DRV_SCRATCH, | ||
89 | QLCNIC_CRB_DEV_PARTITION_INFO, | ||
90 | QLCNIC_CRB_DRV_IDC_VER, | ||
91 | QLCNIC_PEG_ALIVE_COUNTER, | ||
92 | QLCNIC_PEG_HALT_STATUS1, | ||
93 | QLCNIC_PEG_HALT_STATUS2, | ||
94 | QLCNIC_CRB_PEG_NET_0+0x3c, | ||
95 | QLCNIC_CRB_PEG_NET_1+0x3c, | ||
96 | QLCNIC_CRB_PEG_NET_2+0x3c, | ||
97 | QLCNIC_CRB_PEG_NET_4+0x3c, | ||
98 | -1 | ||
99 | }; | ||
100 | |||
101 | static int qlcnic_get_regs_len(struct net_device *dev) | ||
102 | { | ||
103 | return sizeof(diag_registers) + QLCNIC_RING_REGS_LEN; | ||
104 | } | ||
105 | |||
106 | static int qlcnic_get_eeprom_len(struct net_device *dev) | ||
107 | { | ||
108 | return QLCNIC_FLASH_TOTAL_SIZE; | ||
109 | } | ||
110 | |||
111 | static void | ||
112 | qlcnic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo) | ||
113 | { | ||
114 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
115 | u32 fw_major, fw_minor, fw_build; | ||
116 | |||
117 | fw_major = QLCRD32(adapter, QLCNIC_FW_VERSION_MAJOR); | ||
118 | fw_minor = QLCRD32(adapter, QLCNIC_FW_VERSION_MINOR); | ||
119 | fw_build = QLCRD32(adapter, QLCNIC_FW_VERSION_SUB); | ||
120 | sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); | ||
121 | |||
122 | strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), 32); | ||
123 | strlcpy(drvinfo->driver, qlcnic_driver_name, 32); | ||
124 | strlcpy(drvinfo->version, QLCNIC_LINUX_VERSIONID, 32); | ||
125 | } | ||
126 | |||
127 | static int | ||
128 | qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | ||
129 | { | ||
130 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
131 | int check_sfp_module = 0; | ||
132 | u16 pcifn = adapter->ahw.pci_func; | ||
133 | |||
134 | /* read which mode */ | ||
135 | if (adapter->ahw.port_type == QLCNIC_GBE) { | ||
136 | ecmd->supported = (SUPPORTED_10baseT_Half | | ||
137 | SUPPORTED_10baseT_Full | | ||
138 | SUPPORTED_100baseT_Half | | ||
139 | SUPPORTED_100baseT_Full | | ||
140 | SUPPORTED_1000baseT_Half | | ||
141 | SUPPORTED_1000baseT_Full); | ||
142 | |||
143 | ecmd->advertising = (ADVERTISED_100baseT_Half | | ||
144 | ADVERTISED_100baseT_Full | | ||
145 | ADVERTISED_1000baseT_Half | | ||
146 | ADVERTISED_1000baseT_Full); | ||
147 | |||
148 | ecmd->speed = adapter->link_speed; | ||
149 | ecmd->duplex = adapter->link_duplex; | ||
150 | ecmd->autoneg = adapter->link_autoneg; | ||
151 | |||
152 | } else if (adapter->ahw.port_type == QLCNIC_XGBE) { | ||
153 | u32 val; | ||
154 | |||
155 | val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); | ||
156 | if (val == QLCNIC_PORT_MODE_802_3_AP) { | ||
157 | ecmd->supported = SUPPORTED_1000baseT_Full; | ||
158 | ecmd->advertising = ADVERTISED_1000baseT_Full; | ||
159 | } else { | ||
160 | ecmd->supported = SUPPORTED_10000baseT_Full; | ||
161 | ecmd->advertising = ADVERTISED_10000baseT_Full; | ||
162 | } | ||
163 | |||
164 | if (netif_running(dev) && adapter->has_link_events) { | ||
165 | ecmd->speed = adapter->link_speed; | ||
166 | ecmd->autoneg = adapter->link_autoneg; | ||
167 | ecmd->duplex = adapter->link_duplex; | ||
168 | goto skip; | ||
169 | } | ||
170 | |||
171 | val = QLCRD32(adapter, P3_LINK_SPEED_REG(pcifn)); | ||
172 | ecmd->speed = P3_LINK_SPEED_MHZ * | ||
173 | P3_LINK_SPEED_VAL(pcifn, val); | ||
174 | ecmd->duplex = DUPLEX_FULL; | ||
175 | ecmd->autoneg = AUTONEG_DISABLE; | ||
176 | } else | ||
177 | return -EIO; | ||
178 | |||
179 | skip: | ||
180 | ecmd->phy_address = adapter->physical_port; | ||
181 | ecmd->transceiver = XCVR_EXTERNAL; | ||
182 | |||
183 | switch (adapter->ahw.board_type) { | ||
184 | case QLCNIC_BRDTYPE_P3_REF_QG: | ||
185 | case QLCNIC_BRDTYPE_P3_4_GB: | ||
186 | case QLCNIC_BRDTYPE_P3_4_GB_MM: | ||
187 | |||
188 | ecmd->supported |= SUPPORTED_Autoneg; | ||
189 | ecmd->advertising |= ADVERTISED_Autoneg; | ||
190 | case QLCNIC_BRDTYPE_P3_10G_CX4: | ||
191 | case QLCNIC_BRDTYPE_P3_10G_CX4_LP: | ||
192 | case QLCNIC_BRDTYPE_P3_10000_BASE_T: | ||
193 | ecmd->supported |= SUPPORTED_TP; | ||
194 | ecmd->advertising |= ADVERTISED_TP; | ||
195 | ecmd->port = PORT_TP; | ||
196 | ecmd->autoneg = adapter->link_autoneg; | ||
197 | break; | ||
198 | case QLCNIC_BRDTYPE_P3_IMEZ: | ||
199 | case QLCNIC_BRDTYPE_P3_XG_LOM: | ||
200 | case QLCNIC_BRDTYPE_P3_HMEZ: | ||
201 | ecmd->supported |= SUPPORTED_MII; | ||
202 | ecmd->advertising |= ADVERTISED_MII; | ||
203 | ecmd->port = PORT_MII; | ||
204 | ecmd->autoneg = AUTONEG_DISABLE; | ||
205 | break; | ||
206 | case QLCNIC_BRDTYPE_P3_10G_SFP_PLUS: | ||
207 | case QLCNIC_BRDTYPE_P3_10G_SFP_CT: | ||
208 | case QLCNIC_BRDTYPE_P3_10G_SFP_QT: | ||
209 | ecmd->advertising |= ADVERTISED_TP; | ||
210 | ecmd->supported |= SUPPORTED_TP; | ||
211 | check_sfp_module = netif_running(dev) && | ||
212 | adapter->has_link_events; | ||
213 | case QLCNIC_BRDTYPE_P3_10G_XFP: | ||
214 | ecmd->supported |= SUPPORTED_FIBRE; | ||
215 | ecmd->advertising |= ADVERTISED_FIBRE; | ||
216 | ecmd->port = PORT_FIBRE; | ||
217 | ecmd->autoneg = AUTONEG_DISABLE; | ||
218 | break; | ||
219 | case QLCNIC_BRDTYPE_P3_10G_TP: | ||
220 | if (adapter->ahw.port_type == QLCNIC_XGBE) { | ||
221 | ecmd->autoneg = AUTONEG_DISABLE; | ||
222 | ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); | ||
223 | ecmd->advertising |= | ||
224 | (ADVERTISED_FIBRE | ADVERTISED_TP); | ||
225 | ecmd->port = PORT_FIBRE; | ||
226 | check_sfp_module = netif_running(dev) && | ||
227 | adapter->has_link_events; | ||
228 | } else { | ||
229 | ecmd->autoneg = AUTONEG_ENABLE; | ||
230 | ecmd->supported |= (SUPPORTED_TP | SUPPORTED_Autoneg); | ||
231 | ecmd->advertising |= | ||
232 | (ADVERTISED_TP | ADVERTISED_Autoneg); | ||
233 | ecmd->port = PORT_TP; | ||
234 | } | ||
235 | break; | ||
236 | default: | ||
237 | dev_err(&adapter->pdev->dev, "Unsupported board model %d\n", | ||
238 | adapter->ahw.board_type); | ||
239 | return -EIO; | ||
240 | } | ||
241 | |||
242 | if (check_sfp_module) { | ||
243 | switch (adapter->module_type) { | ||
244 | case LINKEVENT_MODULE_OPTICAL_UNKNOWN: | ||
245 | case LINKEVENT_MODULE_OPTICAL_SRLR: | ||
246 | case LINKEVENT_MODULE_OPTICAL_LRM: | ||
247 | case LINKEVENT_MODULE_OPTICAL_SFP_1G: | ||
248 | ecmd->port = PORT_FIBRE; | ||
249 | break; | ||
250 | case LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLE: | ||
251 | case LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLELEN: | ||
252 | case LINKEVENT_MODULE_TWINAX: | ||
253 | ecmd->port = PORT_TP; | ||
254 | break; | ||
255 | default: | ||
256 | ecmd->port = PORT_OTHER; | ||
257 | } | ||
258 | } | ||
259 | |||
260 | return 0; | ||
261 | } | ||
262 | |||
263 | static int | ||
264 | qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | ||
265 | { | ||
266 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
267 | __u32 status; | ||
268 | |||
269 | /* read which mode */ | ||
270 | if (adapter->ahw.port_type == QLCNIC_GBE) { | ||
271 | /* autonegotiation */ | ||
272 | if (qlcnic_fw_cmd_set_phy(adapter, | ||
273 | QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG, | ||
274 | ecmd->autoneg) != 0) | ||
275 | return -EIO; | ||
276 | else | ||
277 | adapter->link_autoneg = ecmd->autoneg; | ||
278 | |||
279 | if (qlcnic_fw_cmd_query_phy(adapter, | ||
280 | QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | ||
281 | &status) != 0) | ||
282 | return -EIO; | ||
283 | |||
284 | switch (ecmd->speed) { | ||
285 | case SPEED_10: | ||
286 | qlcnic_set_phy_speed(status, 0); | ||
287 | break; | ||
288 | case SPEED_100: | ||
289 | qlcnic_set_phy_speed(status, 1); | ||
290 | break; | ||
291 | case SPEED_1000: | ||
292 | qlcnic_set_phy_speed(status, 2); | ||
293 | break; | ||
294 | } | ||
295 | |||
296 | if (ecmd->duplex == DUPLEX_HALF) | ||
297 | qlcnic_clear_phy_duplex(status); | ||
298 | if (ecmd->duplex == DUPLEX_FULL) | ||
299 | qlcnic_set_phy_duplex(status); | ||
300 | if (qlcnic_fw_cmd_set_phy(adapter, | ||
301 | QLCNIC_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | ||
302 | *((int *)&status)) != 0) | ||
303 | return -EIO; | ||
304 | else { | ||
305 | adapter->link_speed = ecmd->speed; | ||
306 | adapter->link_duplex = ecmd->duplex; | ||
307 | } | ||
308 | } else | ||
309 | return -EOPNOTSUPP; | ||
310 | |||
311 | if (!netif_running(dev)) | ||
312 | return 0; | ||
313 | |||
314 | dev->netdev_ops->ndo_stop(dev); | ||
315 | return dev->netdev_ops->ndo_open(dev); | ||
316 | } | ||
317 | |||
318 | static void | ||
319 | qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | ||
320 | { | ||
321 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
322 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | ||
323 | struct qlcnic_host_sds_ring *sds_ring; | ||
324 | u32 *regs_buff = p; | ||
325 | int ring, i = 0; | ||
326 | |||
327 | memset(p, 0, qlcnic_get_regs_len(dev)); | ||
328 | regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | | ||
329 | (adapter->pdev)->device; | ||
330 | |||
331 | for (i = 0; diag_registers[i] != -1; i++) | ||
332 | regs_buff[i] = QLCRD32(adapter, diag_registers[i]); | ||
333 | |||
334 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | ||
335 | return; | ||
336 | |||
337 | regs_buff[i++] = 0xFFEFCDAB; /* Marker btw regs and ring count*/ | ||
338 | |||
339 | regs_buff[i++] = 1; /* No. of tx ring */ | ||
340 | regs_buff[i++] = le32_to_cpu(*(adapter->tx_ring->hw_consumer)); | ||
341 | regs_buff[i++] = readl(adapter->tx_ring->crb_cmd_producer); | ||
342 | |||
343 | regs_buff[i++] = 2; /* No. of rx ring */ | ||
344 | regs_buff[i++] = readl(recv_ctx->rds_rings[0].crb_rcv_producer); | ||
345 | regs_buff[i++] = readl(recv_ctx->rds_rings[1].crb_rcv_producer); | ||
346 | |||
347 | regs_buff[i++] = adapter->max_sds_rings; | ||
348 | |||
349 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | ||
350 | sds_ring = &(recv_ctx->sds_rings[ring]); | ||
351 | regs_buff[i++] = readl(sds_ring->crb_sts_consumer); | ||
352 | } | ||
353 | } | ||
354 | |||
355 | static u32 qlcnic_test_link(struct net_device *dev) | ||
356 | { | ||
357 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
358 | u32 val; | ||
359 | |||
360 | val = QLCRD32(adapter, CRB_XG_STATE_P3); | ||
361 | val = XG_LINK_STATE_P3(adapter->ahw.pci_func, val); | ||
362 | return (val == XG_LINK_UP_P3) ? 0 : 1; | ||
363 | } | ||
364 | |||
365 | static int | ||
366 | qlcnic_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom, | ||
367 | u8 *bytes) | ||
368 | { | ||
369 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
370 | int offset; | ||
371 | int ret; | ||
372 | |||
373 | if (eeprom->len == 0) | ||
374 | return -EINVAL; | ||
375 | |||
376 | eeprom->magic = (adapter->pdev)->vendor | | ||
377 | ((adapter->pdev)->device << 16); | ||
378 | offset = eeprom->offset; | ||
379 | |||
380 | ret = qlcnic_rom_fast_read_words(adapter, offset, bytes, | ||
381 | eeprom->len); | ||
382 | if (ret < 0) | ||
383 | return ret; | ||
384 | |||
385 | return 0; | ||
386 | } | ||
387 | |||
388 | static void | ||
389 | qlcnic_get_ringparam(struct net_device *dev, | ||
390 | struct ethtool_ringparam *ring) | ||
391 | { | ||
392 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
393 | |||
394 | ring->rx_pending = adapter->num_rxd; | ||
395 | ring->rx_jumbo_pending = adapter->num_jumbo_rxd; | ||
396 | ring->rx_jumbo_pending += adapter->num_lro_rxd; | ||
397 | ring->tx_pending = adapter->num_txd; | ||
398 | |||
399 | if (adapter->ahw.port_type == QLCNIC_GBE) { | ||
400 | ring->rx_max_pending = MAX_RCV_DESCRIPTORS_1G; | ||
401 | ring->rx_jumbo_max_pending = MAX_JUMBO_RCV_DESCRIPTORS_1G; | ||
402 | } else { | ||
403 | ring->rx_max_pending = MAX_RCV_DESCRIPTORS_10G; | ||
404 | ring->rx_jumbo_max_pending = MAX_JUMBO_RCV_DESCRIPTORS_10G; | ||
405 | } | ||
406 | |||
407 | ring->tx_max_pending = MAX_CMD_DESCRIPTORS; | ||
408 | |||
409 | ring->rx_mini_max_pending = 0; | ||
410 | ring->rx_mini_pending = 0; | ||
411 | } | ||
412 | |||
413 | static u32 | ||
414 | qlcnic_validate_ringparam(u32 val, u32 min, u32 max, char *r_name) | ||
415 | { | ||
416 | u32 num_desc; | ||
417 | num_desc = max(val, min); | ||
418 | num_desc = min(num_desc, max); | ||
419 | num_desc = roundup_pow_of_two(num_desc); | ||
420 | |||
421 | if (val != num_desc) { | ||
422 | printk(KERN_INFO "%s: setting %s ring size %d instead of %d\n", | ||
423 | qlcnic_driver_name, r_name, num_desc, val); | ||
424 | } | ||
425 | |||
426 | return num_desc; | ||
427 | } | ||
428 | |||
429 | static int | ||
430 | qlcnic_set_ringparam(struct net_device *dev, | ||
431 | struct ethtool_ringparam *ring) | ||
432 | { | ||
433 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
434 | u16 max_rcv_desc = MAX_RCV_DESCRIPTORS_10G; | ||
435 | u16 max_jumbo_desc = MAX_JUMBO_RCV_DESCRIPTORS_10G; | ||
436 | u16 num_rxd, num_jumbo_rxd, num_txd; | ||
437 | |||
438 | |||
439 | if (ring->rx_mini_pending) | ||
440 | return -EOPNOTSUPP; | ||
441 | |||
442 | if (adapter->ahw.port_type == QLCNIC_GBE) { | ||
443 | max_rcv_desc = MAX_RCV_DESCRIPTORS_1G; | ||
444 | max_jumbo_desc = MAX_JUMBO_RCV_DESCRIPTORS_10G; | ||
445 | } | ||
446 | |||
447 | num_rxd = qlcnic_validate_ringparam(ring->rx_pending, | ||
448 | MIN_RCV_DESCRIPTORS, max_rcv_desc, "rx"); | ||
449 | |||
450 | num_jumbo_rxd = qlcnic_validate_ringparam(ring->rx_jumbo_pending, | ||
451 | MIN_JUMBO_DESCRIPTORS, max_jumbo_desc, "rx jumbo"); | ||
452 | |||
453 | num_txd = qlcnic_validate_ringparam(ring->tx_pending, | ||
454 | MIN_CMD_DESCRIPTORS, MAX_CMD_DESCRIPTORS, "tx"); | ||
455 | |||
456 | if (num_rxd == adapter->num_rxd && num_txd == adapter->num_txd && | ||
457 | num_jumbo_rxd == adapter->num_jumbo_rxd) | ||
458 | return 0; | ||
459 | |||
460 | adapter->num_rxd = num_rxd; | ||
461 | adapter->num_jumbo_rxd = num_jumbo_rxd; | ||
462 | adapter->num_txd = num_txd; | ||
463 | |||
464 | return qlcnic_reset_context(adapter); | ||
465 | } | ||
466 | |||
467 | static void | ||
468 | qlcnic_get_pauseparam(struct net_device *netdev, | ||
469 | struct ethtool_pauseparam *pause) | ||
470 | { | ||
471 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
472 | int port = adapter->physical_port; | ||
473 | __u32 val; | ||
474 | |||
475 | if (adapter->ahw.port_type == QLCNIC_GBE) { | ||
476 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) | ||
477 | return; | ||
478 | /* get flow control settings */ | ||
479 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port)); | ||
480 | pause->rx_pause = qlcnic_gb_get_rx_flowctl(val); | ||
481 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL); | ||
482 | switch (port) { | ||
483 | case 0: | ||
484 | pause->tx_pause = !(qlcnic_gb_get_gb0_mask(val)); | ||
485 | break; | ||
486 | case 1: | ||
487 | pause->tx_pause = !(qlcnic_gb_get_gb1_mask(val)); | ||
488 | break; | ||
489 | case 2: | ||
490 | pause->tx_pause = !(qlcnic_gb_get_gb2_mask(val)); | ||
491 | break; | ||
492 | case 3: | ||
493 | default: | ||
494 | pause->tx_pause = !(qlcnic_gb_get_gb3_mask(val)); | ||
495 | break; | ||
496 | } | ||
497 | } else if (adapter->ahw.port_type == QLCNIC_XGBE) { | ||
498 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) | ||
499 | return; | ||
500 | pause->rx_pause = 1; | ||
501 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL); | ||
502 | if (port == 0) | ||
503 | pause->tx_pause = !(qlcnic_xg_get_xg0_mask(val)); | ||
504 | else | ||
505 | pause->tx_pause = !(qlcnic_xg_get_xg1_mask(val)); | ||
506 | } else { | ||
507 | dev_err(&netdev->dev, "Unknown board type: %x\n", | ||
508 | adapter->ahw.port_type); | ||
509 | } | ||
510 | } | ||
511 | |||
512 | static int | ||
513 | qlcnic_set_pauseparam(struct net_device *netdev, | ||
514 | struct ethtool_pauseparam *pause) | ||
515 | { | ||
516 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
517 | int port = adapter->physical_port; | ||
518 | __u32 val; | ||
519 | |||
520 | /* read mode */ | ||
521 | if (adapter->ahw.port_type == QLCNIC_GBE) { | ||
522 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) | ||
523 | return -EIO; | ||
524 | /* set flow control */ | ||
525 | val = QLCRD32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port)); | ||
526 | |||
527 | if (pause->rx_pause) | ||
528 | qlcnic_gb_rx_flowctl(val); | ||
529 | else | ||
530 | qlcnic_gb_unset_rx_flowctl(val); | ||
531 | |||
532 | QLCWR32(adapter, QLCNIC_NIU_GB_MAC_CONFIG_0(port), | ||
533 | val); | ||
534 | /* set autoneg */ | ||
535 | val = QLCRD32(adapter, QLCNIC_NIU_GB_PAUSE_CTL); | ||
536 | switch (port) { | ||
537 | case 0: | ||
538 | if (pause->tx_pause) | ||
539 | qlcnic_gb_unset_gb0_mask(val); | ||
540 | else | ||
541 | qlcnic_gb_set_gb0_mask(val); | ||
542 | break; | ||
543 | case 1: | ||
544 | if (pause->tx_pause) | ||
545 | qlcnic_gb_unset_gb1_mask(val); | ||
546 | else | ||
547 | qlcnic_gb_set_gb1_mask(val); | ||
548 | break; | ||
549 | case 2: | ||
550 | if (pause->tx_pause) | ||
551 | qlcnic_gb_unset_gb2_mask(val); | ||
552 | else | ||
553 | qlcnic_gb_set_gb2_mask(val); | ||
554 | break; | ||
555 | case 3: | ||
556 | default: | ||
557 | if (pause->tx_pause) | ||
558 | qlcnic_gb_unset_gb3_mask(val); | ||
559 | else | ||
560 | qlcnic_gb_set_gb3_mask(val); | ||
561 | break; | ||
562 | } | ||
563 | QLCWR32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, val); | ||
564 | } else if (adapter->ahw.port_type == QLCNIC_XGBE) { | ||
565 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) | ||
566 | return -EIO; | ||
567 | val = QLCRD32(adapter, QLCNIC_NIU_XG_PAUSE_CTL); | ||
568 | if (port == 0) { | ||
569 | if (pause->tx_pause) | ||
570 | qlcnic_xg_unset_xg0_mask(val); | ||
571 | else | ||
572 | qlcnic_xg_set_xg0_mask(val); | ||
573 | } else { | ||
574 | if (pause->tx_pause) | ||
575 | qlcnic_xg_unset_xg1_mask(val); | ||
576 | else | ||
577 | qlcnic_xg_set_xg1_mask(val); | ||
578 | } | ||
579 | QLCWR32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, val); | ||
580 | } else { | ||
581 | dev_err(&netdev->dev, "Unknown board type: %x\n", | ||
582 | adapter->ahw.port_type); | ||
583 | } | ||
584 | return 0; | ||
585 | } | ||
586 | |||
587 | static int qlcnic_reg_test(struct net_device *dev) | ||
588 | { | ||
589 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
590 | u32 data_read, data_written; | ||
591 | |||
592 | data_read = QLCRD32(adapter, QLCNIC_PCIX_PH_REG(0)); | ||
593 | if ((data_read & 0xffff) != adapter->pdev->vendor) | ||
594 | return 1; | ||
595 | |||
596 | data_written = (u32)0xa5a5a5a5; | ||
597 | |||
598 | QLCWR32(adapter, CRB_SCRATCHPAD_TEST, data_written); | ||
599 | data_read = QLCRD32(adapter, CRB_SCRATCHPAD_TEST); | ||
600 | if (data_written != data_read) | ||
601 | return 1; | ||
602 | |||
603 | return 0; | ||
604 | } | ||
605 | |||
606 | static int qlcnic_get_sset_count(struct net_device *dev, int sset) | ||
607 | { | ||
608 | switch (sset) { | ||
609 | case ETH_SS_TEST: | ||
610 | return QLCNIC_TEST_LEN; | ||
611 | case ETH_SS_STATS: | ||
612 | return QLCNIC_STATS_LEN; | ||
613 | default: | ||
614 | return -EOPNOTSUPP; | ||
615 | } | ||
616 | } | ||
617 | |||
618 | #define QLC_ILB_PKT_SIZE 64 | ||
619 | |||
620 | static void qlcnic_create_loopback_buff(unsigned char *data) | ||
621 | { | ||
622 | unsigned char random_data[] = {0xa8, 0x06, 0x45, 0x00}; | ||
623 | memset(data, 0x4e, QLC_ILB_PKT_SIZE); | ||
624 | memset(data, 0xff, 12); | ||
625 | memcpy(data + 12, random_data, sizeof(random_data)); | ||
626 | } | ||
627 | |||
628 | int qlcnic_check_loopback_buff(unsigned char *data) | ||
629 | { | ||
630 | unsigned char buff[QLC_ILB_PKT_SIZE]; | ||
631 | qlcnic_create_loopback_buff(buff); | ||
632 | return memcmp(data, buff, QLC_ILB_PKT_SIZE); | ||
633 | } | ||
634 | |||
635 | static int qlcnic_do_ilb_test(struct qlcnic_adapter *adapter) | ||
636 | { | ||
637 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | ||
638 | struct qlcnic_host_sds_ring *sds_ring = &recv_ctx->sds_rings[0]; | ||
639 | struct sk_buff *skb; | ||
640 | int i; | ||
641 | |||
642 | for (i = 0; i < 16; i++) { | ||
643 | skb = dev_alloc_skb(QLC_ILB_PKT_SIZE); | ||
644 | qlcnic_create_loopback_buff(skb->data); | ||
645 | skb_put(skb, QLC_ILB_PKT_SIZE); | ||
646 | |||
647 | adapter->diag_cnt = 0; | ||
648 | |||
649 | qlcnic_xmit_frame(skb, adapter->netdev); | ||
650 | |||
651 | msleep(5); | ||
652 | |||
653 | qlcnic_process_rcv_ring_diag(sds_ring); | ||
654 | |||
655 | dev_kfree_skb_any(skb); | ||
656 | if (!adapter->diag_cnt) | ||
657 | return -1; | ||
658 | } | ||
659 | return 0; | ||
660 | } | ||
661 | |||
662 | static int qlcnic_loopback_test(struct net_device *netdev) | ||
663 | { | ||
664 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
665 | int max_sds_rings = adapter->max_sds_rings; | ||
666 | int ret; | ||
667 | |||
668 | if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) | ||
669 | return -EIO; | ||
670 | |||
671 | ret = qlcnic_diag_alloc_res(netdev, QLCNIC_LOOPBACK_TEST); | ||
672 | if (ret) | ||
673 | goto clear_it; | ||
674 | |||
675 | ret = qlcnic_set_ilb_mode(adapter); | ||
676 | if (ret) | ||
677 | goto done; | ||
678 | |||
679 | ret = qlcnic_do_ilb_test(adapter); | ||
680 | |||
681 | qlcnic_clear_ilb_mode(adapter); | ||
682 | |||
683 | done: | ||
684 | qlcnic_diag_free_res(netdev, max_sds_rings); | ||
685 | |||
686 | clear_it: | ||
687 | adapter->max_sds_rings = max_sds_rings; | ||
688 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | ||
689 | return ret; | ||
690 | } | ||
691 | |||
692 | static int qlcnic_irq_test(struct net_device *netdev) | ||
693 | { | ||
694 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
695 | int max_sds_rings = adapter->max_sds_rings; | ||
696 | int ret; | ||
697 | |||
698 | if (test_and_set_bit(__QLCNIC_RESETTING, &adapter->state)) | ||
699 | return -EIO; | ||
700 | |||
701 | ret = qlcnic_diag_alloc_res(netdev, QLCNIC_INTERRUPT_TEST); | ||
702 | if (ret) | ||
703 | goto clear_it; | ||
704 | |||
705 | adapter->diag_cnt = 0; | ||
706 | ret = qlcnic_issue_cmd(adapter, adapter->ahw.pci_func, | ||
707 | QLCHAL_VERSION, adapter->portnum, 0, 0, 0x00000011); | ||
708 | if (ret) | ||
709 | goto done; | ||
710 | |||
711 | msleep(10); | ||
712 | |||
713 | ret = !adapter->diag_cnt; | ||
714 | |||
715 | done: | ||
716 | qlcnic_diag_free_res(netdev, max_sds_rings); | ||
717 | |||
718 | clear_it: | ||
719 | adapter->max_sds_rings = max_sds_rings; | ||
720 | clear_bit(__QLCNIC_RESETTING, &adapter->state); | ||
721 | return ret; | ||
722 | } | ||
723 | |||
724 | static void | ||
725 | qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test, | ||
726 | u64 *data) | ||
727 | { | ||
728 | memset(data, 0, sizeof(u64) * QLCNIC_TEST_LEN); | ||
729 | |||
730 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { | ||
731 | data[2] = qlcnic_irq_test(dev); | ||
732 | if (data[2]) | ||
733 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
734 | |||
735 | data[3] = qlcnic_loopback_test(dev); | ||
736 | if (data[3]) | ||
737 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
738 | |||
739 | } | ||
740 | |||
741 | data[0] = qlcnic_reg_test(dev); | ||
742 | if (data[0]) | ||
743 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
744 | |||
745 | /* link test */ | ||
746 | data[1] = (u64) qlcnic_test_link(dev); | ||
747 | if (data[1]) | ||
748 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
749 | } | ||
750 | |||
751 | static void | ||
752 | qlcnic_get_strings(struct net_device *dev, u32 stringset, u8 * data) | ||
753 | { | ||
754 | int index; | ||
755 | |||
756 | switch (stringset) { | ||
757 | case ETH_SS_TEST: | ||
758 | memcpy(data, *qlcnic_gstrings_test, | ||
759 | QLCNIC_TEST_LEN * ETH_GSTRING_LEN); | ||
760 | break; | ||
761 | case ETH_SS_STATS: | ||
762 | for (index = 0; index < QLCNIC_STATS_LEN; index++) { | ||
763 | memcpy(data + index * ETH_GSTRING_LEN, | ||
764 | qlcnic_gstrings_stats[index].stat_string, | ||
765 | ETH_GSTRING_LEN); | ||
766 | } | ||
767 | break; | ||
768 | } | ||
769 | } | ||
770 | |||
771 | static void | ||
772 | qlcnic_get_ethtool_stats(struct net_device *dev, | ||
773 | struct ethtool_stats *stats, u64 * data) | ||
774 | { | ||
775 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
776 | int index; | ||
777 | |||
778 | for (index = 0; index < QLCNIC_STATS_LEN; index++) { | ||
779 | char *p = | ||
780 | (char *)adapter + | ||
781 | qlcnic_gstrings_stats[index].stat_offset; | ||
782 | data[index] = | ||
783 | (qlcnic_gstrings_stats[index].sizeof_stat == | ||
784 | sizeof(u64)) ? *(u64 *)p:(*(u32 *)p); | ||
785 | } | ||
786 | } | ||
787 | |||
788 | static u32 qlcnic_get_rx_csum(struct net_device *dev) | ||
789 | { | ||
790 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
791 | return adapter->rx_csum; | ||
792 | } | ||
793 | |||
794 | static int qlcnic_set_rx_csum(struct net_device *dev, u32 data) | ||
795 | { | ||
796 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
797 | adapter->rx_csum = !!data; | ||
798 | return 0; | ||
799 | } | ||
800 | |||
801 | static u32 qlcnic_get_tso(struct net_device *dev) | ||
802 | { | ||
803 | return (dev->features & (NETIF_F_TSO | NETIF_F_TSO6)) != 0; | ||
804 | } | ||
805 | |||
806 | static int qlcnic_set_tso(struct net_device *dev, u32 data) | ||
807 | { | ||
808 | if (data) | ||
809 | dev->features |= (NETIF_F_TSO | NETIF_F_TSO6); | ||
810 | else | ||
811 | dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6); | ||
812 | |||
813 | return 0; | ||
814 | } | ||
815 | |||
816 | static int qlcnic_blink_led(struct net_device *dev, u32 val) | ||
817 | { | ||
818 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
819 | int ret; | ||
820 | |||
821 | ret = qlcnic_config_led(adapter, 1, 0xf); | ||
822 | if (ret) { | ||
823 | dev_err(&adapter->pdev->dev, | ||
824 | "Failed to set LED blink state.\n"); | ||
825 | return ret; | ||
826 | } | ||
827 | |||
828 | msleep_interruptible(val * 1000); | ||
829 | |||
830 | ret = qlcnic_config_led(adapter, 0, 0xf); | ||
831 | if (ret) { | ||
832 | dev_err(&adapter->pdev->dev, | ||
833 | "Failed to reset LED blink state.\n"); | ||
834 | return ret; | ||
835 | } | ||
836 | |||
837 | return 0; | ||
838 | } | ||
839 | |||
840 | static void | ||
841 | qlcnic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
842 | { | ||
843 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
844 | u32 wol_cfg; | ||
845 | |||
846 | wol->supported = 0; | ||
847 | wol->wolopts = 0; | ||
848 | |||
849 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); | ||
850 | if (wol_cfg & (1UL << adapter->portnum)) | ||
851 | wol->supported |= WAKE_MAGIC; | ||
852 | |||
853 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); | ||
854 | if (wol_cfg & (1UL << adapter->portnum)) | ||
855 | wol->wolopts |= WAKE_MAGIC; | ||
856 | } | ||
857 | |||
858 | static int | ||
859 | qlcnic_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
860 | { | ||
861 | struct qlcnic_adapter *adapter = netdev_priv(dev); | ||
862 | u32 wol_cfg; | ||
863 | |||
864 | if (wol->wolopts & ~WAKE_MAGIC) | ||
865 | return -EOPNOTSUPP; | ||
866 | |||
867 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG_NV); | ||
868 | if (!(wol_cfg & (1 << adapter->portnum))) | ||
869 | return -EOPNOTSUPP; | ||
870 | |||
871 | wol_cfg = QLCRD32(adapter, QLCNIC_WOL_CONFIG); | ||
872 | if (wol->wolopts & WAKE_MAGIC) | ||
873 | wol_cfg |= 1UL << adapter->portnum; | ||
874 | else | ||
875 | wol_cfg &= ~(1UL << adapter->portnum); | ||
876 | |||
877 | QLCWR32(adapter, QLCNIC_WOL_CONFIG, wol_cfg); | ||
878 | |||
879 | return 0; | ||
880 | } | ||
881 | |||
882 | /* | ||
883 | * Set the coalescing parameters. Currently only normal is supported. | ||
884 | * If rx_coalesce_usecs == 0 or rx_max_coalesced_frames == 0 then set the | ||
885 | * firmware coalescing to default. | ||
886 | */ | ||
887 | static int qlcnic_set_intr_coalesce(struct net_device *netdev, | ||
888 | struct ethtool_coalesce *ethcoal) | ||
889 | { | ||
890 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
891 | |||
892 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | ||
893 | return -EINVAL; | ||
894 | |||
895 | /* | ||
896 | * Return Error if unsupported values or | ||
897 | * unsupported parameters are set. | ||
898 | */ | ||
899 | if (ethcoal->rx_coalesce_usecs > 0xffff || | ||
900 | ethcoal->rx_max_coalesced_frames > 0xffff || | ||
901 | ethcoal->tx_coalesce_usecs > 0xffff || | ||
902 | ethcoal->tx_max_coalesced_frames > 0xffff || | ||
903 | ethcoal->rx_coalesce_usecs_irq || | ||
904 | ethcoal->rx_max_coalesced_frames_irq || | ||
905 | ethcoal->tx_coalesce_usecs_irq || | ||
906 | ethcoal->tx_max_coalesced_frames_irq || | ||
907 | ethcoal->stats_block_coalesce_usecs || | ||
908 | ethcoal->use_adaptive_rx_coalesce || | ||
909 | ethcoal->use_adaptive_tx_coalesce || | ||
910 | ethcoal->pkt_rate_low || | ||
911 | ethcoal->rx_coalesce_usecs_low || | ||
912 | ethcoal->rx_max_coalesced_frames_low || | ||
913 | ethcoal->tx_coalesce_usecs_low || | ||
914 | ethcoal->tx_max_coalesced_frames_low || | ||
915 | ethcoal->pkt_rate_high || | ||
916 | ethcoal->rx_coalesce_usecs_high || | ||
917 | ethcoal->rx_max_coalesced_frames_high || | ||
918 | ethcoal->tx_coalesce_usecs_high || | ||
919 | ethcoal->tx_max_coalesced_frames_high) | ||
920 | return -EINVAL; | ||
921 | |||
922 | if (!ethcoal->rx_coalesce_usecs || | ||
923 | !ethcoal->rx_max_coalesced_frames) { | ||
924 | adapter->coal.flags = QLCNIC_INTR_DEFAULT; | ||
925 | adapter->coal.normal.data.rx_time_us = | ||
926 | QLCNIC_DEFAULT_INTR_COALESCE_RX_TIME_US; | ||
927 | adapter->coal.normal.data.rx_packets = | ||
928 | QLCNIC_DEFAULT_INTR_COALESCE_RX_PACKETS; | ||
929 | } else { | ||
930 | adapter->coal.flags = 0; | ||
931 | adapter->coal.normal.data.rx_time_us = | ||
932 | ethcoal->rx_coalesce_usecs; | ||
933 | adapter->coal.normal.data.rx_packets = | ||
934 | ethcoal->rx_max_coalesced_frames; | ||
935 | } | ||
936 | adapter->coal.normal.data.tx_time_us = ethcoal->tx_coalesce_usecs; | ||
937 | adapter->coal.normal.data.tx_packets = | ||
938 | ethcoal->tx_max_coalesced_frames; | ||
939 | |||
940 | qlcnic_config_intr_coalesce(adapter); | ||
941 | |||
942 | return 0; | ||
943 | } | ||
944 | |||
945 | static int qlcnic_get_intr_coalesce(struct net_device *netdev, | ||
946 | struct ethtool_coalesce *ethcoal) | ||
947 | { | ||
948 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
949 | |||
950 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | ||
951 | return -EINVAL; | ||
952 | |||
953 | ethcoal->rx_coalesce_usecs = adapter->coal.normal.data.rx_time_us; | ||
954 | ethcoal->tx_coalesce_usecs = adapter->coal.normal.data.tx_time_us; | ||
955 | ethcoal->rx_max_coalesced_frames = | ||
956 | adapter->coal.normal.data.rx_packets; | ||
957 | ethcoal->tx_max_coalesced_frames = | ||
958 | adapter->coal.normal.data.tx_packets; | ||
959 | |||
960 | return 0; | ||
961 | } | ||
962 | |||
963 | static int qlcnic_set_flags(struct net_device *netdev, u32 data) | ||
964 | { | ||
965 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | ||
966 | int hw_lro; | ||
967 | |||
968 | if (!(adapter->capabilities & QLCNIC_FW_CAPABILITY_HW_LRO)) | ||
969 | return -EINVAL; | ||
970 | |||
971 | ethtool_op_set_flags(netdev, data); | ||
972 | |||
973 | hw_lro = (data & ETH_FLAG_LRO) ? QLCNIC_LRO_ENABLED : 0; | ||
974 | |||
975 | if (qlcnic_config_hw_lro(adapter, hw_lro)) | ||
976 | return -EIO; | ||
977 | |||
978 | if ((hw_lro == 0) && qlcnic_send_lro_cleanup(adapter)) | ||
979 | return -EIO; | ||
980 | |||
981 | |||
982 | return 0; | ||
983 | } | ||
984 | |||
985 | const struct ethtool_ops qlcnic_ethtool_ops = { | ||
986 | .get_settings = qlcnic_get_settings, | ||
987 | .set_settings = qlcnic_set_settings, | ||
988 | .get_drvinfo = qlcnic_get_drvinfo, | ||
989 | .get_regs_len = qlcnic_get_regs_len, | ||
990 | .get_regs = qlcnic_get_regs, | ||
991 | .get_link = ethtool_op_get_link, | ||
992 | .get_eeprom_len = qlcnic_get_eeprom_len, | ||
993 | .get_eeprom = qlcnic_get_eeprom, | ||
994 | .get_ringparam = qlcnic_get_ringparam, | ||
995 | .set_ringparam = qlcnic_set_ringparam, | ||
996 | .get_pauseparam = qlcnic_get_pauseparam, | ||
997 | .set_pauseparam = qlcnic_set_pauseparam, | ||
998 | .set_tx_csum = ethtool_op_set_tx_csum, | ||
999 | .set_sg = ethtool_op_set_sg, | ||
1000 | .get_tso = qlcnic_get_tso, | ||
1001 | .set_tso = qlcnic_set_tso, | ||
1002 | .get_wol = qlcnic_get_wol, | ||
1003 | .set_wol = qlcnic_set_wol, | ||
1004 | .self_test = qlcnic_diag_test, | ||
1005 | .get_strings = qlcnic_get_strings, | ||
1006 | .get_ethtool_stats = qlcnic_get_ethtool_stats, | ||
1007 | .get_sset_count = qlcnic_get_sset_count, | ||
1008 | .get_rx_csum = qlcnic_get_rx_csum, | ||
1009 | .set_rx_csum = qlcnic_set_rx_csum, | ||
1010 | .get_coalesce = qlcnic_get_intr_coalesce, | ||
1011 | .set_coalesce = qlcnic_set_intr_coalesce, | ||
1012 | .get_flags = ethtool_op_get_flags, | ||
1013 | .set_flags = qlcnic_set_flags, | ||
1014 | .phys_id = qlcnic_blink_led, | ||
1015 | }; | ||