bnxt_en: Don't allow autoneg on cards that don't support it.
[deliverable/linux.git] / drivers / net / ethernet / broadcom / bnxt / bnxt_ethtool.c
CommitLineData
c0c050c5
MC
1/* Broadcom NetXtreme-C/E network driver.
2 *
11f15ed3 3 * Copyright (c) 2014-2016 Broadcom Corporation
c0c050c5
MC
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation.
8 */
9
3ebf6f0a 10#include <linux/ctype.h>
8ddc9aaa 11#include <linux/stringify.h>
c0c050c5
MC
12#include <linux/ethtool.h>
13#include <linux/interrupt.h>
14#include <linux/pci.h>
15#include <linux/etherdevice.h>
16#include <linux/crc32.h>
17#include <linux/firmware.h>
18#include "bnxt_hsi.h"
19#include "bnxt.h"
20#include "bnxt_ethtool.h"
21#include "bnxt_nvm_defs.h" /* NVRAM content constant and structure defs */
22#include "bnxt_fw_hdr.h" /* Firmware hdr constant and structure defs */
23#define FLASH_NVRAM_TIMEOUT ((HWRM_CMD_TIMEOUT) * 100)
24
3ebf6f0a
RS
25static char *bnxt_get_pkgver(struct net_device *dev, char *buf, size_t buflen);
26
c0c050c5
MC
27static u32 bnxt_get_msglevel(struct net_device *dev)
28{
29 struct bnxt *bp = netdev_priv(dev);
30
31 return bp->msg_enable;
32}
33
34static void bnxt_set_msglevel(struct net_device *dev, u32 value)
35{
36 struct bnxt *bp = netdev_priv(dev);
37
38 bp->msg_enable = value;
39}
40
41static int bnxt_get_coalesce(struct net_device *dev,
42 struct ethtool_coalesce *coal)
43{
44 struct bnxt *bp = netdev_priv(dev);
45
46 memset(coal, 0, sizeof(*coal));
47
dfb5b894
MC
48 coal->rx_coalesce_usecs = bp->rx_coal_ticks;
49 /* 2 completion records per rx packet */
50 coal->rx_max_coalesced_frames = bp->rx_coal_bufs / 2;
51 coal->rx_coalesce_usecs_irq = bp->rx_coal_ticks_irq;
52 coal->rx_max_coalesced_frames_irq = bp->rx_coal_bufs_irq / 2;
c0c050c5 53
dfc9c94a
MC
54 coal->tx_coalesce_usecs = bp->tx_coal_ticks;
55 coal->tx_max_coalesced_frames = bp->tx_coal_bufs;
56 coal->tx_coalesce_usecs_irq = bp->tx_coal_ticks_irq;
57 coal->tx_max_coalesced_frames_irq = bp->tx_coal_bufs_irq;
58
c0c050c5
MC
59 return 0;
60}
61
62static int bnxt_set_coalesce(struct net_device *dev,
63 struct ethtool_coalesce *coal)
64{
65 struct bnxt *bp = netdev_priv(dev);
66 int rc = 0;
67
dfb5b894
MC
68 bp->rx_coal_ticks = coal->rx_coalesce_usecs;
69 /* 2 completion records per rx packet */
70 bp->rx_coal_bufs = coal->rx_max_coalesced_frames * 2;
71 bp->rx_coal_ticks_irq = coal->rx_coalesce_usecs_irq;
72 bp->rx_coal_bufs_irq = coal->rx_max_coalesced_frames_irq * 2;
c0c050c5 73
dfc9c94a
MC
74 bp->tx_coal_ticks = coal->tx_coalesce_usecs;
75 bp->tx_coal_bufs = coal->tx_max_coalesced_frames;
76 bp->tx_coal_ticks_irq = coal->tx_coalesce_usecs_irq;
77 bp->tx_coal_bufs_irq = coal->tx_max_coalesced_frames_irq;
78
c0c050c5
MC
79 if (netif_running(dev))
80 rc = bnxt_hwrm_set_coal(bp);
81
82 return rc;
83}
84
85#define BNXT_NUM_STATS 21
86
8ddc9aaa
MC
87#define BNXT_RX_STATS_OFFSET(counter) \
88 (offsetof(struct rx_port_stats, counter) / 8)
89
90#define BNXT_RX_STATS_ENTRY(counter) \
91 { BNXT_RX_STATS_OFFSET(counter), __stringify(counter) }
92
93#define BNXT_TX_STATS_OFFSET(counter) \
94 ((offsetof(struct tx_port_stats, counter) + \
95 sizeof(struct rx_port_stats) + 512) / 8)
96
97#define BNXT_TX_STATS_ENTRY(counter) \
98 { BNXT_TX_STATS_OFFSET(counter), __stringify(counter) }
99
100static const struct {
101 long offset;
102 char string[ETH_GSTRING_LEN];
103} bnxt_port_stats_arr[] = {
104 BNXT_RX_STATS_ENTRY(rx_64b_frames),
105 BNXT_RX_STATS_ENTRY(rx_65b_127b_frames),
106 BNXT_RX_STATS_ENTRY(rx_128b_255b_frames),
107 BNXT_RX_STATS_ENTRY(rx_256b_511b_frames),
108 BNXT_RX_STATS_ENTRY(rx_512b_1023b_frames),
109 BNXT_RX_STATS_ENTRY(rx_1024b_1518_frames),
110 BNXT_RX_STATS_ENTRY(rx_good_vlan_frames),
111 BNXT_RX_STATS_ENTRY(rx_1519b_2047b_frames),
112 BNXT_RX_STATS_ENTRY(rx_2048b_4095b_frames),
113 BNXT_RX_STATS_ENTRY(rx_4096b_9216b_frames),
114 BNXT_RX_STATS_ENTRY(rx_9217b_16383b_frames),
115 BNXT_RX_STATS_ENTRY(rx_total_frames),
116 BNXT_RX_STATS_ENTRY(rx_ucast_frames),
117 BNXT_RX_STATS_ENTRY(rx_mcast_frames),
118 BNXT_RX_STATS_ENTRY(rx_bcast_frames),
119 BNXT_RX_STATS_ENTRY(rx_fcs_err_frames),
120 BNXT_RX_STATS_ENTRY(rx_ctrl_frames),
121 BNXT_RX_STATS_ENTRY(rx_pause_frames),
122 BNXT_RX_STATS_ENTRY(rx_pfc_frames),
123 BNXT_RX_STATS_ENTRY(rx_align_err_frames),
124 BNXT_RX_STATS_ENTRY(rx_ovrsz_frames),
125 BNXT_RX_STATS_ENTRY(rx_jbr_frames),
126 BNXT_RX_STATS_ENTRY(rx_mtu_err_frames),
127 BNXT_RX_STATS_ENTRY(rx_tagged_frames),
128 BNXT_RX_STATS_ENTRY(rx_double_tagged_frames),
129 BNXT_RX_STATS_ENTRY(rx_good_frames),
130 BNXT_RX_STATS_ENTRY(rx_undrsz_frames),
131 BNXT_RX_STATS_ENTRY(rx_eee_lpi_events),
132 BNXT_RX_STATS_ENTRY(rx_eee_lpi_duration),
133 BNXT_RX_STATS_ENTRY(rx_bytes),
134 BNXT_RX_STATS_ENTRY(rx_runt_bytes),
135 BNXT_RX_STATS_ENTRY(rx_runt_frames),
136
137 BNXT_TX_STATS_ENTRY(tx_64b_frames),
138 BNXT_TX_STATS_ENTRY(tx_65b_127b_frames),
139 BNXT_TX_STATS_ENTRY(tx_128b_255b_frames),
140 BNXT_TX_STATS_ENTRY(tx_256b_511b_frames),
141 BNXT_TX_STATS_ENTRY(tx_512b_1023b_frames),
142 BNXT_TX_STATS_ENTRY(tx_1024b_1518_frames),
143 BNXT_TX_STATS_ENTRY(tx_good_vlan_frames),
144 BNXT_TX_STATS_ENTRY(tx_1519b_2047_frames),
145 BNXT_TX_STATS_ENTRY(tx_2048b_4095b_frames),
146 BNXT_TX_STATS_ENTRY(tx_4096b_9216b_frames),
147 BNXT_TX_STATS_ENTRY(tx_9217b_16383b_frames),
148 BNXT_TX_STATS_ENTRY(tx_good_frames),
149 BNXT_TX_STATS_ENTRY(tx_total_frames),
150 BNXT_TX_STATS_ENTRY(tx_ucast_frames),
151 BNXT_TX_STATS_ENTRY(tx_mcast_frames),
152 BNXT_TX_STATS_ENTRY(tx_bcast_frames),
153 BNXT_TX_STATS_ENTRY(tx_pause_frames),
154 BNXT_TX_STATS_ENTRY(tx_pfc_frames),
155 BNXT_TX_STATS_ENTRY(tx_jabber_frames),
156 BNXT_TX_STATS_ENTRY(tx_fcs_err_frames),
157 BNXT_TX_STATS_ENTRY(tx_err),
158 BNXT_TX_STATS_ENTRY(tx_fifo_underruns),
159 BNXT_TX_STATS_ENTRY(tx_eee_lpi_events),
160 BNXT_TX_STATS_ENTRY(tx_eee_lpi_duration),
161 BNXT_TX_STATS_ENTRY(tx_total_collisions),
162 BNXT_TX_STATS_ENTRY(tx_bytes),
163};
164
165#define BNXT_NUM_PORT_STATS ARRAY_SIZE(bnxt_port_stats_arr)
166
c0c050c5
MC
167static int bnxt_get_sset_count(struct net_device *dev, int sset)
168{
169 struct bnxt *bp = netdev_priv(dev);
170
171 switch (sset) {
8ddc9aaa
MC
172 case ETH_SS_STATS: {
173 int num_stats = BNXT_NUM_STATS * bp->cp_nr_rings;
174
175 if (bp->flags & BNXT_FLAG_PORT_STATS)
176 num_stats += BNXT_NUM_PORT_STATS;
177
178 return num_stats;
179 }
c0c050c5
MC
180 default:
181 return -EOPNOTSUPP;
182 }
183}
184
185static void bnxt_get_ethtool_stats(struct net_device *dev,
186 struct ethtool_stats *stats, u64 *buf)
187{
188 u32 i, j = 0;
189 struct bnxt *bp = netdev_priv(dev);
190 u32 buf_size = sizeof(struct ctx_hw_stats) * bp->cp_nr_rings;
191 u32 stat_fields = sizeof(struct ctx_hw_stats) / 8;
192
193 memset(buf, 0, buf_size);
194
195 if (!bp->bnapi)
196 return;
197
198 for (i = 0; i < bp->cp_nr_rings; i++) {
199 struct bnxt_napi *bnapi = bp->bnapi[i];
200 struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
201 __le64 *hw_stats = (__le64 *)cpr->hw_stats;
202 int k;
203
204 for (k = 0; k < stat_fields; j++, k++)
205 buf[j] = le64_to_cpu(hw_stats[k]);
206 buf[j++] = cpr->rx_l4_csum_errors;
207 }
8ddc9aaa
MC
208 if (bp->flags & BNXT_FLAG_PORT_STATS) {
209 __le64 *port_stats = (__le64 *)bp->hw_rx_port_stats;
210
211 for (i = 0; i < BNXT_NUM_PORT_STATS; i++, j++) {
212 buf[j] = le64_to_cpu(*(port_stats +
213 bnxt_port_stats_arr[i].offset));
214 }
215 }
c0c050c5
MC
216}
217
218static void bnxt_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
219{
220 struct bnxt *bp = netdev_priv(dev);
221 u32 i;
222
223 switch (stringset) {
224 /* The number of strings must match BNXT_NUM_STATS defined above. */
225 case ETH_SS_STATS:
226 for (i = 0; i < bp->cp_nr_rings; i++) {
227 sprintf(buf, "[%d]: rx_ucast_packets", i);
228 buf += ETH_GSTRING_LEN;
229 sprintf(buf, "[%d]: rx_mcast_packets", i);
230 buf += ETH_GSTRING_LEN;
231 sprintf(buf, "[%d]: rx_bcast_packets", i);
232 buf += ETH_GSTRING_LEN;
233 sprintf(buf, "[%d]: rx_discards", i);
234 buf += ETH_GSTRING_LEN;
235 sprintf(buf, "[%d]: rx_drops", i);
236 buf += ETH_GSTRING_LEN;
237 sprintf(buf, "[%d]: rx_ucast_bytes", i);
238 buf += ETH_GSTRING_LEN;
239 sprintf(buf, "[%d]: rx_mcast_bytes", i);
240 buf += ETH_GSTRING_LEN;
241 sprintf(buf, "[%d]: rx_bcast_bytes", i);
242 buf += ETH_GSTRING_LEN;
243 sprintf(buf, "[%d]: tx_ucast_packets", i);
244 buf += ETH_GSTRING_LEN;
245 sprintf(buf, "[%d]: tx_mcast_packets", i);
246 buf += ETH_GSTRING_LEN;
247 sprintf(buf, "[%d]: tx_bcast_packets", i);
248 buf += ETH_GSTRING_LEN;
249 sprintf(buf, "[%d]: tx_discards", i);
250 buf += ETH_GSTRING_LEN;
251 sprintf(buf, "[%d]: tx_drops", i);
252 buf += ETH_GSTRING_LEN;
253 sprintf(buf, "[%d]: tx_ucast_bytes", i);
254 buf += ETH_GSTRING_LEN;
255 sprintf(buf, "[%d]: tx_mcast_bytes", i);
256 buf += ETH_GSTRING_LEN;
257 sprintf(buf, "[%d]: tx_bcast_bytes", i);
258 buf += ETH_GSTRING_LEN;
259 sprintf(buf, "[%d]: tpa_packets", i);
260 buf += ETH_GSTRING_LEN;
261 sprintf(buf, "[%d]: tpa_bytes", i);
262 buf += ETH_GSTRING_LEN;
263 sprintf(buf, "[%d]: tpa_events", i);
264 buf += ETH_GSTRING_LEN;
265 sprintf(buf, "[%d]: tpa_aborts", i);
266 buf += ETH_GSTRING_LEN;
267 sprintf(buf, "[%d]: rx_l4_csum_errors", i);
268 buf += ETH_GSTRING_LEN;
269 }
8ddc9aaa
MC
270 if (bp->flags & BNXT_FLAG_PORT_STATS) {
271 for (i = 0; i < BNXT_NUM_PORT_STATS; i++) {
272 strcpy(buf, bnxt_port_stats_arr[i].string);
273 buf += ETH_GSTRING_LEN;
274 }
275 }
c0c050c5
MC
276 break;
277 default:
278 netdev_err(bp->dev, "bnxt_get_strings invalid request %x\n",
279 stringset);
280 break;
281 }
282}
283
284static void bnxt_get_ringparam(struct net_device *dev,
285 struct ethtool_ringparam *ering)
286{
287 struct bnxt *bp = netdev_priv(dev);
288
289 ering->rx_max_pending = BNXT_MAX_RX_DESC_CNT;
290 ering->rx_jumbo_max_pending = BNXT_MAX_RX_JUM_DESC_CNT;
291 ering->tx_max_pending = BNXT_MAX_TX_DESC_CNT;
292
293 ering->rx_pending = bp->rx_ring_size;
294 ering->rx_jumbo_pending = bp->rx_agg_ring_size;
295 ering->tx_pending = bp->tx_ring_size;
296}
297
298static int bnxt_set_ringparam(struct net_device *dev,
299 struct ethtool_ringparam *ering)
300{
301 struct bnxt *bp = netdev_priv(dev);
302
303 if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) ||
304 (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) ||
305 (ering->tx_pending <= MAX_SKB_FRAGS))
306 return -EINVAL;
307
308 if (netif_running(dev))
309 bnxt_close_nic(bp, false, false);
310
311 bp->rx_ring_size = ering->rx_pending;
312 bp->tx_ring_size = ering->tx_pending;
313 bnxt_set_ring_params(bp);
314
315 if (netif_running(dev))
316 return bnxt_open_nic(bp, false, false);
317
318 return 0;
319}
320
321static void bnxt_get_channels(struct net_device *dev,
322 struct ethtool_channels *channel)
323{
324 struct bnxt *bp = netdev_priv(dev);
325 int max_rx_rings, max_tx_rings, tcs;
326
6e6c5a57 327 bnxt_get_max_rings(bp, &max_rx_rings, &max_tx_rings, true);
068c9ec6
MC
328 channel->max_combined = max_rx_rings;
329
18d6e4e2
SB
330 if (bnxt_get_max_rings(bp, &max_rx_rings, &max_tx_rings, false)) {
331 max_rx_rings = 0;
332 max_tx_rings = 0;
333 }
334
c0c050c5
MC
335 tcs = netdev_get_num_tc(dev);
336 if (tcs > 1)
337 max_tx_rings /= tcs;
338
339 channel->max_rx = max_rx_rings;
340 channel->max_tx = max_tx_rings;
341 channel->max_other = 0;
068c9ec6
MC
342 if (bp->flags & BNXT_FLAG_SHARED_RINGS) {
343 channel->combined_count = bp->rx_nr_rings;
344 } else {
345 channel->rx_count = bp->rx_nr_rings;
346 channel->tx_count = bp->tx_nr_rings_per_tc;
347 }
c0c050c5
MC
348}
349
350static int bnxt_set_channels(struct net_device *dev,
351 struct ethtool_channels *channel)
352{
353 struct bnxt *bp = netdev_priv(dev);
354 int max_rx_rings, max_tx_rings, tcs;
355 u32 rc = 0;
068c9ec6 356 bool sh = false;
c0c050c5 357
068c9ec6 358 if (channel->other_count)
c0c050c5
MC
359 return -EINVAL;
360
068c9ec6
MC
361 if (!channel->combined_count &&
362 (!channel->rx_count || !channel->tx_count))
363 return -EINVAL;
364
365 if (channel->combined_count &&
366 (channel->rx_count || channel->tx_count))
367 return -EINVAL;
368
369 if (channel->combined_count)
370 sh = true;
371
372 bnxt_get_max_rings(bp, &max_rx_rings, &max_tx_rings, sh);
373
c0c050c5
MC
374 tcs = netdev_get_num_tc(dev);
375 if (tcs > 1)
376 max_tx_rings /= tcs;
377
068c9ec6
MC
378 if (sh && (channel->combined_count > max_rx_rings ||
379 channel->combined_count > max_tx_rings))
380 return -ENOMEM;
381
382 if (!sh && (channel->rx_count > max_rx_rings ||
383 channel->tx_count > max_tx_rings))
384 return -ENOMEM;
c0c050c5
MC
385
386 if (netif_running(dev)) {
387 if (BNXT_PF(bp)) {
388 /* TODO CHIMP_FW: Send message to all VF's
389 * before PF unload
390 */
391 }
392 rc = bnxt_close_nic(bp, true, false);
393 if (rc) {
394 netdev_err(bp->dev, "Set channel failure rc :%x\n",
395 rc);
396 return rc;
397 }
398 }
399
068c9ec6
MC
400 if (sh) {
401 bp->flags |= BNXT_FLAG_SHARED_RINGS;
402 bp->rx_nr_rings = channel->combined_count;
403 bp->tx_nr_rings_per_tc = channel->combined_count;
404 } else {
405 bp->flags &= ~BNXT_FLAG_SHARED_RINGS;
406 bp->rx_nr_rings = channel->rx_count;
407 bp->tx_nr_rings_per_tc = channel->tx_count;
408 }
409
c0c050c5
MC
410 bp->tx_nr_rings = bp->tx_nr_rings_per_tc;
411 if (tcs > 1)
412 bp->tx_nr_rings = bp->tx_nr_rings_per_tc * tcs;
068c9ec6
MC
413
414 bp->cp_nr_rings = sh ? max_t(int, bp->tx_nr_rings, bp->rx_nr_rings) :
415 bp->tx_nr_rings + bp->rx_nr_rings;
416
c0c050c5
MC
417 bp->num_stat_ctxs = bp->cp_nr_rings;
418
2bcfa6f6
MC
419 /* After changing number of rx channels, update NTUPLE feature. */
420 netdev_update_features(dev);
c0c050c5
MC
421 if (netif_running(dev)) {
422 rc = bnxt_open_nic(bp, true, false);
423 if ((!rc) && BNXT_PF(bp)) {
424 /* TODO CHIMP_FW: Send message to all VF's
425 * to renable
426 */
427 }
428 }
429
430 return rc;
431}
432
433#ifdef CONFIG_RFS_ACCEL
434static int bnxt_grxclsrlall(struct bnxt *bp, struct ethtool_rxnfc *cmd,
435 u32 *rule_locs)
436{
437 int i, j = 0;
438
439 cmd->data = bp->ntp_fltr_count;
440 for (i = 0; i < BNXT_NTP_FLTR_HASH_SIZE; i++) {
441 struct hlist_head *head;
442 struct bnxt_ntuple_filter *fltr;
443
444 head = &bp->ntp_fltr_hash_tbl[i];
445 rcu_read_lock();
446 hlist_for_each_entry_rcu(fltr, head, hash) {
447 if (j == cmd->rule_cnt)
448 break;
449 rule_locs[j++] = fltr->sw_id;
450 }
451 rcu_read_unlock();
452 if (j == cmd->rule_cnt)
453 break;
454 }
455 cmd->rule_cnt = j;
456 return 0;
457}
458
459static int bnxt_grxclsrule(struct bnxt *bp, struct ethtool_rxnfc *cmd)
460{
461 struct ethtool_rx_flow_spec *fs =
462 (struct ethtool_rx_flow_spec *)&cmd->fs;
463 struct bnxt_ntuple_filter *fltr;
464 struct flow_keys *fkeys;
465 int i, rc = -EINVAL;
466
467 if (fs->location < 0 || fs->location >= BNXT_NTP_FLTR_MAX_FLTR)
468 return rc;
469
470 for (i = 0; i < BNXT_NTP_FLTR_HASH_SIZE; i++) {
471 struct hlist_head *head;
472
473 head = &bp->ntp_fltr_hash_tbl[i];
474 rcu_read_lock();
475 hlist_for_each_entry_rcu(fltr, head, hash) {
476 if (fltr->sw_id == fs->location)
477 goto fltr_found;
478 }
479 rcu_read_unlock();
480 }
481 return rc;
482
483fltr_found:
484 fkeys = &fltr->fkeys;
485 if (fkeys->basic.ip_proto == IPPROTO_TCP)
486 fs->flow_type = TCP_V4_FLOW;
487 else if (fkeys->basic.ip_proto == IPPROTO_UDP)
488 fs->flow_type = UDP_V4_FLOW;
489 else
490 goto fltr_err;
491
492 fs->h_u.tcp_ip4_spec.ip4src = fkeys->addrs.v4addrs.src;
493 fs->m_u.tcp_ip4_spec.ip4src = cpu_to_be32(~0);
494
495 fs->h_u.tcp_ip4_spec.ip4dst = fkeys->addrs.v4addrs.dst;
496 fs->m_u.tcp_ip4_spec.ip4dst = cpu_to_be32(~0);
497
498 fs->h_u.tcp_ip4_spec.psrc = fkeys->ports.src;
499 fs->m_u.tcp_ip4_spec.psrc = cpu_to_be16(~0);
500
501 fs->h_u.tcp_ip4_spec.pdst = fkeys->ports.dst;
502 fs->m_u.tcp_ip4_spec.pdst = cpu_to_be16(~0);
503
504 fs->ring_cookie = fltr->rxq;
505 rc = 0;
506
507fltr_err:
508 rcu_read_unlock();
509
510 return rc;
511}
512
513static int bnxt_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
514 u32 *rule_locs)
515{
516 struct bnxt *bp = netdev_priv(dev);
517 int rc = 0;
518
519 switch (cmd->cmd) {
520 case ETHTOOL_GRXRINGS:
521 cmd->data = bp->rx_nr_rings;
522 break;
523
524 case ETHTOOL_GRXCLSRLCNT:
525 cmd->rule_cnt = bp->ntp_fltr_count;
526 cmd->data = BNXT_NTP_FLTR_MAX_FLTR;
527 break;
528
529 case ETHTOOL_GRXCLSRLALL:
530 rc = bnxt_grxclsrlall(bp, cmd, (u32 *)rule_locs);
531 break;
532
533 case ETHTOOL_GRXCLSRULE:
534 rc = bnxt_grxclsrule(bp, cmd);
535 break;
536
537 default:
538 rc = -EOPNOTSUPP;
539 break;
540 }
541
542 return rc;
543}
544#endif
545
546static u32 bnxt_get_rxfh_indir_size(struct net_device *dev)
547{
548 return HW_HASH_INDEX_SIZE;
549}
550
551static u32 bnxt_get_rxfh_key_size(struct net_device *dev)
552{
553 return HW_HASH_KEY_SIZE;
554}
555
556static int bnxt_get_rxfh(struct net_device *dev, u32 *indir, u8 *key,
557 u8 *hfunc)
558{
559 struct bnxt *bp = netdev_priv(dev);
560 struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
561 int i = 0;
562
563 if (hfunc)
564 *hfunc = ETH_RSS_HASH_TOP;
565
566 if (indir)
567 for (i = 0; i < HW_HASH_INDEX_SIZE; i++)
568 indir[i] = le16_to_cpu(vnic->rss_table[i]);
569
570 if (key)
571 memcpy(key, vnic->rss_hash_key, HW_HASH_KEY_SIZE);
572
573 return 0;
574}
575
576static void bnxt_get_drvinfo(struct net_device *dev,
577 struct ethtool_drvinfo *info)
578{
579 struct bnxt *bp = netdev_priv(dev);
3ebf6f0a
RS
580 char *pkglog;
581 char *pkgver = NULL;
c0c050c5 582
3ebf6f0a
RS
583 pkglog = kmalloc(BNX_PKG_LOG_MAX_LENGTH, GFP_KERNEL);
584 if (pkglog)
585 pkgver = bnxt_get_pkgver(dev, pkglog, BNX_PKG_LOG_MAX_LENGTH);
c0c050c5
MC
586 strlcpy(info->driver, DRV_MODULE_NAME, sizeof(info->driver));
587 strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
3ebf6f0a
RS
588 if (pkgver && *pkgver != 0 && isdigit(*pkgver))
589 snprintf(info->fw_version, sizeof(info->fw_version) - 1,
590 "%s pkg %s", bp->fw_ver_str, pkgver);
591 else
592 strlcpy(info->fw_version, bp->fw_ver_str,
593 sizeof(info->fw_version));
c0c050c5
MC
594 strlcpy(info->bus_info, pci_name(bp->pdev), sizeof(info->bus_info));
595 info->n_stats = BNXT_NUM_STATS * bp->cp_nr_rings;
596 info->testinfo_len = BNXT_NUM_TESTS(bp);
597 /* TODO CHIMP_FW: eeprom dump details */
598 info->eedump_len = 0;
599 /* TODO CHIMP FW: reg dump details */
600 info->regdump_len = 0;
3ebf6f0a 601 kfree(pkglog);
c0c050c5
MC
602}
603
170ce013 604u32 _bnxt_fw_to_ethtool_adv_spds(u16 fw_speeds, u8 fw_pause)
c0c050c5 605{
c0c050c5
MC
606 u32 speed_mask = 0;
607
608 /* TODO: support 25GB, 40GB, 50GB with different cable type */
609 /* set the advertised speeds */
610 if (fw_speeds & BNXT_LINK_SPEED_MSK_100MB)
611 speed_mask |= ADVERTISED_100baseT_Full;
612 if (fw_speeds & BNXT_LINK_SPEED_MSK_1GB)
613 speed_mask |= ADVERTISED_1000baseT_Full;
614 if (fw_speeds & BNXT_LINK_SPEED_MSK_2_5GB)
615 speed_mask |= ADVERTISED_2500baseX_Full;
616 if (fw_speeds & BNXT_LINK_SPEED_MSK_10GB)
617 speed_mask |= ADVERTISED_10000baseT_Full;
c0c050c5 618 if (fw_speeds & BNXT_LINK_SPEED_MSK_40GB)
1c49c421 619 speed_mask |= ADVERTISED_40000baseCR4_Full;
27c4d578
MC
620
621 if ((fw_pause & BNXT_LINK_PAUSE_BOTH) == BNXT_LINK_PAUSE_BOTH)
622 speed_mask |= ADVERTISED_Pause;
623 else if (fw_pause & BNXT_LINK_PAUSE_TX)
624 speed_mask |= ADVERTISED_Asym_Pause;
625 else if (fw_pause & BNXT_LINK_PAUSE_RX)
626 speed_mask |= ADVERTISED_Pause | ADVERTISED_Asym_Pause;
627
c0c050c5
MC
628 return speed_mask;
629}
630
27c4d578
MC
631static u32 bnxt_fw_to_ethtool_advertised_spds(struct bnxt_link_info *link_info)
632{
633 u16 fw_speeds = link_info->auto_link_speeds;
634 u8 fw_pause = 0;
635
636 if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
637 fw_pause = link_info->auto_pause_setting;
638
639 return _bnxt_fw_to_ethtool_adv_spds(fw_speeds, fw_pause);
640}
641
3277360e
MC
642static u32 bnxt_fw_to_ethtool_lp_adv(struct bnxt_link_info *link_info)
643{
644 u16 fw_speeds = link_info->lp_auto_link_speeds;
645 u8 fw_pause = 0;
646
647 if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
648 fw_pause = link_info->lp_pause;
649
650 return _bnxt_fw_to_ethtool_adv_spds(fw_speeds, fw_pause);
651}
652
4b32cacc
MC
653static u32 bnxt_fw_to_ethtool_support_spds(struct bnxt_link_info *link_info)
654{
655 u16 fw_speeds = link_info->support_speeds;
656 u32 supported;
657
658 supported = _bnxt_fw_to_ethtool_adv_spds(fw_speeds, 0);
659 return supported | SUPPORTED_Pause | SUPPORTED_Asym_Pause;
660}
661
93ed8117
MC
662static u32 bnxt_fw_to_ethtool_support_adv_spds(struct bnxt_link_info *link_info)
663{
664 u16 fw_speeds = link_info->support_auto_speeds;
665 u32 supported;
666
667 supported = _bnxt_fw_to_ethtool_adv_spds(fw_speeds, 0);
668 if (supported)
669 supported |= SUPPORTED_Pause | SUPPORTED_Asym_Pause;
670 return supported;
671}
672
c0c050c5
MC
673u32 bnxt_fw_to_ethtool_speed(u16 fw_link_speed)
674{
675 switch (fw_link_speed) {
676 case BNXT_LINK_SPEED_100MB:
677 return SPEED_100;
678 case BNXT_LINK_SPEED_1GB:
679 return SPEED_1000;
680 case BNXT_LINK_SPEED_2_5GB:
681 return SPEED_2500;
682 case BNXT_LINK_SPEED_10GB:
683 return SPEED_10000;
684 case BNXT_LINK_SPEED_20GB:
685 return SPEED_20000;
686 case BNXT_LINK_SPEED_25GB:
687 return SPEED_25000;
688 case BNXT_LINK_SPEED_40GB:
689 return SPEED_40000;
690 case BNXT_LINK_SPEED_50GB:
691 return SPEED_50000;
692 default:
693 return SPEED_UNKNOWN;
694 }
695}
696
697static int bnxt_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
698{
699 struct bnxt *bp = netdev_priv(dev);
700 struct bnxt_link_info *link_info = &bp->link_info;
701 u16 ethtool_speed;
702
703 cmd->supported = bnxt_fw_to_ethtool_support_spds(link_info);
704
93ed8117 705 if (link_info->support_auto_speeds)
c0c050c5
MC
706 cmd->supported |= SUPPORTED_Autoneg;
707
b763499e 708 if (link_info->autoneg) {
c0c050c5
MC
709 cmd->advertising =
710 bnxt_fw_to_ethtool_advertised_spds(link_info);
711 cmd->advertising |= ADVERTISED_Autoneg;
712 cmd->autoneg = AUTONEG_ENABLE;
3277360e
MC
713 if (link_info->phy_link_status == BNXT_LINK_LINK)
714 cmd->lp_advertising =
715 bnxt_fw_to_ethtool_lp_adv(link_info);
29c262fe
MC
716 ethtool_speed = bnxt_fw_to_ethtool_speed(link_info->link_speed);
717 if (!netif_carrier_ok(dev))
718 cmd->duplex = DUPLEX_UNKNOWN;
719 else if (link_info->duplex & BNXT_LINK_DUPLEX_FULL)
720 cmd->duplex = DUPLEX_FULL;
721 else
722 cmd->duplex = DUPLEX_HALF;
c0c050c5
MC
723 } else {
724 cmd->autoneg = AUTONEG_DISABLE;
725 cmd->advertising = 0;
29c262fe
MC
726 ethtool_speed =
727 bnxt_fw_to_ethtool_speed(link_info->req_link_speed);
728 cmd->duplex = DUPLEX_HALF;
729 if (link_info->req_duplex == BNXT_LINK_DUPLEX_FULL)
730 cmd->duplex = DUPLEX_FULL;
c0c050c5 731 }
29c262fe 732 ethtool_cmd_speed_set(cmd, ethtool_speed);
c0c050c5
MC
733
734 cmd->port = PORT_NONE;
735 if (link_info->media_type == PORT_PHY_QCFG_RESP_MEDIA_TYPE_TP) {
736 cmd->port = PORT_TP;
737 cmd->supported |= SUPPORTED_TP;
738 cmd->advertising |= ADVERTISED_TP;
739 } else {
740 cmd->supported |= SUPPORTED_FIBRE;
741 cmd->advertising |= ADVERTISED_FIBRE;
742
743 if (link_info->media_type == PORT_PHY_QCFG_RESP_MEDIA_TYPE_DAC)
744 cmd->port = PORT_DA;
745 else if (link_info->media_type ==
746 PORT_PHY_QCFG_RESP_MEDIA_TYPE_FIBRE)
747 cmd->port = PORT_FIBRE;
748 }
749
c0c050c5 750 if (link_info->transceiver ==
11f15ed3 751 PORT_PHY_QCFG_RESP_XCVR_PKG_TYPE_XCVR_INTERNAL)
c0c050c5
MC
752 cmd->transceiver = XCVR_INTERNAL;
753 else
754 cmd->transceiver = XCVR_EXTERNAL;
755 cmd->phy_address = link_info->phy_addr;
756
757 return 0;
758}
759
760static u32 bnxt_get_fw_speed(struct net_device *dev, u16 ethtool_speed)
761{
9d9cee08
MC
762 struct bnxt *bp = netdev_priv(dev);
763 struct bnxt_link_info *link_info = &bp->link_info;
764 u16 support_spds = link_info->support_speeds;
765 u32 fw_speed = 0;
766
c0c050c5
MC
767 switch (ethtool_speed) {
768 case SPEED_100:
9d9cee08
MC
769 if (support_spds & BNXT_LINK_SPEED_MSK_100MB)
770 fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_100MB;
771 break;
c0c050c5 772 case SPEED_1000:
9d9cee08
MC
773 if (support_spds & BNXT_LINK_SPEED_MSK_1GB)
774 fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_1GB;
775 break;
c0c050c5 776 case SPEED_2500:
9d9cee08
MC
777 if (support_spds & BNXT_LINK_SPEED_MSK_2_5GB)
778 fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_2_5GB;
779 break;
c0c050c5 780 case SPEED_10000:
9d9cee08
MC
781 if (support_spds & BNXT_LINK_SPEED_MSK_10GB)
782 fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_10GB;
783 break;
c0c050c5 784 case SPEED_20000:
9d9cee08
MC
785 if (support_spds & BNXT_LINK_SPEED_MSK_20GB)
786 fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_20GB;
787 break;
c0c050c5 788 case SPEED_25000:
9d9cee08
MC
789 if (support_spds & BNXT_LINK_SPEED_MSK_25GB)
790 fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_25GB;
791 break;
c0c050c5 792 case SPEED_40000:
9d9cee08
MC
793 if (support_spds & BNXT_LINK_SPEED_MSK_40GB)
794 fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_40GB;
795 break;
c0c050c5 796 case SPEED_50000:
9d9cee08
MC
797 if (support_spds & BNXT_LINK_SPEED_MSK_50GB)
798 fw_speed = PORT_PHY_CFG_REQ_AUTO_LINK_SPEED_50GB;
799 break;
c0c050c5
MC
800 default:
801 netdev_err(dev, "unsupported speed!\n");
802 break;
803 }
9d9cee08 804 return fw_speed;
c0c050c5
MC
805}
806
939f7f0c 807u16 bnxt_get_fw_auto_link_speeds(u32 advertising)
c0c050c5
MC
808{
809 u16 fw_speed_mask = 0;
810
811 /* only support autoneg at speed 100, 1000, and 10000 */
812 if (advertising & (ADVERTISED_100baseT_Full |
813 ADVERTISED_100baseT_Half)) {
814 fw_speed_mask |= BNXT_LINK_SPEED_MSK_100MB;
815 }
816 if (advertising & (ADVERTISED_1000baseT_Full |
817 ADVERTISED_1000baseT_Half)) {
818 fw_speed_mask |= BNXT_LINK_SPEED_MSK_1GB;
819 }
820 if (advertising & ADVERTISED_10000baseT_Full)
821 fw_speed_mask |= BNXT_LINK_SPEED_MSK_10GB;
822
1c49c421
MC
823 if (advertising & ADVERTISED_40000baseCR4_Full)
824 fw_speed_mask |= BNXT_LINK_SPEED_MSK_40GB;
825
c0c050c5
MC
826 return fw_speed_mask;
827}
828
829static int bnxt_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
830{
831 int rc = 0;
832 struct bnxt *bp = netdev_priv(dev);
833 struct bnxt_link_info *link_info = &bp->link_info;
834 u32 speed, fw_advertising = 0;
835 bool set_pause = false;
836
567b2abe 837 if (!BNXT_SINGLE_PF(bp))
c0c050c5
MC
838 return rc;
839
840 if (cmd->autoneg == AUTONEG_ENABLE) {
93ed8117
MC
841 u32 supported_spds =
842 bnxt_fw_to_ethtool_support_adv_spds(link_info);
f1a082a6 843
93ed8117
MC
844 if (!supported_spds) {
845 netdev_err(dev, "Autoneg not supported\n");
846 rc = -EINVAL;
847 goto set_setting_exit;
848 }
f1a082a6
MC
849 if (cmd->advertising & ~(supported_spds | ADVERTISED_Autoneg |
850 ADVERTISED_TP | ADVERTISED_FIBRE)) {
c0c050c5
MC
851 netdev_err(dev, "Unsupported advertising mask (adv: 0x%x)\n",
852 cmd->advertising);
853 rc = -EINVAL;
854 goto set_setting_exit;
855 }
856 fw_advertising = bnxt_get_fw_auto_link_speeds(cmd->advertising);
c0c050c5
MC
857 link_info->autoneg |= BNXT_AUTONEG_SPEED;
858 if (!fw_advertising)
93ed8117 859 link_info->advertising = link_info->support_auto_speeds;
c0c050c5
MC
860 else
861 link_info->advertising = fw_advertising;
862 /* any change to autoneg will cause link change, therefore the
863 * driver should put back the original pause setting in autoneg
864 */
865 set_pause = true;
866 } else {
9d9cee08 867 u16 fw_speed;
03efbec0 868 u8 phy_type = link_info->phy_type;
9d9cee08 869
03efbec0
MC
870 if (phy_type == PORT_PHY_QCFG_RESP_PHY_TYPE_BASET ||
871 phy_type == PORT_PHY_QCFG_RESP_PHY_TYPE_BASETE ||
872 link_info->media_type == PORT_PHY_QCFG_RESP_MEDIA_TYPE_TP) {
873 netdev_err(dev, "10GBase-T devices must autoneg\n");
874 rc = -EINVAL;
875 goto set_setting_exit;
876 }
c0c050c5
MC
877 /* TODO: currently don't support half duplex */
878 if (cmd->duplex == DUPLEX_HALF) {
879 netdev_err(dev, "HALF DUPLEX is not supported!\n");
880 rc = -EINVAL;
881 goto set_setting_exit;
882 }
883 /* If received a request for an unknown duplex, assume full*/
884 if (cmd->duplex == DUPLEX_UNKNOWN)
885 cmd->duplex = DUPLEX_FULL;
886 speed = ethtool_cmd_speed(cmd);
9d9cee08
MC
887 fw_speed = bnxt_get_fw_speed(dev, speed);
888 if (!fw_speed) {
889 rc = -EINVAL;
890 goto set_setting_exit;
891 }
892 link_info->req_link_speed = fw_speed;
c0c050c5 893 link_info->req_duplex = BNXT_LINK_DUPLEX_FULL;
b763499e 894 link_info->autoneg = 0;
c0c050c5
MC
895 link_info->advertising = 0;
896 }
897
898 if (netif_running(dev))
939f7f0c 899 rc = bnxt_hwrm_set_link_setting(bp, set_pause, false);
c0c050c5
MC
900
901set_setting_exit:
902 return rc;
903}
904
905static void bnxt_get_pauseparam(struct net_device *dev,
906 struct ethtool_pauseparam *epause)
907{
908 struct bnxt *bp = netdev_priv(dev);
909 struct bnxt_link_info *link_info = &bp->link_info;
910
911 if (BNXT_VF(bp))
912 return;
b763499e 913 epause->autoneg = !!(link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL);
3c02d1bb
MC
914 epause->rx_pause = !!(link_info->req_flow_ctrl & BNXT_LINK_PAUSE_RX);
915 epause->tx_pause = !!(link_info->req_flow_ctrl & BNXT_LINK_PAUSE_TX);
c0c050c5
MC
916}
917
918static int bnxt_set_pauseparam(struct net_device *dev,
919 struct ethtool_pauseparam *epause)
920{
921 int rc = 0;
922 struct bnxt *bp = netdev_priv(dev);
923 struct bnxt_link_info *link_info = &bp->link_info;
924
567b2abe 925 if (!BNXT_SINGLE_PF(bp))
c0c050c5
MC
926 return rc;
927
928 if (epause->autoneg) {
b763499e
MC
929 if (!(link_info->autoneg & BNXT_AUTONEG_SPEED))
930 return -EINVAL;
931
c0c050c5 932 link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
c9ee9516
MC
933 if (bp->hwrm_spec_code >= 0x10201)
934 link_info->req_flow_ctrl =
935 PORT_PHY_CFG_REQ_AUTO_PAUSE_AUTONEG_PAUSE;
c0c050c5
MC
936 } else {
937 /* when transition from auto pause to force pause,
938 * force a link change
939 */
940 if (link_info->autoneg & BNXT_AUTONEG_FLOW_CTRL)
941 link_info->force_link_chng = true;
942 link_info->autoneg &= ~BNXT_AUTONEG_FLOW_CTRL;
c9ee9516 943 link_info->req_flow_ctrl = 0;
c0c050c5
MC
944 }
945 if (epause->rx_pause)
946 link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_RX;
c0c050c5
MC
947
948 if (epause->tx_pause)
949 link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX;
c0c050c5
MC
950
951 if (netif_running(dev))
952 rc = bnxt_hwrm_set_pause(bp);
953 return rc;
954}
955
956static u32 bnxt_get_link(struct net_device *dev)
957{
958 struct bnxt *bp = netdev_priv(dev);
959
960 /* TODO: handle MF, VF, driver close case */
961 return bp->link_info.link_up;
962}
963
964static int bnxt_flash_nvram(struct net_device *dev,
965 u16 dir_type,
966 u16 dir_ordinal,
967 u16 dir_ext,
968 u16 dir_attr,
969 const u8 *data,
970 size_t data_len)
971{
972 struct bnxt *bp = netdev_priv(dev);
973 int rc;
974 struct hwrm_nvm_write_input req = {0};
975 dma_addr_t dma_handle;
976 u8 *kmem;
977
978 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_WRITE, -1, -1);
979
980 req.dir_type = cpu_to_le16(dir_type);
981 req.dir_ordinal = cpu_to_le16(dir_ordinal);
982 req.dir_ext = cpu_to_le16(dir_ext);
983 req.dir_attr = cpu_to_le16(dir_attr);
984 req.dir_data_length = cpu_to_le32(data_len);
985
986 kmem = dma_alloc_coherent(&bp->pdev->dev, data_len, &dma_handle,
987 GFP_KERNEL);
988 if (!kmem) {
989 netdev_err(dev, "dma_alloc_coherent failure, length = %u\n",
990 (unsigned)data_len);
991 return -ENOMEM;
992 }
993 memcpy(kmem, data, data_len);
994 req.host_src_addr = cpu_to_le64(dma_handle);
995
996 rc = hwrm_send_message(bp, &req, sizeof(req), FLASH_NVRAM_TIMEOUT);
997 dma_free_coherent(&bp->pdev->dev, data_len, kmem, dma_handle);
998
999 return rc;
1000}
1001
d2d6318c
RS
1002static int bnxt_firmware_reset(struct net_device *dev,
1003 u16 dir_type)
1004{
1005 struct bnxt *bp = netdev_priv(dev);
1006 struct hwrm_fw_reset_input req = {0};
1007
1008 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FW_RESET, -1, -1);
1009
1010 /* TODO: Support ASAP ChiMP self-reset (e.g. upon PF driver unload) */
1011 /* TODO: Address self-reset of APE/KONG/BONO/TANG or ungraceful reset */
1012 /* (e.g. when firmware isn't already running) */
1013 switch (dir_type) {
1014 case BNX_DIR_TYPE_CHIMP_PATCH:
1015 case BNX_DIR_TYPE_BOOTCODE:
1016 case BNX_DIR_TYPE_BOOTCODE_2:
1017 req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_BOOT;
1018 /* Self-reset ChiMP upon next PCIe reset: */
1019 req.selfrst_status = FW_RESET_REQ_SELFRST_STATUS_SELFRSTPCIERST;
1020 break;
1021 case BNX_DIR_TYPE_APE_FW:
1022 case BNX_DIR_TYPE_APE_PATCH:
1023 req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_MGMT;
1024 break;
1025 case BNX_DIR_TYPE_KONG_FW:
1026 case BNX_DIR_TYPE_KONG_PATCH:
1027 req.embedded_proc_type =
1028 FW_RESET_REQ_EMBEDDED_PROC_TYPE_NETCTRL;
1029 break;
1030 case BNX_DIR_TYPE_BONO_FW:
1031 case BNX_DIR_TYPE_BONO_PATCH:
1032 req.embedded_proc_type = FW_RESET_REQ_EMBEDDED_PROC_TYPE_ROCE;
1033 break;
1034 default:
1035 return -EINVAL;
1036 }
1037
1038 return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
1039}
1040
c0c050c5
MC
1041static int bnxt_flash_firmware(struct net_device *dev,
1042 u16 dir_type,
1043 const u8 *fw_data,
1044 size_t fw_size)
1045{
1046 int rc = 0;
1047 u16 code_type;
1048 u32 stored_crc;
1049 u32 calculated_crc;
1050 struct bnxt_fw_header *header = (struct bnxt_fw_header *)fw_data;
1051
1052 switch (dir_type) {
1053 case BNX_DIR_TYPE_BOOTCODE:
1054 case BNX_DIR_TYPE_BOOTCODE_2:
1055 code_type = CODE_BOOT;
1056 break;
2731d70f
RS
1057 case BNX_DIR_TYPE_APE_FW:
1058 code_type = CODE_MCTP_PASSTHRU;
1059 break;
c0c050c5
MC
1060 default:
1061 netdev_err(dev, "Unsupported directory entry type: %u\n",
1062 dir_type);
1063 return -EINVAL;
1064 }
1065 if (fw_size < sizeof(struct bnxt_fw_header)) {
1066 netdev_err(dev, "Invalid firmware file size: %u\n",
1067 (unsigned int)fw_size);
1068 return -EINVAL;
1069 }
1070 if (header->signature != cpu_to_le32(BNXT_FIRMWARE_BIN_SIGNATURE)) {
1071 netdev_err(dev, "Invalid firmware signature: %08X\n",
1072 le32_to_cpu(header->signature));
1073 return -EINVAL;
1074 }
1075 if (header->code_type != code_type) {
1076 netdev_err(dev, "Expected firmware type: %d, read: %d\n",
1077 code_type, header->code_type);
1078 return -EINVAL;
1079 }
1080 if (header->device != DEVICE_CUMULUS_FAMILY) {
1081 netdev_err(dev, "Expected firmware device family %d, read: %d\n",
1082 DEVICE_CUMULUS_FAMILY, header->device);
1083 return -EINVAL;
1084 }
1085 /* Confirm the CRC32 checksum of the file: */
1086 stored_crc = le32_to_cpu(*(__le32 *)(fw_data + fw_size -
1087 sizeof(stored_crc)));
1088 calculated_crc = ~crc32(~0, fw_data, fw_size - sizeof(stored_crc));
1089 if (calculated_crc != stored_crc) {
1090 netdev_err(dev, "Firmware file CRC32 checksum (%08lX) does not match calculated checksum (%08lX)\n",
1091 (unsigned long)stored_crc,
1092 (unsigned long)calculated_crc);
1093 return -EINVAL;
1094 }
1095 /* TODO: Validate digital signature (RSA-encrypted SHA-256 hash) here */
1096 rc = bnxt_flash_nvram(dev, dir_type, BNX_DIR_ORDINAL_FIRST,
1097 0, 0, fw_data, fw_size);
d2d6318c
RS
1098 if (rc == 0) /* Firmware update successful */
1099 rc = bnxt_firmware_reset(dev, dir_type);
1100
c0c050c5
MC
1101 return rc;
1102}
1103
1104static bool bnxt_dir_type_is_ape_bin_format(u16 dir_type)
1105{
1106 switch (dir_type) {
1107 case BNX_DIR_TYPE_CHIMP_PATCH:
1108 case BNX_DIR_TYPE_BOOTCODE:
1109 case BNX_DIR_TYPE_BOOTCODE_2:
1110 case BNX_DIR_TYPE_APE_FW:
1111 case BNX_DIR_TYPE_APE_PATCH:
1112 case BNX_DIR_TYPE_KONG_FW:
1113 case BNX_DIR_TYPE_KONG_PATCH:
1114 return true;
1115 }
1116
1117 return false;
1118}
1119
1120static bool bnxt_dir_type_is_unprotected_exec_format(u16 dir_type)
1121{
1122 switch (dir_type) {
1123 case BNX_DIR_TYPE_AVS:
1124 case BNX_DIR_TYPE_EXP_ROM_MBA:
1125 case BNX_DIR_TYPE_PCIE:
1126 case BNX_DIR_TYPE_TSCF_UCODE:
1127 case BNX_DIR_TYPE_EXT_PHY:
1128 case BNX_DIR_TYPE_CCM:
1129 case BNX_DIR_TYPE_ISCSI_BOOT:
1130 case BNX_DIR_TYPE_ISCSI_BOOT_IPV6:
1131 case BNX_DIR_TYPE_ISCSI_BOOT_IPV4N6:
1132 return true;
1133 }
1134
1135 return false;
1136}
1137
1138static bool bnxt_dir_type_is_executable(u16 dir_type)
1139{
1140 return bnxt_dir_type_is_ape_bin_format(dir_type) ||
1141 bnxt_dir_type_is_unprotected_exec_format(dir_type);
1142}
1143
1144static int bnxt_flash_firmware_from_file(struct net_device *dev,
1145 u16 dir_type,
1146 const char *filename)
1147{
1148 const struct firmware *fw;
1149 int rc;
1150
1151 if (bnxt_dir_type_is_executable(dir_type) == false)
1152 return -EINVAL;
1153
1154 rc = request_firmware(&fw, filename, &dev->dev);
1155 if (rc != 0) {
1156 netdev_err(dev, "Error %d requesting firmware file: %s\n",
1157 rc, filename);
1158 return rc;
1159 }
1160 if (bnxt_dir_type_is_ape_bin_format(dir_type) == true)
1161 rc = bnxt_flash_firmware(dev, dir_type, fw->data, fw->size);
1162 else
1163 rc = bnxt_flash_nvram(dev, dir_type, BNX_DIR_ORDINAL_FIRST,
1164 0, 0, fw->data, fw->size);
1165 release_firmware(fw);
1166 return rc;
1167}
1168
1169static int bnxt_flash_package_from_file(struct net_device *dev,
1170 char *filename)
1171{
1172 netdev_err(dev, "packages are not yet supported\n");
1173 return -EINVAL;
1174}
1175
1176static int bnxt_flash_device(struct net_device *dev,
1177 struct ethtool_flash *flash)
1178{
1179 if (!BNXT_PF((struct bnxt *)netdev_priv(dev))) {
1180 netdev_err(dev, "flashdev not supported from a virtual function\n");
1181 return -EINVAL;
1182 }
1183
1184 if (flash->region == ETHTOOL_FLASH_ALL_REGIONS)
1185 return bnxt_flash_package_from_file(dev, flash->data);
1186
1187 return bnxt_flash_firmware_from_file(dev, flash->region, flash->data);
1188}
1189
1190static int nvm_get_dir_info(struct net_device *dev, u32 *entries, u32 *length)
1191{
1192 struct bnxt *bp = netdev_priv(dev);
1193 int rc;
1194 struct hwrm_nvm_get_dir_info_input req = {0};
1195 struct hwrm_nvm_get_dir_info_output *output = bp->hwrm_cmd_resp_addr;
1196
1197 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_GET_DIR_INFO, -1, -1);
1198
1199 mutex_lock(&bp->hwrm_cmd_lock);
1200 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
1201 if (!rc) {
1202 *entries = le32_to_cpu(output->entries);
1203 *length = le32_to_cpu(output->entry_length);
1204 }
1205 mutex_unlock(&bp->hwrm_cmd_lock);
1206 return rc;
1207}
1208
1209static int bnxt_get_eeprom_len(struct net_device *dev)
1210{
1211 /* The -1 return value allows the entire 32-bit range of offsets to be
1212 * passed via the ethtool command-line utility.
1213 */
1214 return -1;
1215}
1216
1217static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data)
1218{
1219 struct bnxt *bp = netdev_priv(dev);
1220 int rc;
1221 u32 dir_entries;
1222 u32 entry_length;
1223 u8 *buf;
1224 size_t buflen;
1225 dma_addr_t dma_handle;
1226 struct hwrm_nvm_get_dir_entries_input req = {0};
1227
1228 rc = nvm_get_dir_info(dev, &dir_entries, &entry_length);
1229 if (rc != 0)
1230 return rc;
1231
1232 /* Insert 2 bytes of directory info (count and size of entries) */
1233 if (len < 2)
1234 return -EINVAL;
1235
1236 *data++ = dir_entries;
1237 *data++ = entry_length;
1238 len -= 2;
1239 memset(data, 0xff, len);
1240
1241 buflen = dir_entries * entry_length;
1242 buf = dma_alloc_coherent(&bp->pdev->dev, buflen, &dma_handle,
1243 GFP_KERNEL);
1244 if (!buf) {
1245 netdev_err(dev, "dma_alloc_coherent failure, length = %u\n",
1246 (unsigned)buflen);
1247 return -ENOMEM;
1248 }
1249 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_GET_DIR_ENTRIES, -1, -1);
1250 req.host_dest_addr = cpu_to_le64(dma_handle);
1251 rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
1252 if (rc == 0)
1253 memcpy(data, buf, len > buflen ? buflen : len);
1254 dma_free_coherent(&bp->pdev->dev, buflen, buf, dma_handle);
1255 return rc;
1256}
1257
1258static int bnxt_get_nvram_item(struct net_device *dev, u32 index, u32 offset,
1259 u32 length, u8 *data)
1260{
1261 struct bnxt *bp = netdev_priv(dev);
1262 int rc;
1263 u8 *buf;
1264 dma_addr_t dma_handle;
1265 struct hwrm_nvm_read_input req = {0};
1266
1267 buf = dma_alloc_coherent(&bp->pdev->dev, length, &dma_handle,
1268 GFP_KERNEL);
1269 if (!buf) {
1270 netdev_err(dev, "dma_alloc_coherent failure, length = %u\n",
1271 (unsigned)length);
1272 return -ENOMEM;
1273 }
1274 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_READ, -1, -1);
1275 req.host_dest_addr = cpu_to_le64(dma_handle);
1276 req.dir_idx = cpu_to_le16(index);
1277 req.offset = cpu_to_le32(offset);
1278 req.len = cpu_to_le32(length);
1279
1280 rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
1281 if (rc == 0)
1282 memcpy(data, buf, length);
1283 dma_free_coherent(&bp->pdev->dev, length, buf, dma_handle);
1284 return rc;
1285}
1286
3ebf6f0a
RS
1287static int bnxt_find_nvram_item(struct net_device *dev, u16 type, u16 ordinal,
1288 u16 ext, u16 *index, u32 *item_length,
1289 u32 *data_length)
1290{
1291 struct bnxt *bp = netdev_priv(dev);
1292 int rc;
1293 struct hwrm_nvm_find_dir_entry_input req = {0};
1294 struct hwrm_nvm_find_dir_entry_output *output = bp->hwrm_cmd_resp_addr;
1295
1296 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_FIND_DIR_ENTRY, -1, -1);
1297 req.enables = 0;
1298 req.dir_idx = 0;
1299 req.dir_type = cpu_to_le16(type);
1300 req.dir_ordinal = cpu_to_le16(ordinal);
1301 req.dir_ext = cpu_to_le16(ext);
1302 req.opt_ordinal = NVM_FIND_DIR_ENTRY_REQ_OPT_ORDINAL_EQ;
90e20921 1303 rc = hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
3ebf6f0a
RS
1304 if (rc == 0) {
1305 if (index)
1306 *index = le16_to_cpu(output->dir_idx);
1307 if (item_length)
1308 *item_length = le32_to_cpu(output->dir_item_length);
1309 if (data_length)
1310 *data_length = le32_to_cpu(output->dir_data_length);
1311 }
1312 return rc;
1313}
1314
1315static char *bnxt_parse_pkglog(int desired_field, u8 *data, size_t datalen)
1316{
1317 char *retval = NULL;
1318 char *p;
1319 char *value;
1320 int field = 0;
1321
1322 if (datalen < 1)
1323 return NULL;
1324 /* null-terminate the log data (removing last '\n'): */
1325 data[datalen - 1] = 0;
1326 for (p = data; *p != 0; p++) {
1327 field = 0;
1328 retval = NULL;
1329 while (*p != 0 && *p != '\n') {
1330 value = p;
1331 while (*p != 0 && *p != '\t' && *p != '\n')
1332 p++;
1333 if (field == desired_field)
1334 retval = value;
1335 if (*p != '\t')
1336 break;
1337 *p = 0;
1338 field++;
1339 p++;
1340 }
1341 if (*p == 0)
1342 break;
1343 *p = 0;
1344 }
1345 return retval;
1346}
1347
1348static char *bnxt_get_pkgver(struct net_device *dev, char *buf, size_t buflen)
1349{
1350 u16 index = 0;
1351 u32 datalen;
1352
1353 if (bnxt_find_nvram_item(dev, BNX_DIR_TYPE_PKG_LOG,
1354 BNX_DIR_ORDINAL_FIRST, BNX_DIR_EXT_NONE,
1355 &index, NULL, &datalen) != 0)
1356 return NULL;
1357
1358 memset(buf, 0, buflen);
1359 if (bnxt_get_nvram_item(dev, index, 0, datalen, buf) != 0)
1360 return NULL;
1361
1362 return bnxt_parse_pkglog(BNX_PKG_LOG_FIELD_IDX_PKG_VERSION, buf,
1363 datalen);
1364}
1365
c0c050c5
MC
1366static int bnxt_get_eeprom(struct net_device *dev,
1367 struct ethtool_eeprom *eeprom,
1368 u8 *data)
1369{
1370 u32 index;
1371 u32 offset;
1372
1373 if (eeprom->offset == 0) /* special offset value to get directory */
1374 return bnxt_get_nvram_directory(dev, eeprom->len, data);
1375
1376 index = eeprom->offset >> 24;
1377 offset = eeprom->offset & 0xffffff;
1378
1379 if (index == 0) {
1380 netdev_err(dev, "unsupported index value: %d\n", index);
1381 return -EINVAL;
1382 }
1383
1384 return bnxt_get_nvram_item(dev, index - 1, offset, eeprom->len, data);
1385}
1386
1387static int bnxt_erase_nvram_directory(struct net_device *dev, u8 index)
1388{
1389 struct bnxt *bp = netdev_priv(dev);
1390 struct hwrm_nvm_erase_dir_entry_input req = {0};
1391
1392 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_ERASE_DIR_ENTRY, -1, -1);
1393 req.dir_idx = cpu_to_le16(index);
1394 return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
1395}
1396
1397static int bnxt_set_eeprom(struct net_device *dev,
1398 struct ethtool_eeprom *eeprom,
1399 u8 *data)
1400{
1401 struct bnxt *bp = netdev_priv(dev);
1402 u8 index, dir_op;
1403 u16 type, ext, ordinal, attr;
1404
1405 if (!BNXT_PF(bp)) {
1406 netdev_err(dev, "NVM write not supported from a virtual function\n");
1407 return -EINVAL;
1408 }
1409
1410 type = eeprom->magic >> 16;
1411
1412 if (type == 0xffff) { /* special value for directory operations */
1413 index = eeprom->magic & 0xff;
1414 dir_op = eeprom->magic >> 8;
1415 if (index == 0)
1416 return -EINVAL;
1417 switch (dir_op) {
1418 case 0x0e: /* erase */
1419 if (eeprom->offset != ~eeprom->magic)
1420 return -EINVAL;
1421 return bnxt_erase_nvram_directory(dev, index - 1);
1422 default:
1423 return -EINVAL;
1424 }
1425 }
1426
1427 /* Create or re-write an NVM item: */
1428 if (bnxt_dir_type_is_executable(type) == true)
1429 return -EINVAL;
1430 ext = eeprom->magic & 0xffff;
1431 ordinal = eeprom->offset >> 16;
1432 attr = eeprom->offset & 0xffff;
1433
1434 return bnxt_flash_nvram(dev, type, ordinal, ext, attr, data,
1435 eeprom->len);
1436}
1437
72b34f04
MC
1438static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
1439{
1440 struct bnxt *bp = netdev_priv(dev);
1441 struct ethtool_eee *eee = &bp->eee;
1442 struct bnxt_link_info *link_info = &bp->link_info;
1443 u32 advertising =
1444 _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
1445 int rc = 0;
1446
567b2abe 1447 if (!BNXT_SINGLE_PF(bp))
72b34f04
MC
1448 return 0;
1449
1450 if (!(bp->flags & BNXT_FLAG_EEE_CAP))
1451 return -EOPNOTSUPP;
1452
1453 if (!edata->eee_enabled)
1454 goto eee_ok;
1455
1456 if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {
1457 netdev_warn(dev, "EEE requires autoneg\n");
1458 return -EINVAL;
1459 }
1460 if (edata->tx_lpi_enabled) {
1461 if (bp->lpi_tmr_hi && (edata->tx_lpi_timer > bp->lpi_tmr_hi ||
1462 edata->tx_lpi_timer < bp->lpi_tmr_lo)) {
1463 netdev_warn(dev, "Valid LPI timer range is %d and %d microsecs\n",
1464 bp->lpi_tmr_lo, bp->lpi_tmr_hi);
1465 return -EINVAL;
1466 } else if (!bp->lpi_tmr_hi) {
1467 edata->tx_lpi_timer = eee->tx_lpi_timer;
1468 }
1469 }
1470 if (!edata->advertised) {
1471 edata->advertised = advertising & eee->supported;
1472 } else if (edata->advertised & ~advertising) {
1473 netdev_warn(dev, "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
1474 edata->advertised, advertising);
1475 return -EINVAL;
1476 }
1477
1478 eee->advertised = edata->advertised;
1479 eee->tx_lpi_enabled = edata->tx_lpi_enabled;
1480 eee->tx_lpi_timer = edata->tx_lpi_timer;
1481eee_ok:
1482 eee->eee_enabled = edata->eee_enabled;
1483
1484 if (netif_running(dev))
1485 rc = bnxt_hwrm_set_link_setting(bp, false, true);
1486
1487 return rc;
1488}
1489
1490static int bnxt_get_eee(struct net_device *dev, struct ethtool_eee *edata)
1491{
1492 struct bnxt *bp = netdev_priv(dev);
1493
1494 if (!(bp->flags & BNXT_FLAG_EEE_CAP))
1495 return -EOPNOTSUPP;
1496
1497 *edata = bp->eee;
1498 if (!bp->eee.eee_enabled) {
1499 /* Preserve tx_lpi_timer so that the last value will be used
1500 * by default when it is re-enabled.
1501 */
1502 edata->advertised = 0;
1503 edata->tx_lpi_enabled = 0;
1504 }
1505
1506 if (!bp->eee.eee_active)
1507 edata->lp_advertised = 0;
1508
1509 return 0;
1510}
1511
42ee18fe
AK
1512static int bnxt_read_sfp_module_eeprom_info(struct bnxt *bp, u16 i2c_addr,
1513 u16 page_number, u16 start_addr,
1514 u16 data_length, u8 *buf)
1515{
1516 struct hwrm_port_phy_i2c_read_input req = {0};
1517 struct hwrm_port_phy_i2c_read_output *output = bp->hwrm_cmd_resp_addr;
1518 int rc, byte_offset = 0;
1519
1520 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_PORT_PHY_I2C_READ, -1, -1);
1521 req.i2c_slave_addr = i2c_addr;
1522 req.page_number = cpu_to_le16(page_number);
1523 req.port_id = cpu_to_le16(bp->pf.port_id);
1524 do {
1525 u16 xfer_size;
1526
1527 xfer_size = min_t(u16, data_length, BNXT_MAX_PHY_I2C_RESP_SIZE);
1528 data_length -= xfer_size;
1529 req.page_offset = cpu_to_le16(start_addr + byte_offset);
1530 req.data_length = xfer_size;
1531 req.enables = cpu_to_le32(start_addr + byte_offset ?
1532 PORT_PHY_I2C_READ_REQ_ENABLES_PAGE_OFFSET : 0);
1533 mutex_lock(&bp->hwrm_cmd_lock);
1534 rc = _hwrm_send_message(bp, &req, sizeof(req),
1535 HWRM_CMD_TIMEOUT);
1536 if (!rc)
1537 memcpy(buf + byte_offset, output->data, xfer_size);
1538 mutex_unlock(&bp->hwrm_cmd_lock);
1539 byte_offset += xfer_size;
1540 } while (!rc && data_length > 0);
1541
1542 return rc;
1543}
1544
1545static int bnxt_get_module_info(struct net_device *dev,
1546 struct ethtool_modinfo *modinfo)
1547{
1548 struct bnxt *bp = netdev_priv(dev);
1549 struct hwrm_port_phy_i2c_read_input req = {0};
1550 struct hwrm_port_phy_i2c_read_output *output = bp->hwrm_cmd_resp_addr;
1551 int rc;
1552
1553 /* No point in going further if phy status indicates
1554 * module is not inserted or if it is powered down or
1555 * if it is of type 10GBase-T
1556 */
1557 if (bp->link_info.module_status >
1558 PORT_PHY_QCFG_RESP_MODULE_STATUS_WARNINGMSG)
1559 return -EOPNOTSUPP;
1560
1561 /* This feature is not supported in older firmware versions */
1562 if (bp->hwrm_spec_code < 0x10202)
1563 return -EOPNOTSUPP;
1564
1565 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_PORT_PHY_I2C_READ, -1, -1);
1566 req.i2c_slave_addr = I2C_DEV_ADDR_A0;
1567 req.page_number = 0;
1568 req.page_offset = cpu_to_le16(SFP_EEPROM_SFF_8472_COMP_ADDR);
1569 req.data_length = SFP_EEPROM_SFF_8472_COMP_SIZE;
1570 req.port_id = cpu_to_le16(bp->pf.port_id);
1571 mutex_lock(&bp->hwrm_cmd_lock);
1572 rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
1573 if (!rc) {
1574 u32 module_id = le32_to_cpu(output->data[0]);
1575
1576 switch (module_id) {
1577 case SFF_MODULE_ID_SFP:
1578 modinfo->type = ETH_MODULE_SFF_8472;
1579 modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN;
1580 break;
1581 case SFF_MODULE_ID_QSFP:
1582 case SFF_MODULE_ID_QSFP_PLUS:
1583 modinfo->type = ETH_MODULE_SFF_8436;
1584 modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN;
1585 break;
1586 case SFF_MODULE_ID_QSFP28:
1587 modinfo->type = ETH_MODULE_SFF_8636;
1588 modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN;
1589 break;
1590 default:
1591 rc = -EOPNOTSUPP;
1592 break;
1593 }
1594 }
1595 mutex_unlock(&bp->hwrm_cmd_lock);
1596 return rc;
1597}
1598
1599static int bnxt_get_module_eeprom(struct net_device *dev,
1600 struct ethtool_eeprom *eeprom,
1601 u8 *data)
1602{
1603 struct bnxt *bp = netdev_priv(dev);
1604 u16 start = eeprom->offset, length = eeprom->len;
1605 int rc;
1606
1607 memset(data, 0, eeprom->len);
1608
1609 /* Read A0 portion of the EEPROM */
1610 if (start < ETH_MODULE_SFF_8436_LEN) {
1611 if (start + eeprom->len > ETH_MODULE_SFF_8436_LEN)
1612 length = ETH_MODULE_SFF_8436_LEN - start;
1613 rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A0, 0,
1614 start, length, data);
1615 if (rc)
1616 return rc;
1617 start += length;
1618 data += length;
1619 length = eeprom->len - length;
1620 }
1621
1622 /* Read A2 portion of the EEPROM */
1623 if (length) {
1624 start -= ETH_MODULE_SFF_8436_LEN;
1625 bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 1, start,
1626 length, data);
1627 }
1628 return rc;
1629}
1630
c0c050c5
MC
1631const struct ethtool_ops bnxt_ethtool_ops = {
1632 .get_settings = bnxt_get_settings,
1633 .set_settings = bnxt_set_settings,
1634 .get_pauseparam = bnxt_get_pauseparam,
1635 .set_pauseparam = bnxt_set_pauseparam,
1636 .get_drvinfo = bnxt_get_drvinfo,
1637 .get_coalesce = bnxt_get_coalesce,
1638 .set_coalesce = bnxt_set_coalesce,
1639 .get_msglevel = bnxt_get_msglevel,
1640 .set_msglevel = bnxt_set_msglevel,
1641 .get_sset_count = bnxt_get_sset_count,
1642 .get_strings = bnxt_get_strings,
1643 .get_ethtool_stats = bnxt_get_ethtool_stats,
1644 .set_ringparam = bnxt_set_ringparam,
1645 .get_ringparam = bnxt_get_ringparam,
1646 .get_channels = bnxt_get_channels,
1647 .set_channels = bnxt_set_channels,
1648#ifdef CONFIG_RFS_ACCEL
1649 .get_rxnfc = bnxt_get_rxnfc,
1650#endif
1651 .get_rxfh_indir_size = bnxt_get_rxfh_indir_size,
1652 .get_rxfh_key_size = bnxt_get_rxfh_key_size,
1653 .get_rxfh = bnxt_get_rxfh,
1654 .flash_device = bnxt_flash_device,
1655 .get_eeprom_len = bnxt_get_eeprom_len,
1656 .get_eeprom = bnxt_get_eeprom,
1657 .set_eeprom = bnxt_set_eeprom,
1658 .get_link = bnxt_get_link,
72b34f04
MC
1659 .get_eee = bnxt_get_eee,
1660 .set_eee = bnxt_set_eee,
42ee18fe
AK
1661 .get_module_info = bnxt_get_module_info,
1662 .get_module_eeprom = bnxt_get_module_eeprom,
c0c050c5 1663};
This page took 0.145396 seconds and 5 git commands to generate.