]> asedeno.scripts.mit.edu Git - linux.git/blob - drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf-next
[linux.git] / drivers / net / ethernet / aquantia / atlantic / aq_ethtool.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * aQuantia Corporation Network Driver
4  * Copyright (C) 2014-2019 aQuantia Corporation. All rights reserved
5  */
6
7 /* File aq_ethtool.c: Definition of ethertool related functions. */
8
9 #include "aq_ethtool.h"
10 #include "aq_nic.h"
11 #include "aq_vec.h"
12 #include "aq_ptp.h"
13 #include "aq_filters.h"
14
15 #include <linux/ptp_clock_kernel.h>
16
17 static void aq_ethtool_get_regs(struct net_device *ndev,
18                                 struct ethtool_regs *regs, void *p)
19 {
20         struct aq_nic_s *aq_nic = netdev_priv(ndev);
21         u32 regs_count = aq_nic_get_regs_count(aq_nic);
22
23         memset(p, 0, regs_count * sizeof(u32));
24         aq_nic_get_regs(aq_nic, regs, p);
25 }
26
27 static int aq_ethtool_get_regs_len(struct net_device *ndev)
28 {
29         struct aq_nic_s *aq_nic = netdev_priv(ndev);
30         u32 regs_count = aq_nic_get_regs_count(aq_nic);
31
32         return regs_count * sizeof(u32);
33 }
34
35 static u32 aq_ethtool_get_link(struct net_device *ndev)
36 {
37         return ethtool_op_get_link(ndev);
38 }
39
40 static int aq_ethtool_get_link_ksettings(struct net_device *ndev,
41                                          struct ethtool_link_ksettings *cmd)
42 {
43         struct aq_nic_s *aq_nic = netdev_priv(ndev);
44
45         aq_nic_get_link_ksettings(aq_nic, cmd);
46         cmd->base.speed = netif_carrier_ok(ndev) ?
47                                 aq_nic_get_link_speed(aq_nic) : 0U;
48
49         return 0;
50 }
51
52 static int
53 aq_ethtool_set_link_ksettings(struct net_device *ndev,
54                               const struct ethtool_link_ksettings *cmd)
55 {
56         struct aq_nic_s *aq_nic = netdev_priv(ndev);
57
58         return aq_nic_set_link_ksettings(aq_nic, cmd);
59 }
60
61 static const char aq_ethtool_stat_names[][ETH_GSTRING_LEN] = {
62         "InPackets",
63         "InUCast",
64         "InMCast",
65         "InBCast",
66         "InErrors",
67         "OutPackets",
68         "OutUCast",
69         "OutMCast",
70         "OutBCast",
71         "InUCastOctets",
72         "OutUCastOctets",
73         "InMCastOctets",
74         "OutMCastOctets",
75         "InBCastOctets",
76         "OutBCastOctets",
77         "InOctets",
78         "OutOctets",
79         "InPacketsDma",
80         "OutPacketsDma",
81         "InOctetsDma",
82         "OutOctetsDma",
83         "InDroppedDma",
84 };
85
86 static const char aq_ethtool_queue_stat_names[][ETH_GSTRING_LEN] = {
87         "Queue[%d] InPackets",
88         "Queue[%d] OutPackets",
89         "Queue[%d] Restarts",
90         "Queue[%d] InJumboPackets",
91         "Queue[%d] InLroPackets",
92         "Queue[%d] InErrors",
93 };
94
95 static void aq_ethtool_stats(struct net_device *ndev,
96                              struct ethtool_stats *stats, u64 *data)
97 {
98         struct aq_nic_s *aq_nic = netdev_priv(ndev);
99         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
100
101         memset(data, 0, (ARRAY_SIZE(aq_ethtool_stat_names) +
102                          ARRAY_SIZE(aq_ethtool_queue_stat_names) *
103                          cfg->vecs) * sizeof(u64));
104         aq_nic_get_stats(aq_nic, data);
105 }
106
107 static void aq_ethtool_get_drvinfo(struct net_device *ndev,
108                                    struct ethtool_drvinfo *drvinfo)
109 {
110         struct aq_nic_s *aq_nic = netdev_priv(ndev);
111         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
112         struct pci_dev *pdev = to_pci_dev(ndev->dev.parent);
113         u32 firmware_version = aq_nic_get_fw_version(aq_nic);
114         u32 regs_count = aq_nic_get_regs_count(aq_nic);
115
116         strlcat(drvinfo->driver, AQ_CFG_DRV_NAME, sizeof(drvinfo->driver));
117         strlcat(drvinfo->version, AQ_CFG_DRV_VERSION, sizeof(drvinfo->version));
118
119         snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
120                  "%u.%u.%u", firmware_version >> 24,
121                  (firmware_version >> 16) & 0xFFU, firmware_version & 0xFFFFU);
122
123         strlcpy(drvinfo->bus_info, pdev ? pci_name(pdev) : "",
124                 sizeof(drvinfo->bus_info));
125         drvinfo->n_stats = ARRAY_SIZE(aq_ethtool_stat_names) +
126                 cfg->vecs * ARRAY_SIZE(aq_ethtool_queue_stat_names);
127         drvinfo->testinfo_len = 0;
128         drvinfo->regdump_len = regs_count;
129         drvinfo->eedump_len = 0;
130 }
131
132 static void aq_ethtool_get_strings(struct net_device *ndev,
133                                    u32 stringset, u8 *data)
134 {
135         int i, si;
136         struct aq_nic_s *aq_nic = netdev_priv(ndev);
137         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
138         u8 *p = data;
139
140         if (stringset == ETH_SS_STATS) {
141                 memcpy(p, aq_ethtool_stat_names,
142                        sizeof(aq_ethtool_stat_names));
143                 p = p + sizeof(aq_ethtool_stat_names);
144                 for (i = 0; i < cfg->vecs; i++) {
145                         for (si = 0;
146                                 si < ARRAY_SIZE(aq_ethtool_queue_stat_names);
147                                 si++) {
148                                 snprintf(p, ETH_GSTRING_LEN,
149                                          aq_ethtool_queue_stat_names[si], i);
150                                 p += ETH_GSTRING_LEN;
151                         }
152                 }
153         }
154 }
155
156 static int aq_ethtool_get_sset_count(struct net_device *ndev, int stringset)
157 {
158         int ret = 0;
159         struct aq_nic_s *aq_nic = netdev_priv(ndev);
160         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
161
162         switch (stringset) {
163         case ETH_SS_STATS:
164                 ret = ARRAY_SIZE(aq_ethtool_stat_names) +
165                         cfg->vecs * ARRAY_SIZE(aq_ethtool_queue_stat_names);
166                 break;
167         default:
168                 ret = -EOPNOTSUPP;
169         }
170         return ret;
171 }
172
173 static u32 aq_ethtool_get_rss_indir_size(struct net_device *ndev)
174 {
175         return AQ_CFG_RSS_INDIRECTION_TABLE_MAX;
176 }
177
178 static u32 aq_ethtool_get_rss_key_size(struct net_device *ndev)
179 {
180         struct aq_nic_s *aq_nic = netdev_priv(ndev);
181         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
182
183         return sizeof(cfg->aq_rss.hash_secret_key);
184 }
185
186 static int aq_ethtool_get_rss(struct net_device *ndev, u32 *indir, u8 *key,
187                               u8 *hfunc)
188 {
189         struct aq_nic_s *aq_nic = netdev_priv(ndev);
190         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
191         unsigned int i = 0U;
192
193         if (hfunc)
194                 *hfunc = ETH_RSS_HASH_TOP; /* Toeplitz */
195         if (indir) {
196                 for (i = 0; i < AQ_CFG_RSS_INDIRECTION_TABLE_MAX; i++)
197                         indir[i] = cfg->aq_rss.indirection_table[i];
198         }
199         if (key)
200                 memcpy(key, cfg->aq_rss.hash_secret_key,
201                        sizeof(cfg->aq_rss.hash_secret_key));
202         return 0;
203 }
204
205 static int aq_ethtool_set_rss(struct net_device *netdev, const u32 *indir,
206                               const u8 *key, const u8 hfunc)
207 {
208         struct aq_nic_s *aq_nic = netdev_priv(netdev);
209         struct aq_nic_cfg_s *cfg;
210         unsigned int i = 0U;
211         u32 rss_entries;
212         int err = 0;
213
214         cfg = aq_nic_get_cfg(aq_nic);
215         rss_entries = cfg->aq_rss.indirection_table_size;
216
217         /* We do not allow change in unsupported parameters */
218         if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
219                 return -EOPNOTSUPP;
220         /* Fill out the redirection table */
221         if (indir)
222                 for (i = 0; i < rss_entries; i++)
223                         cfg->aq_rss.indirection_table[i] = indir[i];
224
225         /* Fill out the rss hash key */
226         if (key) {
227                 memcpy(cfg->aq_rss.hash_secret_key, key,
228                        sizeof(cfg->aq_rss.hash_secret_key));
229                 err = aq_nic->aq_hw_ops->hw_rss_hash_set(aq_nic->aq_hw,
230                         &cfg->aq_rss);
231                 if (err)
232                         return err;
233         }
234
235         err = aq_nic->aq_hw_ops->hw_rss_set(aq_nic->aq_hw, &cfg->aq_rss);
236
237         return err;
238 }
239
240 static int aq_ethtool_get_rxnfc(struct net_device *ndev,
241                                 struct ethtool_rxnfc *cmd,
242                                 u32 *rule_locs)
243 {
244         struct aq_nic_s *aq_nic = netdev_priv(ndev);
245         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
246         int err = 0;
247
248         switch (cmd->cmd) {
249         case ETHTOOL_GRXRINGS:
250                 cmd->data = cfg->vecs;
251                 break;
252         case ETHTOOL_GRXCLSRLCNT:
253                 cmd->rule_cnt = aq_get_rxnfc_count_all_rules(aq_nic);
254                 break;
255         case ETHTOOL_GRXCLSRULE:
256                 err = aq_get_rxnfc_rule(aq_nic, cmd);
257                 break;
258         case ETHTOOL_GRXCLSRLALL:
259                 err = aq_get_rxnfc_all_rules(aq_nic, cmd, rule_locs);
260                 break;
261         default:
262                 err = -EOPNOTSUPP;
263                 break;
264         }
265
266         return err;
267 }
268
269 static int aq_ethtool_set_rxnfc(struct net_device *ndev,
270                                 struct ethtool_rxnfc *cmd)
271 {
272         int err = 0;
273         struct aq_nic_s *aq_nic = netdev_priv(ndev);
274
275         switch (cmd->cmd) {
276         case ETHTOOL_SRXCLSRLINS:
277                 err = aq_add_rxnfc_rule(aq_nic, cmd);
278                 break;
279         case ETHTOOL_SRXCLSRLDEL:
280                 err = aq_del_rxnfc_rule(aq_nic, cmd);
281                 break;
282         default:
283                 err = -EOPNOTSUPP;
284                 break;
285         }
286
287         return err;
288 }
289
290 static int aq_ethtool_get_coalesce(struct net_device *ndev,
291                                    struct ethtool_coalesce *coal)
292 {
293         struct aq_nic_s *aq_nic = netdev_priv(ndev);
294         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
295
296         if (cfg->itr == AQ_CFG_INTERRUPT_MODERATION_ON ||
297             cfg->itr == AQ_CFG_INTERRUPT_MODERATION_AUTO) {
298                 coal->rx_coalesce_usecs = cfg->rx_itr;
299                 coal->tx_coalesce_usecs = cfg->tx_itr;
300                 coal->rx_max_coalesced_frames = 0;
301                 coal->tx_max_coalesced_frames = 0;
302         } else {
303                 coal->rx_coalesce_usecs = 0;
304                 coal->tx_coalesce_usecs = 0;
305                 coal->rx_max_coalesced_frames = 1;
306                 coal->tx_max_coalesced_frames = 1;
307         }
308         return 0;
309 }
310
311 static int aq_ethtool_set_coalesce(struct net_device *ndev,
312                                    struct ethtool_coalesce *coal)
313 {
314         struct aq_nic_s *aq_nic = netdev_priv(ndev);
315         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
316
317         /* This is not yet supported
318          */
319         if (coal->use_adaptive_rx_coalesce || coal->use_adaptive_tx_coalesce)
320                 return -EOPNOTSUPP;
321
322         /* Atlantic only supports timing based coalescing
323          */
324         if (coal->rx_max_coalesced_frames > 1 ||
325             coal->rx_coalesce_usecs_irq ||
326             coal->rx_max_coalesced_frames_irq)
327                 return -EOPNOTSUPP;
328
329         if (coal->tx_max_coalesced_frames > 1 ||
330             coal->tx_coalesce_usecs_irq ||
331             coal->tx_max_coalesced_frames_irq)
332                 return -EOPNOTSUPP;
333
334         /* We do not support frame counting. Check this
335          */
336         if (!(coal->rx_max_coalesced_frames == !coal->rx_coalesce_usecs))
337                 return -EOPNOTSUPP;
338         if (!(coal->tx_max_coalesced_frames == !coal->tx_coalesce_usecs))
339                 return -EOPNOTSUPP;
340
341         if (coal->rx_coalesce_usecs > AQ_CFG_INTERRUPT_MODERATION_USEC_MAX ||
342             coal->tx_coalesce_usecs > AQ_CFG_INTERRUPT_MODERATION_USEC_MAX)
343                 return -EINVAL;
344
345         cfg->itr = AQ_CFG_INTERRUPT_MODERATION_ON;
346
347         cfg->rx_itr = coal->rx_coalesce_usecs;
348         cfg->tx_itr = coal->tx_coalesce_usecs;
349
350         return aq_nic_update_interrupt_moderation_settings(aq_nic);
351 }
352
353 static void aq_ethtool_get_wol(struct net_device *ndev,
354                                struct ethtool_wolinfo *wol)
355 {
356         struct aq_nic_s *aq_nic = netdev_priv(ndev);
357         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
358
359         wol->supported = WAKE_MAGIC;
360         wol->wolopts = 0;
361
362         if (cfg->wol)
363                 wol->wolopts |= WAKE_MAGIC;
364 }
365
366 static int aq_ethtool_set_wol(struct net_device *ndev,
367                               struct ethtool_wolinfo *wol)
368 {
369         struct pci_dev *pdev = to_pci_dev(ndev->dev.parent);
370         struct aq_nic_s *aq_nic = netdev_priv(ndev);
371         struct aq_nic_cfg_s *cfg = aq_nic_get_cfg(aq_nic);
372         int err = 0;
373
374         if (wol->wolopts & WAKE_MAGIC)
375                 cfg->wol |= AQ_NIC_WOL_ENABLED;
376         else
377                 cfg->wol &= ~AQ_NIC_WOL_ENABLED;
378         err = device_set_wakeup_enable(&pdev->dev, wol->wolopts);
379
380         return err;
381 }
382
383 static int aq_ethtool_get_ts_info(struct net_device *ndev,
384                                   struct ethtool_ts_info *info)
385 {
386         struct aq_nic_s *aq_nic = netdev_priv(ndev);
387
388         ethtool_op_get_ts_info(ndev, info);
389
390         if (!aq_nic->aq_ptp)
391                 return 0;
392
393         info->so_timestamping |=
394                 SOF_TIMESTAMPING_TX_HARDWARE |
395                 SOF_TIMESTAMPING_RX_HARDWARE |
396                 SOF_TIMESTAMPING_RAW_HARDWARE;
397
398         info->tx_types = BIT(HWTSTAMP_TX_OFF) |
399                          BIT(HWTSTAMP_TX_ON);
400
401         info->rx_filters = BIT(HWTSTAMP_FILTER_NONE);
402
403         info->rx_filters |= BIT(HWTSTAMP_FILTER_PTP_V2_L4_EVENT) |
404                             BIT(HWTSTAMP_FILTER_PTP_V2_L2_EVENT) |
405                             BIT(HWTSTAMP_FILTER_PTP_V2_EVENT);
406
407         info->phc_index = ptp_clock_index(aq_ptp_get_ptp_clock(aq_nic->aq_ptp));
408
409         return 0;
410 }
411
412 static enum hw_atl_fw2x_rate eee_mask_to_ethtool_mask(u32 speed)
413 {
414         u32 rate = 0;
415
416         if (speed & AQ_NIC_RATE_EEE_10G)
417                 rate |= SUPPORTED_10000baseT_Full;
418
419         if (speed & AQ_NIC_RATE_EEE_2GS)
420                 rate |= SUPPORTED_2500baseX_Full;
421
422         if (speed & AQ_NIC_RATE_EEE_1G)
423                 rate |= SUPPORTED_1000baseT_Full;
424
425         return rate;
426 }
427
428 static int aq_ethtool_get_eee(struct net_device *ndev, struct ethtool_eee *eee)
429 {
430         struct aq_nic_s *aq_nic = netdev_priv(ndev);
431         u32 rate, supported_rates;
432         int err = 0;
433
434         if (!aq_nic->aq_fw_ops->get_eee_rate)
435                 return -EOPNOTSUPP;
436
437         mutex_lock(&aq_nic->fwreq_mutex);
438         err = aq_nic->aq_fw_ops->get_eee_rate(aq_nic->aq_hw, &rate,
439                                               &supported_rates);
440         mutex_unlock(&aq_nic->fwreq_mutex);
441         if (err < 0)
442                 return err;
443
444         eee->supported = eee_mask_to_ethtool_mask(supported_rates);
445
446         if (aq_nic->aq_nic_cfg.eee_speeds)
447                 eee->advertised = eee->supported;
448
449         eee->lp_advertised = eee_mask_to_ethtool_mask(rate);
450
451         eee->eee_enabled = !!eee->advertised;
452
453         eee->tx_lpi_enabled = eee->eee_enabled;
454         if (eee->advertised & eee->lp_advertised)
455                 eee->eee_active = true;
456
457         return 0;
458 }
459
460 static int aq_ethtool_set_eee(struct net_device *ndev, struct ethtool_eee *eee)
461 {
462         struct aq_nic_s *aq_nic = netdev_priv(ndev);
463         u32 rate, supported_rates;
464         struct aq_nic_cfg_s *cfg;
465         int err = 0;
466
467         cfg = aq_nic_get_cfg(aq_nic);
468
469         if (unlikely(!aq_nic->aq_fw_ops->get_eee_rate ||
470                      !aq_nic->aq_fw_ops->set_eee_rate))
471                 return -EOPNOTSUPP;
472
473         mutex_lock(&aq_nic->fwreq_mutex);
474         err = aq_nic->aq_fw_ops->get_eee_rate(aq_nic->aq_hw, &rate,
475                                               &supported_rates);
476         mutex_unlock(&aq_nic->fwreq_mutex);
477         if (err < 0)
478                 return err;
479
480         if (eee->eee_enabled) {
481                 rate = supported_rates;
482                 cfg->eee_speeds = rate;
483         } else {
484                 rate = 0;
485                 cfg->eee_speeds = 0;
486         }
487
488         mutex_lock(&aq_nic->fwreq_mutex);
489         err = aq_nic->aq_fw_ops->set_eee_rate(aq_nic->aq_hw, rate);
490         mutex_unlock(&aq_nic->fwreq_mutex);
491
492         return err;
493 }
494
495 static int aq_ethtool_nway_reset(struct net_device *ndev)
496 {
497         struct aq_nic_s *aq_nic = netdev_priv(ndev);
498         int err = 0;
499
500         if (unlikely(!aq_nic->aq_fw_ops->renegotiate))
501                 return -EOPNOTSUPP;
502
503         if (netif_running(ndev)) {
504                 mutex_lock(&aq_nic->fwreq_mutex);
505                 err = aq_nic->aq_fw_ops->renegotiate(aq_nic->aq_hw);
506                 mutex_unlock(&aq_nic->fwreq_mutex);
507         }
508
509         return err;
510 }
511
512 static void aq_ethtool_get_pauseparam(struct net_device *ndev,
513                                       struct ethtool_pauseparam *pause)
514 {
515         struct aq_nic_s *aq_nic = netdev_priv(ndev);
516         u32 fc = aq_nic->aq_nic_cfg.flow_control;
517
518         pause->autoneg = 0;
519
520         pause->rx_pause = !!(fc & AQ_NIC_FC_RX);
521         pause->tx_pause = !!(fc & AQ_NIC_FC_TX);
522
523 }
524
525 static int aq_ethtool_set_pauseparam(struct net_device *ndev,
526                                      struct ethtool_pauseparam *pause)
527 {
528         struct aq_nic_s *aq_nic = netdev_priv(ndev);
529         int err = 0;
530
531         if (!aq_nic->aq_fw_ops->set_flow_control)
532                 return -EOPNOTSUPP;
533
534         if (pause->autoneg == AUTONEG_ENABLE)
535                 return -EOPNOTSUPP;
536
537         if (pause->rx_pause)
538                 aq_nic->aq_hw->aq_nic_cfg->flow_control |= AQ_NIC_FC_RX;
539         else
540                 aq_nic->aq_hw->aq_nic_cfg->flow_control &= ~AQ_NIC_FC_RX;
541
542         if (pause->tx_pause)
543                 aq_nic->aq_hw->aq_nic_cfg->flow_control |= AQ_NIC_FC_TX;
544         else
545                 aq_nic->aq_hw->aq_nic_cfg->flow_control &= ~AQ_NIC_FC_TX;
546
547         mutex_lock(&aq_nic->fwreq_mutex);
548         err = aq_nic->aq_fw_ops->set_flow_control(aq_nic->aq_hw);
549         mutex_unlock(&aq_nic->fwreq_mutex);
550
551         return err;
552 }
553
554 static void aq_get_ringparam(struct net_device *ndev,
555                              struct ethtool_ringparam *ring)
556 {
557         struct aq_nic_s *aq_nic = netdev_priv(ndev);
558         struct aq_nic_cfg_s *aq_nic_cfg = aq_nic_get_cfg(aq_nic);
559
560         ring->rx_pending = aq_nic_cfg->rxds;
561         ring->tx_pending = aq_nic_cfg->txds;
562
563         ring->rx_max_pending = aq_nic_cfg->aq_hw_caps->rxds_max;
564         ring->tx_max_pending = aq_nic_cfg->aq_hw_caps->txds_max;
565 }
566
567 static int aq_set_ringparam(struct net_device *ndev,
568                             struct ethtool_ringparam *ring)
569 {
570         int err = 0;
571         bool ndev_running = false;
572         struct aq_nic_s *aq_nic = netdev_priv(ndev);
573         struct aq_nic_cfg_s *aq_nic_cfg = aq_nic_get_cfg(aq_nic);
574         const struct aq_hw_caps_s *hw_caps = aq_nic_cfg->aq_hw_caps;
575
576         if (ring->rx_mini_pending || ring->rx_jumbo_pending) {
577                 err = -EOPNOTSUPP;
578                 goto err_exit;
579         }
580
581         if (netif_running(ndev)) {
582                 ndev_running = true;
583                 dev_close(ndev);
584         }
585
586         aq_nic_free_vectors(aq_nic);
587
588         aq_nic_cfg->rxds = max(ring->rx_pending, hw_caps->rxds_min);
589         aq_nic_cfg->rxds = min(aq_nic_cfg->rxds, hw_caps->rxds_max);
590         aq_nic_cfg->rxds = ALIGN(aq_nic_cfg->rxds, AQ_HW_RXD_MULTIPLE);
591
592         aq_nic_cfg->txds = max(ring->tx_pending, hw_caps->txds_min);
593         aq_nic_cfg->txds = min(aq_nic_cfg->txds, hw_caps->txds_max);
594         aq_nic_cfg->txds = ALIGN(aq_nic_cfg->txds, AQ_HW_TXD_MULTIPLE);
595
596         for (aq_nic->aq_vecs = 0; aq_nic->aq_vecs < aq_nic_cfg->vecs;
597              aq_nic->aq_vecs++) {
598                 aq_nic->aq_vec[aq_nic->aq_vecs] =
599                     aq_vec_alloc(aq_nic, aq_nic->aq_vecs, aq_nic_cfg);
600                 if (unlikely(!aq_nic->aq_vec[aq_nic->aq_vecs])) {
601                         err = -ENOMEM;
602                         goto err_exit;
603                 }
604         }
605         if (ndev_running)
606                 err = dev_open(ndev, NULL);
607
608 err_exit:
609         return err;
610 }
611
612 const struct ethtool_ops aq_ethtool_ops = {
613         .get_link            = aq_ethtool_get_link,
614         .get_regs_len        = aq_ethtool_get_regs_len,
615         .get_regs            = aq_ethtool_get_regs,
616         .get_drvinfo         = aq_ethtool_get_drvinfo,
617         .get_strings         = aq_ethtool_get_strings,
618         .get_rxfh_indir_size = aq_ethtool_get_rss_indir_size,
619         .get_wol             = aq_ethtool_get_wol,
620         .set_wol             = aq_ethtool_set_wol,
621         .nway_reset          = aq_ethtool_nway_reset,
622         .get_ringparam       = aq_get_ringparam,
623         .set_ringparam       = aq_set_ringparam,
624         .get_eee             = aq_ethtool_get_eee,
625         .set_eee             = aq_ethtool_set_eee,
626         .get_pauseparam      = aq_ethtool_get_pauseparam,
627         .set_pauseparam      = aq_ethtool_set_pauseparam,
628         .get_rxfh_key_size   = aq_ethtool_get_rss_key_size,
629         .get_rxfh            = aq_ethtool_get_rss,
630         .set_rxfh            = aq_ethtool_set_rss,
631         .get_rxnfc           = aq_ethtool_get_rxnfc,
632         .set_rxnfc           = aq_ethtool_set_rxnfc,
633         .get_sset_count      = aq_ethtool_get_sset_count,
634         .get_ethtool_stats   = aq_ethtool_stats,
635         .get_link_ksettings  = aq_ethtool_get_link_ksettings,
636         .set_link_ksettings  = aq_ethtool_set_link_ksettings,
637         .get_coalesce        = aq_ethtool_get_coalesce,
638         .set_coalesce        = aq_ethtool_set_coalesce,
639         .get_ts_info         = aq_ethtool_get_ts_info,
640 };