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