1 // SPDX-License-Identifier: GPL-2.0-only
2 /****************************************************************************
3 * Driver for Solarflare network controllers and boards
4 * Copyright 2005-2006 Fen Systems Ltd.
5 * Copyright 2005-2013 Solarflare Communications Inc.
6 */
7
8 #include <linux/module.h>
9 #include <linux/pci.h>
10 #include <linux/netdevice.h>
11 #include <linux/etherdevice.h>
12 #include <linux/delay.h>
13 #include <linux/notifier.h>
14 #include <linux/ip.h>
15 #include <linux/tcp.h>
16 #include <linux/in.h>
17 #include <linux/ethtool.h>
18 #include <linux/topology.h>
19 #include <linux/gfp.h>
20 #include <linux/aer.h>
21 #include <linux/interrupt.h>
22 #include "net_driver.h"
23 #include <net/gre.h>
24 #include <net/udp_tunnel.h>
25 #include "efx.h"
26 #include "efx_common.h"
27 #include "efx_channels.h"
28 #include "ef100.h"
29 #include "rx_common.h"
30 #include "tx_common.h"
31 #include "nic.h"
32 #include "io.h"
33 #include "selftest.h"
34 #include "sriov.h"
35
36 #include "mcdi_port_common.h"
37 #include "mcdi_pcol.h"
38 #include "workarounds.h"
39
40 /**************************************************************************
41 *
42 * Configurable values
43 *
44 *************************************************************************/
45
46 module_param_named(interrupt_mode, efx_interrupt_mode, uint, 0444);
47 MODULE_PARM_DESC(interrupt_mode,
48 "Interrupt mode (0=>MSIX 1=>MSI 2=>legacy)");
49
50 module_param(rss_cpus, uint, 0444);
51 MODULE_PARM_DESC(rss_cpus, "Number of CPUs to use for Receive-Side Scaling");
52
53 /*
54 * Use separate channels for TX and RX events
55 *
56 * Set this to 1 to use separate channels for TX and RX. It allows us
57 * to control interrupt affinity separately for TX and RX.
58 *
59 * This is only used in MSI-X interrupt mode
60 */
61 bool efx_separate_tx_channels;
62 module_param(efx_separate_tx_channels, bool, 0444);
63 MODULE_PARM_DESC(efx_separate_tx_channels,
64 "Use separate channels for TX and RX");
65
66 /* Initial interrupt moderation settings. They can be modified after
67 * module load with ethtool.
68 *
69 * The default for RX should strike a balance between increasing the
70 * round-trip latency and reducing overhead.
71 */
72 static unsigned int rx_irq_mod_usec = 60;
73
74 /* Initial interrupt moderation settings. They can be modified after
75 * module load with ethtool.
76 *
77 * This default is chosen to ensure that a 10G link does not go idle
78 * while a TX queue is stopped after it has become full. A queue is
79 * restarted when it drops below half full. The time this takes (assuming
80 * worst case 3 descriptors per packet and 1024 descriptors) is
81 * 512 / 3 * 1.2 = 205 usec.
82 */
83 static unsigned int tx_irq_mod_usec = 150;
84
85 static bool phy_flash_cfg;
86 module_param(phy_flash_cfg, bool, 0644);
87 MODULE_PARM_DESC(phy_flash_cfg, "Set PHYs into reflash mode initially");
88
89 static unsigned debug = (NETIF_MSG_DRV | NETIF_MSG_PROBE |
90 NETIF_MSG_LINK | NETIF_MSG_IFDOWN |
91 NETIF_MSG_IFUP | NETIF_MSG_RX_ERR |
92 NETIF_MSG_TX_ERR | NETIF_MSG_HW);
93 module_param(debug, uint, 0);
94 MODULE_PARM_DESC(debug, "Bitmapped debugging message enable value");
95
96 /**************************************************************************
97 *
98 * Utility functions and prototypes
99 *
100 *************************************************************************/
101
102 static void efx_remove_port(struct efx_nic *efx);
103 static int efx_xdp_setup_prog(struct efx_nic *efx, struct bpf_prog *prog);
104 static int efx_xdp(struct net_device *dev, struct netdev_bpf *xdp);
105 static int efx_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **xdpfs,
106 u32 flags);
107
108 /**************************************************************************
109 *
110 * Port handling
111 *
112 **************************************************************************/
113
114 static void efx_fini_port(struct efx_nic *efx);
115
efx_probe_port(struct efx_nic * efx)116 static int efx_probe_port(struct efx_nic *efx)
117 {
118 int rc;
119
120 netif_dbg(efx, probe, efx->net_dev, "create port\n");
121
122 if (phy_flash_cfg)
123 efx->phy_mode = PHY_MODE_SPECIAL;
124
125 /* Connect up MAC/PHY operations table */
126 rc = efx->type->probe_port(efx);
127 if (rc)
128 return rc;
129
130 /* Initialise MAC address to permanent address */
131 eth_hw_addr_set(efx->net_dev, efx->net_dev->perm_addr);
132
133 return 0;
134 }
135
efx_init_port(struct efx_nic * efx)136 static int efx_init_port(struct efx_nic *efx)
137 {
138 int rc;
139
140 netif_dbg(efx, drv, efx->net_dev, "init port\n");
141
142 mutex_lock(&efx->mac_lock);
143
144 efx->port_initialized = true;
145
146 /* Ensure the PHY advertises the correct flow control settings */
147 rc = efx_mcdi_port_reconfigure(efx);
148 if (rc && rc != -EPERM)
149 goto fail;
150
151 mutex_unlock(&efx->mac_lock);
152 return 0;
153
154 fail:
155 mutex_unlock(&efx->mac_lock);
156 return rc;
157 }
158
efx_fini_port(struct efx_nic * efx)159 static void efx_fini_port(struct efx_nic *efx)
160 {
161 netif_dbg(efx, drv, efx->net_dev, "shut down port\n");
162
163 if (!efx->port_initialized)
164 return;
165
166 efx->port_initialized = false;
167
168 efx->link_state.up = false;
169 efx_link_status_changed(efx);
170 }
171
efx_remove_port(struct efx_nic * efx)172 static void efx_remove_port(struct efx_nic *efx)
173 {
174 netif_dbg(efx, drv, efx->net_dev, "destroying port\n");
175
176 efx->type->remove_port(efx);
177 }
178
179 /**************************************************************************
180 *
181 * NIC handling
182 *
183 **************************************************************************/
184
185 static LIST_HEAD(efx_primary_list);
186 static LIST_HEAD(efx_unassociated_list);
187
efx_same_controller(struct efx_nic * left,struct efx_nic * right)188 static bool efx_same_controller(struct efx_nic *left, struct efx_nic *right)
189 {
190 return left->type == right->type &&
191 left->vpd_sn && right->vpd_sn &&
192 !strcmp(left->vpd_sn, right->vpd_sn);
193 }
194
efx_associate(struct efx_nic * efx)195 static void efx_associate(struct efx_nic *efx)
196 {
197 struct efx_nic *other, *next;
198
199 if (efx->primary == efx) {
200 /* Adding primary function; look for secondaries */
201
202 netif_dbg(efx, probe, efx->net_dev, "adding to primary list\n");
203 list_add_tail(&efx->node, &efx_primary_list);
204
205 list_for_each_entry_safe(other, next, &efx_unassociated_list,
206 node) {
207 if (efx_same_controller(efx, other)) {
208 list_del(&other->node);
209 netif_dbg(other, probe, other->net_dev,
210 "moving to secondary list of %s %s\n",
211 pci_name(efx->pci_dev),
212 efx->net_dev->name);
213 list_add_tail(&other->node,
214 &efx->secondary_list);
215 other->primary = efx;
216 }
217 }
218 } else {
219 /* Adding secondary function; look for primary */
220
221 list_for_each_entry(other, &efx_primary_list, node) {
222 if (efx_same_controller(efx, other)) {
223 netif_dbg(efx, probe, efx->net_dev,
224 "adding to secondary list of %s %s\n",
225 pci_name(other->pci_dev),
226 other->net_dev->name);
227 list_add_tail(&efx->node,
228 &other->secondary_list);
229 efx->primary = other;
230 return;
231 }
232 }
233
234 netif_dbg(efx, probe, efx->net_dev,
235 "adding to unassociated list\n");
236 list_add_tail(&efx->node, &efx_unassociated_list);
237 }
238 }
239
efx_dissociate(struct efx_nic * efx)240 static void efx_dissociate(struct efx_nic *efx)
241 {
242 struct efx_nic *other, *next;
243
244 list_del(&efx->node);
245 efx->primary = NULL;
246
247 list_for_each_entry_safe(other, next, &efx->secondary_list, node) {
248 list_del(&other->node);
249 netif_dbg(other, probe, other->net_dev,
250 "moving to unassociated list\n");
251 list_add_tail(&other->node, &efx_unassociated_list);
252 other->primary = NULL;
253 }
254 }
255
efx_probe_nic(struct efx_nic * efx)256 static int efx_probe_nic(struct efx_nic *efx)
257 {
258 int rc;
259
260 netif_dbg(efx, probe, efx->net_dev, "creating NIC\n");
261
262 /* Carry out hardware-type specific initialisation */
263 rc = efx->type->probe(efx);
264 if (rc)
265 return rc;
266
267 do {
268 if (!efx->max_channels || !efx->max_tx_channels) {
269 netif_err(efx, drv, efx->net_dev,
270 "Insufficient resources to allocate"
271 " any channels\n");
272 rc = -ENOSPC;
273 goto fail1;
274 }
275
276 /* Determine the number of channels and queues by trying
277 * to hook in MSI-X interrupts.
278 */
279 rc = efx_probe_interrupts(efx);
280 if (rc)
281 goto fail1;
282
283 rc = efx_set_channels(efx);
284 if (rc)
285 goto fail1;
286
287 /* dimension_resources can fail with EAGAIN */
288 rc = efx->type->dimension_resources(efx);
289 if (rc != 0 && rc != -EAGAIN)
290 goto fail2;
291
292 if (rc == -EAGAIN)
293 /* try again with new max_channels */
294 efx_remove_interrupts(efx);
295
296 } while (rc == -EAGAIN);
297
298 if (efx->n_channels > 1)
299 netdev_rss_key_fill(efx->rss_context.rx_hash_key,
300 sizeof(efx->rss_context.rx_hash_key));
301 efx_set_default_rx_indir_table(efx, &efx->rss_context);
302
303 /* Initialise the interrupt moderation settings */
304 efx->irq_mod_step_us = DIV_ROUND_UP(efx->timer_quantum_ns, 1000);
305 efx_init_irq_moderation(efx, tx_irq_mod_usec, rx_irq_mod_usec, true,
306 true);
307
308 return 0;
309
310 fail2:
311 efx_remove_interrupts(efx);
312 fail1:
313 efx->type->remove(efx);
314 return rc;
315 }
316
efx_remove_nic(struct efx_nic * efx)317 static void efx_remove_nic(struct efx_nic *efx)
318 {
319 netif_dbg(efx, drv, efx->net_dev, "destroying NIC\n");
320
321 efx_remove_interrupts(efx);
322 efx->type->remove(efx);
323 }
324
325 /**************************************************************************
326 *
327 * NIC startup/shutdown
328 *
329 *************************************************************************/
330
efx_probe_all(struct efx_nic * efx)331 static int efx_probe_all(struct efx_nic *efx)
332 {
333 int rc;
334
335 rc = efx_probe_nic(efx);
336 if (rc) {
337 netif_err(efx, probe, efx->net_dev, "failed to create NIC\n");
338 goto fail1;
339 }
340
341 rc = efx_probe_port(efx);
342 if (rc) {
343 netif_err(efx, probe, efx->net_dev, "failed to create port\n");
344 goto fail2;
345 }
346
347 BUILD_BUG_ON(EFX_DEFAULT_DMAQ_SIZE < EFX_RXQ_MIN_ENT);
348 if (WARN_ON(EFX_DEFAULT_DMAQ_SIZE < EFX_TXQ_MIN_ENT(efx))) {
349 rc = -EINVAL;
350 goto fail3;
351 }
352
353 #ifdef CONFIG_SFC_SRIOV
354 rc = efx->type->vswitching_probe(efx);
355 if (rc) /* not fatal; the PF will still work fine */
356 netif_warn(efx, probe, efx->net_dev,
357 "failed to setup vswitching rc=%d;"
358 " VFs may not function\n", rc);
359 #endif
360
361 rc = efx_probe_filters(efx);
362 if (rc) {
363 netif_err(efx, probe, efx->net_dev,
364 "failed to create filter tables\n");
365 goto fail4;
366 }
367
368 rc = efx_probe_channels(efx);
369 if (rc)
370 goto fail5;
371
372 efx->state = STATE_NET_DOWN;
373
374 return 0;
375
376 fail5:
377 efx_remove_filters(efx);
378 fail4:
379 #ifdef CONFIG_SFC_SRIOV
380 efx->type->vswitching_remove(efx);
381 #endif
382 fail3:
383 efx_remove_port(efx);
384 fail2:
385 efx_remove_nic(efx);
386 fail1:
387 return rc;
388 }
389
efx_remove_all(struct efx_nic * efx)390 static void efx_remove_all(struct efx_nic *efx)
391 {
392 rtnl_lock();
393 efx_xdp_setup_prog(efx, NULL);
394 rtnl_unlock();
395
396 efx_remove_channels(efx);
397 efx_remove_filters(efx);
398 #ifdef CONFIG_SFC_SRIOV
399 efx->type->vswitching_remove(efx);
400 #endif
401 efx_remove_port(efx);
402 efx_remove_nic(efx);
403 }
404
405 /**************************************************************************
406 *
407 * Interrupt moderation
408 *
409 **************************************************************************/
efx_usecs_to_ticks(struct efx_nic * efx,unsigned int usecs)410 unsigned int efx_usecs_to_ticks(struct efx_nic *efx, unsigned int usecs)
411 {
412 if (usecs == 0)
413 return 0;
414 if (usecs * 1000 < efx->timer_quantum_ns)
415 return 1; /* never round down to 0 */
416 return usecs * 1000 / efx->timer_quantum_ns;
417 }
418
efx_ticks_to_usecs(struct efx_nic * efx,unsigned int ticks)419 unsigned int efx_ticks_to_usecs(struct efx_nic *efx, unsigned int ticks)
420 {
421 /* We must round up when converting ticks to microseconds
422 * because we round down when converting the other way.
423 */
424 return DIV_ROUND_UP(ticks * efx->timer_quantum_ns, 1000);
425 }
426
427 /* Set interrupt moderation parameters */
efx_init_irq_moderation(struct efx_nic * efx,unsigned int tx_usecs,unsigned int rx_usecs,bool rx_adaptive,bool rx_may_override_tx)428 int efx_init_irq_moderation(struct efx_nic *efx, unsigned int tx_usecs,
429 unsigned int rx_usecs, bool rx_adaptive,
430 bool rx_may_override_tx)
431 {
432 struct efx_channel *channel;
433 unsigned int timer_max_us;
434
435 EFX_ASSERT_RESET_SERIALISED(efx);
436
437 timer_max_us = efx->timer_max_ns / 1000;
438
439 if (tx_usecs > timer_max_us || rx_usecs > timer_max_us)
440 return -EINVAL;
441
442 if (tx_usecs != rx_usecs && efx->tx_channel_offset == 0 &&
443 !rx_may_override_tx) {
444 netif_err(efx, drv, efx->net_dev, "Channels are shared. "
445 "RX and TX IRQ moderation must be equal\n");
446 return -EINVAL;
447 }
448
449 efx->irq_rx_adaptive = rx_adaptive;
450 efx->irq_rx_moderation_us = rx_usecs;
451 efx_for_each_channel(channel, efx) {
452 if (efx_channel_has_rx_queue(channel))
453 channel->irq_moderation_us = rx_usecs;
454 else if (efx_channel_has_tx_queues(channel))
455 channel->irq_moderation_us = tx_usecs;
456 else if (efx_channel_is_xdp_tx(channel))
457 channel->irq_moderation_us = tx_usecs;
458 }
459
460 return 0;
461 }
462
efx_get_irq_moderation(struct efx_nic * efx,unsigned int * tx_usecs,unsigned int * rx_usecs,bool * rx_adaptive)463 void efx_get_irq_moderation(struct efx_nic *efx, unsigned int *tx_usecs,
464 unsigned int *rx_usecs, bool *rx_adaptive)
465 {
466 *rx_adaptive = efx->irq_rx_adaptive;
467 *rx_usecs = efx->irq_rx_moderation_us;
468
469 /* If channels are shared between RX and TX, so is IRQ
470 * moderation. Otherwise, IRQ moderation is the same for all
471 * TX channels and is not adaptive.
472 */
473 if (efx->tx_channel_offset == 0) {
474 *tx_usecs = *rx_usecs;
475 } else {
476 struct efx_channel *tx_channel;
477
478 tx_channel = efx->channel[efx->tx_channel_offset];
479 *tx_usecs = tx_channel->irq_moderation_us;
480 }
481 }
482
483 /**************************************************************************
484 *
485 * ioctls
486 *
487 *************************************************************************/
488
489 /* Net device ioctl
490 * Context: process, rtnl_lock() held.
491 */
efx_ioctl(struct net_device * net_dev,struct ifreq * ifr,int cmd)492 static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
493 {
494 struct efx_nic *efx = netdev_priv(net_dev);
495 struct mii_ioctl_data *data = if_mii(ifr);
496
497 if (cmd == SIOCSHWTSTAMP)
498 return efx_ptp_set_ts_config(efx, ifr);
499 if (cmd == SIOCGHWTSTAMP)
500 return efx_ptp_get_ts_config(efx, ifr);
501
502 /* Convert phy_id from older PRTAD/DEVAD format */
503 if ((cmd == SIOCGMIIREG || cmd == SIOCSMIIREG) &&
504 (data->phy_id & 0xfc00) == 0x0400)
505 data->phy_id ^= MDIO_PHY_ID_C45 | 0x0400;
506
507 return mdio_mii_ioctl(&efx->mdio, data, cmd);
508 }
509
510 /**************************************************************************
511 *
512 * Kernel net device interface
513 *
514 *************************************************************************/
515
516 /* Context: process, rtnl_lock() held. */
efx_net_open(struct net_device * net_dev)517 int efx_net_open(struct net_device *net_dev)
518 {
519 struct efx_nic *efx = netdev_priv(net_dev);
520 int rc;
521
522 netif_dbg(efx, ifup, efx->net_dev, "opening device on CPU %d\n",
523 raw_smp_processor_id());
524
525 rc = efx_check_disabled(efx);
526 if (rc)
527 return rc;
528 if (efx->phy_mode & PHY_MODE_SPECIAL)
529 return -EBUSY;
530 if (efx_mcdi_poll_reboot(efx) && efx_reset(efx, RESET_TYPE_ALL))
531 return -EIO;
532
533 /* Notify the kernel of the link state polled during driver load,
534 * before the monitor starts running */
535 efx_link_status_changed(efx);
536
537 efx_start_all(efx);
538 if (efx->state == STATE_DISABLED || efx->reset_pending)
539 netif_device_detach(efx->net_dev);
540 else
541 efx->state = STATE_NET_UP;
542
543 return 0;
544 }
545
546 /* Context: process, rtnl_lock() held.
547 * Note that the kernel will ignore our return code; this method
548 * should really be a void.
549 */
efx_net_stop(struct net_device * net_dev)550 int efx_net_stop(struct net_device *net_dev)
551 {
552 struct efx_nic *efx = netdev_priv(net_dev);
553
554 netif_dbg(efx, ifdown, efx->net_dev, "closing on CPU %d\n",
555 raw_smp_processor_id());
556
557 /* Stop the device and flush all the channels */
558 efx_stop_all(efx);
559
560 return 0;
561 }
562
efx_vlan_rx_add_vid(struct net_device * net_dev,__be16 proto,u16 vid)563 static int efx_vlan_rx_add_vid(struct net_device *net_dev, __be16 proto, u16 vid)
564 {
565 struct efx_nic *efx = netdev_priv(net_dev);
566
567 if (efx->type->vlan_rx_add_vid)
568 return efx->type->vlan_rx_add_vid(efx, proto, vid);
569 else
570 return -EOPNOTSUPP;
571 }
572
efx_vlan_rx_kill_vid(struct net_device * net_dev,__be16 proto,u16 vid)573 static int efx_vlan_rx_kill_vid(struct net_device *net_dev, __be16 proto, u16 vid)
574 {
575 struct efx_nic *efx = netdev_priv(net_dev);
576
577 if (efx->type->vlan_rx_kill_vid)
578 return efx->type->vlan_rx_kill_vid(efx, proto, vid);
579 else
580 return -EOPNOTSUPP;
581 }
582
583 static const struct net_device_ops efx_netdev_ops = {
584 .ndo_open = efx_net_open,
585 .ndo_stop = efx_net_stop,
586 .ndo_get_stats64 = efx_net_stats,
587 .ndo_tx_timeout = efx_watchdog,
588 .ndo_start_xmit = efx_hard_start_xmit,
589 .ndo_validate_addr = eth_validate_addr,
590 .ndo_eth_ioctl = efx_ioctl,
591 .ndo_change_mtu = efx_change_mtu,
592 .ndo_set_mac_address = efx_set_mac_address,
593 .ndo_set_rx_mode = efx_set_rx_mode,
594 .ndo_set_features = efx_set_features,
595 .ndo_features_check = efx_features_check,
596 .ndo_vlan_rx_add_vid = efx_vlan_rx_add_vid,
597 .ndo_vlan_rx_kill_vid = efx_vlan_rx_kill_vid,
598 #ifdef CONFIG_SFC_SRIOV
599 .ndo_set_vf_mac = efx_sriov_set_vf_mac,
600 .ndo_set_vf_vlan = efx_sriov_set_vf_vlan,
601 .ndo_set_vf_spoofchk = efx_sriov_set_vf_spoofchk,
602 .ndo_get_vf_config = efx_sriov_get_vf_config,
603 .ndo_set_vf_link_state = efx_sriov_set_vf_link_state,
604 #endif
605 .ndo_get_phys_port_id = efx_get_phys_port_id,
606 .ndo_get_phys_port_name = efx_get_phys_port_name,
607 .ndo_setup_tc = efx_setup_tc,
608 #ifdef CONFIG_RFS_ACCEL
609 .ndo_rx_flow_steer = efx_filter_rfs,
610 #endif
611 .ndo_xdp_xmit = efx_xdp_xmit,
612 .ndo_bpf = efx_xdp
613 };
614
efx_xdp_setup_prog(struct efx_nic * efx,struct bpf_prog * prog)615 static int efx_xdp_setup_prog(struct efx_nic *efx, struct bpf_prog *prog)
616 {
617 struct bpf_prog *old_prog;
618
619 if (efx->xdp_rxq_info_failed) {
620 netif_err(efx, drv, efx->net_dev,
621 "Unable to bind XDP program due to previous failure of rxq_info\n");
622 return -EINVAL;
623 }
624
625 if (prog && efx->net_dev->mtu > efx_xdp_max_mtu(efx)) {
626 netif_err(efx, drv, efx->net_dev,
627 "Unable to configure XDP with MTU of %d (max: %d)\n",
628 efx->net_dev->mtu, efx_xdp_max_mtu(efx));
629 return -EINVAL;
630 }
631
632 old_prog = rtnl_dereference(efx->xdp_prog);
633 rcu_assign_pointer(efx->xdp_prog, prog);
634 /* Release the reference that was originally passed by the caller. */
635 if (old_prog)
636 bpf_prog_put(old_prog);
637
638 return 0;
639 }
640
641 /* Context: process, rtnl_lock() held. */
efx_xdp(struct net_device * dev,struct netdev_bpf * xdp)642 static int efx_xdp(struct net_device *dev, struct netdev_bpf *xdp)
643 {
644 struct efx_nic *efx = netdev_priv(dev);
645
646 switch (xdp->command) {
647 case XDP_SETUP_PROG:
648 return efx_xdp_setup_prog(efx, xdp->prog);
649 default:
650 return -EINVAL;
651 }
652 }
653
efx_xdp_xmit(struct net_device * dev,int n,struct xdp_frame ** xdpfs,u32 flags)654 static int efx_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **xdpfs,
655 u32 flags)
656 {
657 struct efx_nic *efx = netdev_priv(dev);
658
659 if (!netif_running(dev))
660 return -EINVAL;
661
662 return efx_xdp_tx_buffers(efx, n, xdpfs, flags & XDP_XMIT_FLUSH);
663 }
664
efx_update_name(struct efx_nic * efx)665 static void efx_update_name(struct efx_nic *efx)
666 {
667 strcpy(efx->name, efx->net_dev->name);
668 efx_mtd_rename(efx);
669 efx_set_channel_names(efx);
670 }
671
efx_netdev_event(struct notifier_block * this,unsigned long event,void * ptr)672 static int efx_netdev_event(struct notifier_block *this,
673 unsigned long event, void *ptr)
674 {
675 struct net_device *net_dev = netdev_notifier_info_to_dev(ptr);
676
677 if ((net_dev->netdev_ops == &efx_netdev_ops) &&
678 event == NETDEV_CHANGENAME)
679 efx_update_name(netdev_priv(net_dev));
680
681 return NOTIFY_DONE;
682 }
683
684 static struct notifier_block efx_netdev_notifier = {
685 .notifier_call = efx_netdev_event,
686 };
687
phy_type_show(struct device * dev,struct device_attribute * attr,char * buf)688 static ssize_t phy_type_show(struct device *dev,
689 struct device_attribute *attr, char *buf)
690 {
691 struct efx_nic *efx = dev_get_drvdata(dev);
692 return sprintf(buf, "%d\n", efx->phy_type);
693 }
694 static DEVICE_ATTR_RO(phy_type);
695
efx_register_netdev(struct efx_nic * efx)696 static int efx_register_netdev(struct efx_nic *efx)
697 {
698 struct net_device *net_dev = efx->net_dev;
699 struct efx_channel *channel;
700 int rc;
701
702 net_dev->watchdog_timeo = 5 * HZ;
703 net_dev->irq = efx->pci_dev->irq;
704 net_dev->netdev_ops = &efx_netdev_ops;
705 if (efx_nic_rev(efx) >= EFX_REV_HUNT_A0)
706 net_dev->priv_flags |= IFF_UNICAST_FLT;
707 net_dev->ethtool_ops = &efx_ethtool_ops;
708 net_dev->gso_max_segs = EFX_TSO_MAX_SEGS;
709 net_dev->min_mtu = EFX_MIN_MTU;
710 net_dev->max_mtu = EFX_MAX_MTU;
711
712 rtnl_lock();
713
714 /* Enable resets to be scheduled and check whether any were
715 * already requested. If so, the NIC is probably hosed so we
716 * abort.
717 */
718 if (efx->reset_pending) {
719 pci_err(efx->pci_dev, "aborting probe due to scheduled reset\n");
720 rc = -EIO;
721 goto fail_locked;
722 }
723
724 rc = dev_alloc_name(net_dev, net_dev->name);
725 if (rc < 0)
726 goto fail_locked;
727 efx_update_name(efx);
728
729 /* Always start with carrier off; PHY events will detect the link */
730 netif_carrier_off(net_dev);
731
732 rc = register_netdevice(net_dev);
733 if (rc)
734 goto fail_locked;
735
736 efx_for_each_channel(channel, efx) {
737 struct efx_tx_queue *tx_queue;
738 efx_for_each_channel_tx_queue(tx_queue, channel)
739 efx_init_tx_queue_core_txq(tx_queue);
740 }
741
742 efx_associate(efx);
743
744 efx->state = STATE_NET_DOWN;
745
746 rtnl_unlock();
747
748 rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_type);
749 if (rc) {
750 netif_err(efx, drv, efx->net_dev,
751 "failed to init net dev attributes\n");
752 goto fail_registered;
753 }
754
755 efx_init_mcdi_logging(efx);
756
757 return 0;
758
759 fail_registered:
760 rtnl_lock();
761 efx_dissociate(efx);
762 unregister_netdevice(net_dev);
763 fail_locked:
764 efx->state = STATE_UNINIT;
765 rtnl_unlock();
766 netif_err(efx, drv, efx->net_dev, "could not register net dev\n");
767 return rc;
768 }
769
efx_unregister_netdev(struct efx_nic * efx)770 static void efx_unregister_netdev(struct efx_nic *efx)
771 {
772 if (!efx->net_dev)
773 return;
774
775 BUG_ON(netdev_priv(efx->net_dev) != efx);
776
777 if (efx_dev_registered(efx)) {
778 strlcpy(efx->name, pci_name(efx->pci_dev), sizeof(efx->name));
779 efx_fini_mcdi_logging(efx);
780 device_remove_file(&efx->pci_dev->dev, &dev_attr_phy_type);
781 unregister_netdev(efx->net_dev);
782 }
783 }
784
785 /**************************************************************************
786 *
787 * List of NICs we support
788 *
789 **************************************************************************/
790
791 /* PCI device ID table */
792 static const struct pci_device_id efx_pci_table[] = {
793 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0803), /* SFC9020 */
794 .driver_data = (unsigned long) &siena_a0_nic_type},
795 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0813), /* SFL9021 */
796 .driver_data = (unsigned long) &siena_a0_nic_type},
797 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0903), /* SFC9120 PF */
798 .driver_data = (unsigned long) &efx_hunt_a0_nic_type},
799 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x1903), /* SFC9120 VF */
800 .driver_data = (unsigned long) &efx_hunt_a0_vf_nic_type},
801 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0923), /* SFC9140 PF */
802 .driver_data = (unsigned long) &efx_hunt_a0_nic_type},
803 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x1923), /* SFC9140 VF */
804 .driver_data = (unsigned long) &efx_hunt_a0_vf_nic_type},
805 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0a03), /* SFC9220 PF */
806 .driver_data = (unsigned long) &efx_hunt_a0_nic_type},
807 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x1a03), /* SFC9220 VF */
808 .driver_data = (unsigned long) &efx_hunt_a0_vf_nic_type},
809 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x0b03), /* SFC9250 PF */
810 .driver_data = (unsigned long) &efx_hunt_a0_nic_type},
811 {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x1b03), /* SFC9250 VF */
812 .driver_data = (unsigned long) &efx_hunt_a0_vf_nic_type},
813 {0} /* end of list */
814 };
815
816 /**************************************************************************
817 *
818 * Data housekeeping
819 *
820 **************************************************************************/
821
efx_update_sw_stats(struct efx_nic * efx,u64 * stats)822 void efx_update_sw_stats(struct efx_nic *efx, u64 *stats)
823 {
824 u64 n_rx_nodesc_trunc = 0;
825 struct efx_channel *channel;
826
827 efx_for_each_channel(channel, efx)
828 n_rx_nodesc_trunc += channel->n_rx_nodesc_trunc;
829 stats[GENERIC_STAT_rx_nodesc_trunc] = n_rx_nodesc_trunc;
830 stats[GENERIC_STAT_rx_noskb_drops] = atomic_read(&efx->n_rx_noskb_drops);
831 }
832
833 /**************************************************************************
834 *
835 * PCI interface
836 *
837 **************************************************************************/
838
839 /* Main body of final NIC shutdown code
840 * This is called only at module unload (or hotplug removal).
841 */
efx_pci_remove_main(struct efx_nic * efx)842 static void efx_pci_remove_main(struct efx_nic *efx)
843 {
844 /* Flush reset_work. It can no longer be scheduled since we
845 * are not READY.
846 */
847 WARN_ON(efx_net_active(efx->state));
848 efx_flush_reset_workqueue(efx);
849
850 efx_disable_interrupts(efx);
851 efx_clear_interrupt_affinity(efx);
852 efx_nic_fini_interrupt(efx);
853 efx_fini_port(efx);
854 efx->type->fini(efx);
855 efx_fini_napi(efx);
856 efx_remove_all(efx);
857 }
858
859 /* Final NIC shutdown
860 * This is called only at module unload (or hotplug removal). A PF can call
861 * this on its VFs to ensure they are unbound first.
862 */
efx_pci_remove(struct pci_dev * pci_dev)863 static void efx_pci_remove(struct pci_dev *pci_dev)
864 {
865 struct efx_nic *efx;
866
867 efx = pci_get_drvdata(pci_dev);
868 if (!efx)
869 return;
870
871 /* Mark the NIC as fini, then stop the interface */
872 rtnl_lock();
873 efx_dissociate(efx);
874 dev_close(efx->net_dev);
875 efx_disable_interrupts(efx);
876 efx->state = STATE_UNINIT;
877 rtnl_unlock();
878
879 if (efx->type->sriov_fini)
880 efx->type->sriov_fini(efx);
881
882 efx_unregister_netdev(efx);
883
884 efx_mtd_remove(efx);
885
886 efx_pci_remove_main(efx);
887
888 efx_fini_io(efx);
889 netif_dbg(efx, drv, efx->net_dev, "shutdown successful\n");
890
891 efx_fini_struct(efx);
892 free_netdev(efx->net_dev);
893
894 pci_disable_pcie_error_reporting(pci_dev);
895 };
896
897 /* NIC VPD information
898 * Called during probe to display the part number of the
899 * installed NIC.
900 */
efx_probe_vpd_strings(struct efx_nic * efx)901 static void efx_probe_vpd_strings(struct efx_nic *efx)
902 {
903 struct pci_dev *dev = efx->pci_dev;
904 unsigned int vpd_size, kw_len;
905 u8 *vpd_data;
906 int start;
907
908 vpd_data = pci_vpd_alloc(dev, &vpd_size);
909 if (IS_ERR(vpd_data)) {
910 pci_warn(dev, "Unable to read VPD\n");
911 return;
912 }
913
914 start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
915 PCI_VPD_RO_KEYWORD_PARTNO, &kw_len);
916 if (start < 0)
917 pci_err(dev, "Part number not found or incomplete\n");
918 else
919 pci_info(dev, "Part Number : %.*s\n", kw_len, vpd_data + start);
920
921 start = pci_vpd_find_ro_info_keyword(vpd_data, vpd_size,
922 PCI_VPD_RO_KEYWORD_SERIALNO, &kw_len);
923 if (start < 0)
924 pci_err(dev, "Serial number not found or incomplete\n");
925 else
926 efx->vpd_sn = kmemdup_nul(vpd_data + start, kw_len, GFP_KERNEL);
927
928 kfree(vpd_data);
929 }
930
931
932 /* Main body of NIC initialisation
933 * This is called at module load (or hotplug insertion, theoretically).
934 */
efx_pci_probe_main(struct efx_nic * efx)935 static int efx_pci_probe_main(struct efx_nic *efx)
936 {
937 int rc;
938
939 /* Do start-of-day initialisation */
940 rc = efx_probe_all(efx);
941 if (rc)
942 goto fail1;
943
944 efx_init_napi(efx);
945
946 down_write(&efx->filter_sem);
947 rc = efx->type->init(efx);
948 up_write(&efx->filter_sem);
949 if (rc) {
950 pci_err(efx->pci_dev, "failed to initialise NIC\n");
951 goto fail3;
952 }
953
954 rc = efx_init_port(efx);
955 if (rc) {
956 netif_err(efx, probe, efx->net_dev,
957 "failed to initialise port\n");
958 goto fail4;
959 }
960
961 rc = efx_nic_init_interrupt(efx);
962 if (rc)
963 goto fail5;
964
965 efx_set_interrupt_affinity(efx);
966 rc = efx_enable_interrupts(efx);
967 if (rc)
968 goto fail6;
969
970 return 0;
971
972 fail6:
973 efx_clear_interrupt_affinity(efx);
974 efx_nic_fini_interrupt(efx);
975 fail5:
976 efx_fini_port(efx);
977 fail4:
978 efx->type->fini(efx);
979 fail3:
980 efx_fini_napi(efx);
981 efx_remove_all(efx);
982 fail1:
983 return rc;
984 }
985
efx_pci_probe_post_io(struct efx_nic * efx)986 static int efx_pci_probe_post_io(struct efx_nic *efx)
987 {
988 struct net_device *net_dev = efx->net_dev;
989 int rc = efx_pci_probe_main(efx);
990
991 if (rc)
992 return rc;
993
994 if (efx->type->sriov_init) {
995 rc = efx->type->sriov_init(efx);
996 if (rc)
997 pci_err(efx->pci_dev, "SR-IOV can't be enabled rc %d\n",
998 rc);
999 }
1000
1001 /* Determine netdevice features */
1002 net_dev->features |= efx->type->offload_features;
1003
1004 /* Add TSO features */
1005 if (efx->type->tso_versions && efx->type->tso_versions(efx))
1006 net_dev->features |= NETIF_F_TSO | NETIF_F_TSO6;
1007
1008 /* Mask for features that also apply to VLAN devices */
1009 net_dev->vlan_features |= (NETIF_F_HW_CSUM | NETIF_F_SG |
1010 NETIF_F_HIGHDMA | NETIF_F_ALL_TSO |
1011 NETIF_F_RXCSUM);
1012
1013 /* Determine user configurable features */
1014 net_dev->hw_features |= net_dev->features & ~efx->fixed_features;
1015
1016 /* Disable receiving frames with bad FCS, by default. */
1017 net_dev->features &= ~NETIF_F_RXALL;
1018
1019 /* Disable VLAN filtering by default. It may be enforced if
1020 * the feature is fixed (i.e. VLAN filters are required to
1021 * receive VLAN tagged packets due to vPort restrictions).
1022 */
1023 net_dev->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
1024 net_dev->features |= efx->fixed_features;
1025
1026 rc = efx_register_netdev(efx);
1027 if (!rc)
1028 return 0;
1029
1030 efx_pci_remove_main(efx);
1031 return rc;
1032 }
1033
1034 /* NIC initialisation
1035 *
1036 * This is called at module load (or hotplug insertion,
1037 * theoretically). It sets up PCI mappings, resets the NIC,
1038 * sets up and registers the network devices with the kernel and hooks
1039 * the interrupt service routine. It does not prepare the device for
1040 * transmission; this is left to the first time one of the network
1041 * interfaces is brought up (i.e. efx_net_open).
1042 */
efx_pci_probe(struct pci_dev * pci_dev,const struct pci_device_id * entry)1043 static int efx_pci_probe(struct pci_dev *pci_dev,
1044 const struct pci_device_id *entry)
1045 {
1046 struct net_device *net_dev;
1047 struct efx_nic *efx;
1048 int rc;
1049
1050 /* Allocate and initialise a struct net_device and struct efx_nic */
1051 net_dev = alloc_etherdev_mqs(sizeof(*efx), EFX_MAX_CORE_TX_QUEUES,
1052 EFX_MAX_RX_QUEUES);
1053 if (!net_dev)
1054 return -ENOMEM;
1055 efx = netdev_priv(net_dev);
1056 efx->type = (const struct efx_nic_type *) entry->driver_data;
1057 efx->fixed_features |= NETIF_F_HIGHDMA;
1058
1059 pci_set_drvdata(pci_dev, efx);
1060 SET_NETDEV_DEV(net_dev, &pci_dev->dev);
1061 rc = efx_init_struct(efx, pci_dev, net_dev);
1062 if (rc)
1063 goto fail1;
1064
1065 pci_info(pci_dev, "Solarflare NIC detected\n");
1066
1067 if (!efx->type->is_vf)
1068 efx_probe_vpd_strings(efx);
1069
1070 /* Set up basic I/O (BAR mappings etc) */
1071 rc = efx_init_io(efx, efx->type->mem_bar(efx), efx->type->max_dma_mask,
1072 efx->type->mem_map_size(efx));
1073 if (rc)
1074 goto fail2;
1075
1076 rc = efx_pci_probe_post_io(efx);
1077 if (rc) {
1078 /* On failure, retry once immediately.
1079 * If we aborted probe due to a scheduled reset, dismiss it.
1080 */
1081 efx->reset_pending = 0;
1082 rc = efx_pci_probe_post_io(efx);
1083 if (rc) {
1084 /* On another failure, retry once more
1085 * after a 50-305ms delay.
1086 */
1087 unsigned char r;
1088
1089 get_random_bytes(&r, 1);
1090 msleep((unsigned int)r + 50);
1091 efx->reset_pending = 0;
1092 rc = efx_pci_probe_post_io(efx);
1093 }
1094 }
1095 if (rc)
1096 goto fail3;
1097
1098 netif_dbg(efx, probe, efx->net_dev, "initialisation successful\n");
1099
1100 /* Try to create MTDs, but allow this to fail */
1101 rtnl_lock();
1102 rc = efx_mtd_probe(efx);
1103 rtnl_unlock();
1104 if (rc && rc != -EPERM)
1105 netif_warn(efx, probe, efx->net_dev,
1106 "failed to create MTDs (%d)\n", rc);
1107
1108 (void)pci_enable_pcie_error_reporting(pci_dev);
1109
1110 if (efx->type->udp_tnl_push_ports)
1111 efx->type->udp_tnl_push_ports(efx);
1112
1113 return 0;
1114
1115 fail3:
1116 efx_fini_io(efx);
1117 fail2:
1118 efx_fini_struct(efx);
1119 fail1:
1120 WARN_ON(rc > 0);
1121 netif_dbg(efx, drv, efx->net_dev, "initialisation failed. rc=%d\n", rc);
1122 free_netdev(net_dev);
1123 return rc;
1124 }
1125
1126 /* efx_pci_sriov_configure returns the actual number of Virtual Functions
1127 * enabled on success
1128 */
1129 #ifdef CONFIG_SFC_SRIOV
efx_pci_sriov_configure(struct pci_dev * dev,int num_vfs)1130 static int efx_pci_sriov_configure(struct pci_dev *dev, int num_vfs)
1131 {
1132 int rc;
1133 struct efx_nic *efx = pci_get_drvdata(dev);
1134
1135 if (efx->type->sriov_configure) {
1136 rc = efx->type->sriov_configure(efx, num_vfs);
1137 if (rc)
1138 return rc;
1139 else
1140 return num_vfs;
1141 } else
1142 return -EOPNOTSUPP;
1143 }
1144 #endif
1145
efx_pm_freeze(struct device * dev)1146 static int efx_pm_freeze(struct device *dev)
1147 {
1148 struct efx_nic *efx = dev_get_drvdata(dev);
1149
1150 rtnl_lock();
1151
1152 if (efx_net_active(efx->state)) {
1153 efx_device_detach_sync(efx);
1154
1155 efx_stop_all(efx);
1156 efx_disable_interrupts(efx);
1157
1158 efx->state = efx_freeze(efx->state);
1159 }
1160
1161 rtnl_unlock();
1162
1163 return 0;
1164 }
1165
efx_pm_thaw(struct device * dev)1166 static int efx_pm_thaw(struct device *dev)
1167 {
1168 int rc;
1169 struct efx_nic *efx = dev_get_drvdata(dev);
1170
1171 rtnl_lock();
1172
1173 if (efx_frozen(efx->state)) {
1174 rc = efx_enable_interrupts(efx);
1175 if (rc)
1176 goto fail;
1177
1178 mutex_lock(&efx->mac_lock);
1179 efx_mcdi_port_reconfigure(efx);
1180 mutex_unlock(&efx->mac_lock);
1181
1182 efx_start_all(efx);
1183
1184 efx_device_attach_if_not_resetting(efx);
1185
1186 efx->state = efx_thaw(efx->state);
1187
1188 efx->type->resume_wol(efx);
1189 }
1190
1191 rtnl_unlock();
1192
1193 /* Reschedule any quenched resets scheduled during efx_pm_freeze() */
1194 efx_queue_reset_work(efx);
1195
1196 return 0;
1197
1198 fail:
1199 rtnl_unlock();
1200
1201 return rc;
1202 }
1203
efx_pm_poweroff(struct device * dev)1204 static int efx_pm_poweroff(struct device *dev)
1205 {
1206 struct pci_dev *pci_dev = to_pci_dev(dev);
1207 struct efx_nic *efx = pci_get_drvdata(pci_dev);
1208
1209 efx->type->fini(efx);
1210
1211 efx->reset_pending = 0;
1212
1213 pci_save_state(pci_dev);
1214 return pci_set_power_state(pci_dev, PCI_D3hot);
1215 }
1216
1217 /* Used for both resume and restore */
efx_pm_resume(struct device * dev)1218 static int efx_pm_resume(struct device *dev)
1219 {
1220 struct pci_dev *pci_dev = to_pci_dev(dev);
1221 struct efx_nic *efx = pci_get_drvdata(pci_dev);
1222 int rc;
1223
1224 rc = pci_set_power_state(pci_dev, PCI_D0);
1225 if (rc)
1226 return rc;
1227 pci_restore_state(pci_dev);
1228 rc = pci_enable_device(pci_dev);
1229 if (rc)
1230 return rc;
1231 pci_set_master(efx->pci_dev);
1232 rc = efx->type->reset(efx, RESET_TYPE_ALL);
1233 if (rc)
1234 return rc;
1235 down_write(&efx->filter_sem);
1236 rc = efx->type->init(efx);
1237 up_write(&efx->filter_sem);
1238 if (rc)
1239 return rc;
1240 rc = efx_pm_thaw(dev);
1241 return rc;
1242 }
1243
efx_pm_suspend(struct device * dev)1244 static int efx_pm_suspend(struct device *dev)
1245 {
1246 int rc;
1247
1248 efx_pm_freeze(dev);
1249 rc = efx_pm_poweroff(dev);
1250 if (rc)
1251 efx_pm_resume(dev);
1252 return rc;
1253 }
1254
1255 static const struct dev_pm_ops efx_pm_ops = {
1256 .suspend = efx_pm_suspend,
1257 .resume = efx_pm_resume,
1258 .freeze = efx_pm_freeze,
1259 .thaw = efx_pm_thaw,
1260 .poweroff = efx_pm_poweroff,
1261 .restore = efx_pm_resume,
1262 };
1263
1264 static struct pci_driver efx_pci_driver = {
1265 .name = KBUILD_MODNAME,
1266 .id_table = efx_pci_table,
1267 .probe = efx_pci_probe,
1268 .remove = efx_pci_remove,
1269 .driver.pm = &efx_pm_ops,
1270 .err_handler = &efx_err_handlers,
1271 #ifdef CONFIG_SFC_SRIOV
1272 .sriov_configure = efx_pci_sriov_configure,
1273 #endif
1274 };
1275
1276 /**************************************************************************
1277 *
1278 * Kernel module interface
1279 *
1280 *************************************************************************/
1281
efx_init_module(void)1282 static int __init efx_init_module(void)
1283 {
1284 int rc;
1285
1286 printk(KERN_INFO "Solarflare NET driver\n");
1287
1288 rc = register_netdevice_notifier(&efx_netdev_notifier);
1289 if (rc)
1290 goto err_notifier;
1291
1292 #ifdef CONFIG_SFC_SRIOV
1293 rc = efx_init_sriov();
1294 if (rc)
1295 goto err_sriov;
1296 #endif
1297
1298 rc = efx_create_reset_workqueue();
1299 if (rc)
1300 goto err_reset;
1301
1302 rc = pci_register_driver(&efx_pci_driver);
1303 if (rc < 0)
1304 goto err_pci;
1305
1306 rc = pci_register_driver(&ef100_pci_driver);
1307 if (rc < 0)
1308 goto err_pci_ef100;
1309
1310 return 0;
1311
1312 err_pci_ef100:
1313 pci_unregister_driver(&efx_pci_driver);
1314 err_pci:
1315 efx_destroy_reset_workqueue();
1316 err_reset:
1317 #ifdef CONFIG_SFC_SRIOV
1318 efx_fini_sriov();
1319 err_sriov:
1320 #endif
1321 unregister_netdevice_notifier(&efx_netdev_notifier);
1322 err_notifier:
1323 return rc;
1324 }
1325
efx_exit_module(void)1326 static void __exit efx_exit_module(void)
1327 {
1328 printk(KERN_INFO "Solarflare NET driver unloading\n");
1329
1330 pci_unregister_driver(&ef100_pci_driver);
1331 pci_unregister_driver(&efx_pci_driver);
1332 efx_destroy_reset_workqueue();
1333 #ifdef CONFIG_SFC_SRIOV
1334 efx_fini_sriov();
1335 #endif
1336 unregister_netdevice_notifier(&efx_netdev_notifier);
1337
1338 }
1339
1340 module_init(efx_init_module);
1341 module_exit(efx_exit_module);
1342
1343 MODULE_AUTHOR("Solarflare Communications and "
1344 "Michael Brown <mbrown@fensystems.co.uk>");
1345 MODULE_DESCRIPTION("Solarflare network driver");
1346 MODULE_LICENSE("GPL");
1347 MODULE_DEVICE_TABLE(pci, efx_pci_table);
1348