diff options
Diffstat (limited to 'drivers/net/sfc/efx.c')
-rw-r--r-- | drivers/net/sfc/efx.c | 223 |
1 files changed, 135 insertions, 88 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index 8ad476a19d95..72514005c2a3 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -189,6 +189,13 @@ module_param(irq_adapt_high_thresh, uint, 0644); | |||
189 | MODULE_PARM_DESC(irq_adapt_high_thresh, | 189 | MODULE_PARM_DESC(irq_adapt_high_thresh, |
190 | "Threshold score for increasing IRQ moderation"); | 190 | "Threshold score for increasing IRQ moderation"); |
191 | 191 | ||
192 | static unsigned debug = (NETIF_MSG_DRV | NETIF_MSG_PROBE | | ||
193 | NETIF_MSG_LINK | NETIF_MSG_IFDOWN | | ||
194 | NETIF_MSG_IFUP | NETIF_MSG_RX_ERR | | ||
195 | NETIF_MSG_TX_ERR | NETIF_MSG_HW); | ||
196 | module_param(debug, uint, 0); | ||
197 | MODULE_PARM_DESC(debug, "Bitmapped debugging message enable value"); | ||
198 | |||
192 | /************************************************************************** | 199 | /************************************************************************** |
193 | * | 200 | * |
194 | * Utility functions and prototypes | 201 | * Utility functions and prototypes |
@@ -272,16 +279,16 @@ static int efx_poll(struct napi_struct *napi, int budget) | |||
272 | { | 279 | { |
273 | struct efx_channel *channel = | 280 | struct efx_channel *channel = |
274 | container_of(napi, struct efx_channel, napi_str); | 281 | container_of(napi, struct efx_channel, napi_str); |
282 | struct efx_nic *efx = channel->efx; | ||
275 | int spent; | 283 | int spent; |
276 | 284 | ||
277 | EFX_TRACE(channel->efx, "channel %d NAPI poll executing on CPU %d\n", | 285 | netif_vdbg(efx, intr, efx->net_dev, |
278 | channel->channel, raw_smp_processor_id()); | 286 | "channel %d NAPI poll executing on CPU %d\n", |
287 | channel->channel, raw_smp_processor_id()); | ||
279 | 288 | ||
280 | spent = efx_process_channel(channel, budget); | 289 | spent = efx_process_channel(channel, budget); |
281 | 290 | ||
282 | if (spent < budget) { | 291 | if (spent < budget) { |
283 | struct efx_nic *efx = channel->efx; | ||
284 | |||
285 | if (channel->channel < efx->n_rx_channels && | 292 | if (channel->channel < efx->n_rx_channels && |
286 | efx->irq_rx_adaptive && | 293 | efx->irq_rx_adaptive && |
287 | unlikely(++channel->irq_count == 1000)) { | 294 | unlikely(++channel->irq_count == 1000)) { |
@@ -357,7 +364,8 @@ void efx_process_channel_now(struct efx_channel *channel) | |||
357 | */ | 364 | */ |
358 | static int efx_probe_eventq(struct efx_channel *channel) | 365 | static int efx_probe_eventq(struct efx_channel *channel) |
359 | { | 366 | { |
360 | EFX_LOG(channel->efx, "chan %d create event queue\n", channel->channel); | 367 | netif_dbg(channel->efx, probe, channel->efx->net_dev, |
368 | "chan %d create event queue\n", channel->channel); | ||
361 | 369 | ||
362 | return efx_nic_probe_eventq(channel); | 370 | return efx_nic_probe_eventq(channel); |
363 | } | 371 | } |
@@ -365,7 +373,8 @@ static int efx_probe_eventq(struct efx_channel *channel) | |||
365 | /* Prepare channel's event queue */ | 373 | /* Prepare channel's event queue */ |
366 | static void efx_init_eventq(struct efx_channel *channel) | 374 | static void efx_init_eventq(struct efx_channel *channel) |
367 | { | 375 | { |
368 | EFX_LOG(channel->efx, "chan %d init event queue\n", channel->channel); | 376 | netif_dbg(channel->efx, drv, channel->efx->net_dev, |
377 | "chan %d init event queue\n", channel->channel); | ||
369 | 378 | ||
370 | channel->eventq_read_ptr = 0; | 379 | channel->eventq_read_ptr = 0; |
371 | 380 | ||
@@ -374,14 +383,16 @@ static void efx_init_eventq(struct efx_channel *channel) | |||
374 | 383 | ||
375 | static void efx_fini_eventq(struct efx_channel *channel) | 384 | static void efx_fini_eventq(struct efx_channel *channel) |
376 | { | 385 | { |
377 | EFX_LOG(channel->efx, "chan %d fini event queue\n", channel->channel); | 386 | netif_dbg(channel->efx, drv, channel->efx->net_dev, |
387 | "chan %d fini event queue\n", channel->channel); | ||
378 | 388 | ||
379 | efx_nic_fini_eventq(channel); | 389 | efx_nic_fini_eventq(channel); |
380 | } | 390 | } |
381 | 391 | ||
382 | static void efx_remove_eventq(struct efx_channel *channel) | 392 | static void efx_remove_eventq(struct efx_channel *channel) |
383 | { | 393 | { |
384 | EFX_LOG(channel->efx, "chan %d remove event queue\n", channel->channel); | 394 | netif_dbg(channel->efx, drv, channel->efx->net_dev, |
395 | "chan %d remove event queue\n", channel->channel); | ||
385 | 396 | ||
386 | efx_nic_remove_eventq(channel); | 397 | efx_nic_remove_eventq(channel); |
387 | } | 398 | } |
@@ -398,7 +409,8 @@ static int efx_probe_channel(struct efx_channel *channel) | |||
398 | struct efx_rx_queue *rx_queue; | 409 | struct efx_rx_queue *rx_queue; |
399 | int rc; | 410 | int rc; |
400 | 411 | ||
401 | EFX_LOG(channel->efx, "creating channel %d\n", channel->channel); | 412 | netif_dbg(channel->efx, probe, channel->efx->net_dev, |
413 | "creating channel %d\n", channel->channel); | ||
402 | 414 | ||
403 | rc = efx_probe_eventq(channel); | 415 | rc = efx_probe_eventq(channel); |
404 | if (rc) | 416 | if (rc) |
@@ -474,7 +486,8 @@ static void efx_init_channels(struct efx_nic *efx) | |||
474 | 486 | ||
475 | /* Initialise the channels */ | 487 | /* Initialise the channels */ |
476 | efx_for_each_channel(channel, efx) { | 488 | efx_for_each_channel(channel, efx) { |
477 | EFX_LOG(channel->efx, "init chan %d\n", channel->channel); | 489 | netif_dbg(channel->efx, drv, channel->efx->net_dev, |
490 | "init chan %d\n", channel->channel); | ||
478 | 491 | ||
479 | efx_init_eventq(channel); | 492 | efx_init_eventq(channel); |
480 | 493 | ||
@@ -501,7 +514,8 @@ static void efx_start_channel(struct efx_channel *channel) | |||
501 | { | 514 | { |
502 | struct efx_rx_queue *rx_queue; | 515 | struct efx_rx_queue *rx_queue; |
503 | 516 | ||
504 | EFX_LOG(channel->efx, "starting chan %d\n", channel->channel); | 517 | netif_dbg(channel->efx, ifup, channel->efx->net_dev, |
518 | "starting chan %d\n", channel->channel); | ||
505 | 519 | ||
506 | /* The interrupt handler for this channel may set work_pending | 520 | /* The interrupt handler for this channel may set work_pending |
507 | * as soon as we enable it. Make sure it's cleared before | 521 | * as soon as we enable it. Make sure it's cleared before |
@@ -526,7 +540,8 @@ static void efx_stop_channel(struct efx_channel *channel) | |||
526 | if (!channel->enabled) | 540 | if (!channel->enabled) |
527 | return; | 541 | return; |
528 | 542 | ||
529 | EFX_LOG(channel->efx, "stop chan %d\n", channel->channel); | 543 | netif_dbg(channel->efx, ifdown, channel->efx->net_dev, |
544 | "stop chan %d\n", channel->channel); | ||
530 | 545 | ||
531 | channel->enabled = false; | 546 | channel->enabled = false; |
532 | napi_disable(&channel->napi_str); | 547 | napi_disable(&channel->napi_str); |
@@ -548,16 +563,19 @@ static void efx_fini_channels(struct efx_nic *efx) | |||
548 | * descriptor caches reference memory we're about to free, | 563 | * descriptor caches reference memory we're about to free, |
549 | * but falcon_reconfigure_mac_wrapper() won't reconnect | 564 | * but falcon_reconfigure_mac_wrapper() won't reconnect |
550 | * the MACs because of the pending reset. */ | 565 | * the MACs because of the pending reset. */ |
551 | EFX_ERR(efx, "Resetting to recover from flush failure\n"); | 566 | netif_err(efx, drv, efx->net_dev, |
567 | "Resetting to recover from flush failure\n"); | ||
552 | efx_schedule_reset(efx, RESET_TYPE_ALL); | 568 | efx_schedule_reset(efx, RESET_TYPE_ALL); |
553 | } else if (rc) { | 569 | } else if (rc) { |
554 | EFX_ERR(efx, "failed to flush queues\n"); | 570 | netif_err(efx, drv, efx->net_dev, "failed to flush queues\n"); |
555 | } else { | 571 | } else { |
556 | EFX_LOG(efx, "successfully flushed all queues\n"); | 572 | netif_dbg(efx, drv, efx->net_dev, |
573 | "successfully flushed all queues\n"); | ||
557 | } | 574 | } |
558 | 575 | ||
559 | efx_for_each_channel(channel, efx) { | 576 | efx_for_each_channel(channel, efx) { |
560 | EFX_LOG(channel->efx, "shut down chan %d\n", channel->channel); | 577 | netif_dbg(channel->efx, drv, channel->efx->net_dev, |
578 | "shut down chan %d\n", channel->channel); | ||
561 | 579 | ||
562 | efx_for_each_channel_rx_queue(rx_queue, channel) | 580 | efx_for_each_channel_rx_queue(rx_queue, channel) |
563 | efx_fini_rx_queue(rx_queue); | 581 | efx_fini_rx_queue(rx_queue); |
@@ -572,7 +590,8 @@ static void efx_remove_channel(struct efx_channel *channel) | |||
572 | struct efx_tx_queue *tx_queue; | 590 | struct efx_tx_queue *tx_queue; |
573 | struct efx_rx_queue *rx_queue; | 591 | struct efx_rx_queue *rx_queue; |
574 | 592 | ||
575 | EFX_LOG(channel->efx, "destroy chan %d\n", channel->channel); | 593 | netif_dbg(channel->efx, drv, channel->efx->net_dev, |
594 | "destroy chan %d\n", channel->channel); | ||
576 | 595 | ||
577 | efx_for_each_channel_rx_queue(rx_queue, channel) | 596 | efx_for_each_channel_rx_queue(rx_queue, channel) |
578 | efx_remove_rx_queue(rx_queue); | 597 | efx_remove_rx_queue(rx_queue); |
@@ -623,12 +642,13 @@ void efx_link_status_changed(struct efx_nic *efx) | |||
623 | 642 | ||
624 | /* Status message for kernel log */ | 643 | /* Status message for kernel log */ |
625 | if (link_state->up) { | 644 | if (link_state->up) { |
626 | EFX_INFO(efx, "link up at %uMbps %s-duplex (MTU %d)%s\n", | 645 | netif_info(efx, link, efx->net_dev, |
627 | link_state->speed, link_state->fd ? "full" : "half", | 646 | "link up at %uMbps %s-duplex (MTU %d)%s\n", |
628 | efx->net_dev->mtu, | 647 | link_state->speed, link_state->fd ? "full" : "half", |
629 | (efx->promiscuous ? " [PROMISC]" : "")); | 648 | efx->net_dev->mtu, |
649 | (efx->promiscuous ? " [PROMISC]" : "")); | ||
630 | } else { | 650 | } else { |
631 | EFX_INFO(efx, "link down\n"); | 651 | netif_info(efx, link, efx->net_dev, "link down\n"); |
632 | } | 652 | } |
633 | 653 | ||
634 | } | 654 | } |
@@ -732,7 +752,7 @@ static int efx_probe_port(struct efx_nic *efx) | |||
732 | { | 752 | { |
733 | int rc; | 753 | int rc; |
734 | 754 | ||
735 | EFX_LOG(efx, "create port\n"); | 755 | netif_dbg(efx, probe, efx->net_dev, "create port\n"); |
736 | 756 | ||
737 | if (phy_flash_cfg) | 757 | if (phy_flash_cfg) |
738 | efx->phy_mode = PHY_MODE_SPECIAL; | 758 | efx->phy_mode = PHY_MODE_SPECIAL; |
@@ -746,15 +766,16 @@ static int efx_probe_port(struct efx_nic *efx) | |||
746 | if (is_valid_ether_addr(efx->mac_address)) { | 766 | if (is_valid_ether_addr(efx->mac_address)) { |
747 | memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN); | 767 | memcpy(efx->net_dev->dev_addr, efx->mac_address, ETH_ALEN); |
748 | } else { | 768 | } else { |
749 | EFX_ERR(efx, "invalid MAC address %pM\n", | 769 | netif_err(efx, probe, efx->net_dev, "invalid MAC address %pM\n", |
750 | efx->mac_address); | 770 | efx->mac_address); |
751 | if (!allow_bad_hwaddr) { | 771 | if (!allow_bad_hwaddr) { |
752 | rc = -EINVAL; | 772 | rc = -EINVAL; |
753 | goto err; | 773 | goto err; |
754 | } | 774 | } |
755 | random_ether_addr(efx->net_dev->dev_addr); | 775 | random_ether_addr(efx->net_dev->dev_addr); |
756 | EFX_INFO(efx, "using locally-generated MAC %pM\n", | 776 | netif_info(efx, probe, efx->net_dev, |
757 | efx->net_dev->dev_addr); | 777 | "using locally-generated MAC %pM\n", |
778 | efx->net_dev->dev_addr); | ||
758 | } | 779 | } |
759 | 780 | ||
760 | return 0; | 781 | return 0; |
@@ -768,7 +789,7 @@ static int efx_init_port(struct efx_nic *efx) | |||
768 | { | 789 | { |
769 | int rc; | 790 | int rc; |
770 | 791 | ||
771 | EFX_LOG(efx, "init port\n"); | 792 | netif_dbg(efx, drv, efx->net_dev, "init port\n"); |
772 | 793 | ||
773 | mutex_lock(&efx->mac_lock); | 794 | mutex_lock(&efx->mac_lock); |
774 | 795 | ||
@@ -799,7 +820,7 @@ fail1: | |||
799 | 820 | ||
800 | static void efx_start_port(struct efx_nic *efx) | 821 | static void efx_start_port(struct efx_nic *efx) |
801 | { | 822 | { |
802 | EFX_LOG(efx, "start port\n"); | 823 | netif_dbg(efx, ifup, efx->net_dev, "start port\n"); |
803 | BUG_ON(efx->port_enabled); | 824 | BUG_ON(efx->port_enabled); |
804 | 825 | ||
805 | mutex_lock(&efx->mac_lock); | 826 | mutex_lock(&efx->mac_lock); |
@@ -816,7 +837,7 @@ static void efx_start_port(struct efx_nic *efx) | |||
816 | /* Prevent efx_mac_work() and efx_monitor() from working */ | 837 | /* Prevent efx_mac_work() and efx_monitor() from working */ |
817 | static void efx_stop_port(struct efx_nic *efx) | 838 | static void efx_stop_port(struct efx_nic *efx) |
818 | { | 839 | { |
819 | EFX_LOG(efx, "stop port\n"); | 840 | netif_dbg(efx, ifdown, efx->net_dev, "stop port\n"); |
820 | 841 | ||
821 | mutex_lock(&efx->mac_lock); | 842 | mutex_lock(&efx->mac_lock); |
822 | efx->port_enabled = false; | 843 | efx->port_enabled = false; |
@@ -831,7 +852,7 @@ static void efx_stop_port(struct efx_nic *efx) | |||
831 | 852 | ||
832 | static void efx_fini_port(struct efx_nic *efx) | 853 | static void efx_fini_port(struct efx_nic *efx) |
833 | { | 854 | { |
834 | EFX_LOG(efx, "shut down port\n"); | 855 | netif_dbg(efx, drv, efx->net_dev, "shut down port\n"); |
835 | 856 | ||
836 | if (!efx->port_initialized) | 857 | if (!efx->port_initialized) |
837 | return; | 858 | return; |
@@ -845,7 +866,7 @@ static void efx_fini_port(struct efx_nic *efx) | |||
845 | 866 | ||
846 | static void efx_remove_port(struct efx_nic *efx) | 867 | static void efx_remove_port(struct efx_nic *efx) |
847 | { | 868 | { |
848 | EFX_LOG(efx, "destroying port\n"); | 869 | netif_dbg(efx, drv, efx->net_dev, "destroying port\n"); |
849 | 870 | ||
850 | efx->type->remove_port(efx); | 871 | efx->type->remove_port(efx); |
851 | } | 872 | } |
@@ -863,11 +884,12 @@ static int efx_init_io(struct efx_nic *efx) | |||
863 | dma_addr_t dma_mask = efx->type->max_dma_mask; | 884 | dma_addr_t dma_mask = efx->type->max_dma_mask; |
864 | int rc; | 885 | int rc; |
865 | 886 | ||
866 | EFX_LOG(efx, "initialising I/O\n"); | 887 | netif_dbg(efx, probe, efx->net_dev, "initialising I/O\n"); |
867 | 888 | ||
868 | rc = pci_enable_device(pci_dev); | 889 | rc = pci_enable_device(pci_dev); |
869 | if (rc) { | 890 | if (rc) { |
870 | EFX_ERR(efx, "failed to enable PCI device\n"); | 891 | netif_err(efx, probe, efx->net_dev, |
892 | "failed to enable PCI device\n"); | ||
871 | goto fail1; | 893 | goto fail1; |
872 | } | 894 | } |
873 | 895 | ||
@@ -885,39 +907,45 @@ static int efx_init_io(struct efx_nic *efx) | |||
885 | dma_mask >>= 1; | 907 | dma_mask >>= 1; |
886 | } | 908 | } |
887 | if (rc) { | 909 | if (rc) { |
888 | EFX_ERR(efx, "could not find a suitable DMA mask\n"); | 910 | netif_err(efx, probe, efx->net_dev, |
911 | "could not find a suitable DMA mask\n"); | ||
889 | goto fail2; | 912 | goto fail2; |
890 | } | 913 | } |
891 | EFX_LOG(efx, "using DMA mask %llx\n", (unsigned long long) dma_mask); | 914 | netif_dbg(efx, probe, efx->net_dev, |
915 | "using DMA mask %llx\n", (unsigned long long) dma_mask); | ||
892 | rc = pci_set_consistent_dma_mask(pci_dev, dma_mask); | 916 | rc = pci_set_consistent_dma_mask(pci_dev, dma_mask); |
893 | if (rc) { | 917 | if (rc) { |
894 | /* pci_set_consistent_dma_mask() is not *allowed* to | 918 | /* pci_set_consistent_dma_mask() is not *allowed* to |
895 | * fail with a mask that pci_set_dma_mask() accepted, | 919 | * fail with a mask that pci_set_dma_mask() accepted, |
896 | * but just in case... | 920 | * but just in case... |
897 | */ | 921 | */ |
898 | EFX_ERR(efx, "failed to set consistent DMA mask\n"); | 922 | netif_err(efx, probe, efx->net_dev, |
923 | "failed to set consistent DMA mask\n"); | ||
899 | goto fail2; | 924 | goto fail2; |
900 | } | 925 | } |
901 | 926 | ||
902 | efx->membase_phys = pci_resource_start(efx->pci_dev, EFX_MEM_BAR); | 927 | efx->membase_phys = pci_resource_start(efx->pci_dev, EFX_MEM_BAR); |
903 | rc = pci_request_region(pci_dev, EFX_MEM_BAR, "sfc"); | 928 | rc = pci_request_region(pci_dev, EFX_MEM_BAR, "sfc"); |
904 | if (rc) { | 929 | if (rc) { |
905 | EFX_ERR(efx, "request for memory BAR failed\n"); | 930 | netif_err(efx, probe, efx->net_dev, |
931 | "request for memory BAR failed\n"); | ||
906 | rc = -EIO; | 932 | rc = -EIO; |
907 | goto fail3; | 933 | goto fail3; |
908 | } | 934 | } |
909 | efx->membase = ioremap_nocache(efx->membase_phys, | 935 | efx->membase = ioremap_nocache(efx->membase_phys, |
910 | efx->type->mem_map_size); | 936 | efx->type->mem_map_size); |
911 | if (!efx->membase) { | 937 | if (!efx->membase) { |
912 | EFX_ERR(efx, "could not map memory BAR at %llx+%x\n", | 938 | netif_err(efx, probe, efx->net_dev, |
913 | (unsigned long long)efx->membase_phys, | 939 | "could not map memory BAR at %llx+%x\n", |
914 | efx->type->mem_map_size); | 940 | (unsigned long long)efx->membase_phys, |
941 | efx->type->mem_map_size); | ||
915 | rc = -ENOMEM; | 942 | rc = -ENOMEM; |
916 | goto fail4; | 943 | goto fail4; |
917 | } | 944 | } |
918 | EFX_LOG(efx, "memory BAR at %llx+%x (virtual %p)\n", | 945 | netif_dbg(efx, probe, efx->net_dev, |
919 | (unsigned long long)efx->membase_phys, | 946 | "memory BAR at %llx+%x (virtual %p)\n", |
920 | efx->type->mem_map_size, efx->membase); | 947 | (unsigned long long)efx->membase_phys, |
948 | efx->type->mem_map_size, efx->membase); | ||
921 | 949 | ||
922 | return 0; | 950 | return 0; |
923 | 951 | ||
@@ -933,7 +961,7 @@ static int efx_init_io(struct efx_nic *efx) | |||
933 | 961 | ||
934 | static void efx_fini_io(struct efx_nic *efx) | 962 | static void efx_fini_io(struct efx_nic *efx) |
935 | { | 963 | { |
936 | EFX_LOG(efx, "shutting down I/O\n"); | 964 | netif_dbg(efx, drv, efx->net_dev, "shutting down I/O\n"); |
937 | 965 | ||
938 | if (efx->membase) { | 966 | if (efx->membase) { |
939 | iounmap(efx->membase); | 967 | iounmap(efx->membase); |
@@ -997,9 +1025,11 @@ static void efx_probe_interrupts(struct efx_nic *efx) | |||
997 | xentries[i].entry = i; | 1025 | xentries[i].entry = i; |
998 | rc = pci_enable_msix(efx->pci_dev, xentries, n_channels); | 1026 | rc = pci_enable_msix(efx->pci_dev, xentries, n_channels); |
999 | if (rc > 0) { | 1027 | if (rc > 0) { |
1000 | EFX_ERR(efx, "WARNING: Insufficient MSI-X vectors" | 1028 | netif_err(efx, drv, efx->net_dev, |
1001 | " available (%d < %d).\n", rc, n_channels); | 1029 | "WARNING: Insufficient MSI-X vectors" |
1002 | EFX_ERR(efx, "WARNING: Performance may be reduced.\n"); | 1030 | " available (%d < %d).\n", rc, n_channels); |
1031 | netif_err(efx, drv, efx->net_dev, | ||
1032 | "WARNING: Performance may be reduced.\n"); | ||
1003 | EFX_BUG_ON_PARANOID(rc >= n_channels); | 1033 | EFX_BUG_ON_PARANOID(rc >= n_channels); |
1004 | n_channels = rc; | 1034 | n_channels = rc; |
1005 | rc = pci_enable_msix(efx->pci_dev, xentries, | 1035 | rc = pci_enable_msix(efx->pci_dev, xentries, |
@@ -1023,7 +1053,8 @@ static void efx_probe_interrupts(struct efx_nic *efx) | |||
1023 | } else { | 1053 | } else { |
1024 | /* Fall back to single channel MSI */ | 1054 | /* Fall back to single channel MSI */ |
1025 | efx->interrupt_mode = EFX_INT_MODE_MSI; | 1055 | efx->interrupt_mode = EFX_INT_MODE_MSI; |
1026 | EFX_ERR(efx, "could not enable MSI-X\n"); | 1056 | netif_err(efx, drv, efx->net_dev, |
1057 | "could not enable MSI-X\n"); | ||
1027 | } | 1058 | } |
1028 | } | 1059 | } |
1029 | 1060 | ||
@@ -1036,7 +1067,8 @@ static void efx_probe_interrupts(struct efx_nic *efx) | |||
1036 | if (rc == 0) { | 1067 | if (rc == 0) { |
1037 | efx->channel[0].irq = efx->pci_dev->irq; | 1068 | efx->channel[0].irq = efx->pci_dev->irq; |
1038 | } else { | 1069 | } else { |
1039 | EFX_ERR(efx, "could not enable MSI\n"); | 1070 | netif_err(efx, drv, efx->net_dev, |
1071 | "could not enable MSI\n"); | ||
1040 | efx->interrupt_mode = EFX_INT_MODE_LEGACY; | 1072 | efx->interrupt_mode = EFX_INT_MODE_LEGACY; |
1041 | } | 1073 | } |
1042 | } | 1074 | } |
@@ -1090,7 +1122,7 @@ static int efx_probe_nic(struct efx_nic *efx) | |||
1090 | { | 1122 | { |
1091 | int rc; | 1123 | int rc; |
1092 | 1124 | ||
1093 | EFX_LOG(efx, "creating NIC\n"); | 1125 | netif_dbg(efx, probe, efx->net_dev, "creating NIC\n"); |
1094 | 1126 | ||
1095 | /* Carry out hardware-type specific initialisation */ | 1127 | /* Carry out hardware-type specific initialisation */ |
1096 | rc = efx->type->probe(efx); | 1128 | rc = efx->type->probe(efx); |
@@ -1112,7 +1144,7 @@ static int efx_probe_nic(struct efx_nic *efx) | |||
1112 | 1144 | ||
1113 | static void efx_remove_nic(struct efx_nic *efx) | 1145 | static void efx_remove_nic(struct efx_nic *efx) |
1114 | { | 1146 | { |
1115 | EFX_LOG(efx, "destroying NIC\n"); | 1147 | netif_dbg(efx, drv, efx->net_dev, "destroying NIC\n"); |
1116 | 1148 | ||
1117 | efx_remove_interrupts(efx); | 1149 | efx_remove_interrupts(efx); |
1118 | efx->type->remove(efx); | 1150 | efx->type->remove(efx); |
@@ -1132,14 +1164,14 @@ static int efx_probe_all(struct efx_nic *efx) | |||
1132 | /* Create NIC */ | 1164 | /* Create NIC */ |
1133 | rc = efx_probe_nic(efx); | 1165 | rc = efx_probe_nic(efx); |
1134 | if (rc) { | 1166 | if (rc) { |
1135 | EFX_ERR(efx, "failed to create NIC\n"); | 1167 | netif_err(efx, probe, efx->net_dev, "failed to create NIC\n"); |
1136 | goto fail1; | 1168 | goto fail1; |
1137 | } | 1169 | } |
1138 | 1170 | ||
1139 | /* Create port */ | 1171 | /* Create port */ |
1140 | rc = efx_probe_port(efx); | 1172 | rc = efx_probe_port(efx); |
1141 | if (rc) { | 1173 | if (rc) { |
1142 | EFX_ERR(efx, "failed to create port\n"); | 1174 | netif_err(efx, probe, efx->net_dev, "failed to create port\n"); |
1143 | goto fail2; | 1175 | goto fail2; |
1144 | } | 1176 | } |
1145 | 1177 | ||
@@ -1147,8 +1179,9 @@ static int efx_probe_all(struct efx_nic *efx) | |||
1147 | efx_for_each_channel(channel, efx) { | 1179 | efx_for_each_channel(channel, efx) { |
1148 | rc = efx_probe_channel(channel); | 1180 | rc = efx_probe_channel(channel); |
1149 | if (rc) { | 1181 | if (rc) { |
1150 | EFX_ERR(efx, "failed to create channel %d\n", | 1182 | netif_err(efx, probe, efx->net_dev, |
1151 | channel->channel); | 1183 | "failed to create channel %d\n", |
1184 | channel->channel); | ||
1152 | goto fail3; | 1185 | goto fail3; |
1153 | } | 1186 | } |
1154 | } | 1187 | } |
@@ -1344,8 +1377,9 @@ static void efx_monitor(struct work_struct *data) | |||
1344 | struct efx_nic *efx = container_of(data, struct efx_nic, | 1377 | struct efx_nic *efx = container_of(data, struct efx_nic, |
1345 | monitor_work.work); | 1378 | monitor_work.work); |
1346 | 1379 | ||
1347 | EFX_TRACE(efx, "hardware monitor executing on CPU %d\n", | 1380 | netif_vdbg(efx, timer, efx->net_dev, |
1348 | raw_smp_processor_id()); | 1381 | "hardware monitor executing on CPU %d\n", |
1382 | raw_smp_processor_id()); | ||
1349 | BUG_ON(efx->type->monitor == NULL); | 1383 | BUG_ON(efx->type->monitor == NULL); |
1350 | 1384 | ||
1351 | /* If the mac_lock is already held then it is likely a port | 1385 | /* If the mac_lock is already held then it is likely a port |
@@ -1452,8 +1486,8 @@ static int efx_net_open(struct net_device *net_dev) | |||
1452 | struct efx_nic *efx = netdev_priv(net_dev); | 1486 | struct efx_nic *efx = netdev_priv(net_dev); |
1453 | EFX_ASSERT_RESET_SERIALISED(efx); | 1487 | EFX_ASSERT_RESET_SERIALISED(efx); |
1454 | 1488 | ||
1455 | EFX_LOG(efx, "opening device %s on CPU %d\n", net_dev->name, | 1489 | netif_dbg(efx, ifup, efx->net_dev, "opening device on CPU %d\n", |
1456 | raw_smp_processor_id()); | 1490 | raw_smp_processor_id()); |
1457 | 1491 | ||
1458 | if (efx->state == STATE_DISABLED) | 1492 | if (efx->state == STATE_DISABLED) |
1459 | return -EIO; | 1493 | return -EIO; |
@@ -1478,8 +1512,8 @@ static int efx_net_stop(struct net_device *net_dev) | |||
1478 | { | 1512 | { |
1479 | struct efx_nic *efx = netdev_priv(net_dev); | 1513 | struct efx_nic *efx = netdev_priv(net_dev); |
1480 | 1514 | ||
1481 | EFX_LOG(efx, "closing %s on CPU %d\n", net_dev->name, | 1515 | netif_dbg(efx, ifdown, efx->net_dev, "closing on CPU %d\n", |
1482 | raw_smp_processor_id()); | 1516 | raw_smp_processor_id()); |
1483 | 1517 | ||
1484 | if (efx->state != STATE_DISABLED) { | 1518 | if (efx->state != STATE_DISABLED) { |
1485 | /* Stop the device and flush all the channels */ | 1519 | /* Stop the device and flush all the channels */ |
@@ -1532,8 +1566,9 @@ static void efx_watchdog(struct net_device *net_dev) | |||
1532 | { | 1566 | { |
1533 | struct efx_nic *efx = netdev_priv(net_dev); | 1567 | struct efx_nic *efx = netdev_priv(net_dev); |
1534 | 1568 | ||
1535 | EFX_ERR(efx, "TX stuck with port_enabled=%d: resetting channels\n", | 1569 | netif_err(efx, tx_err, efx->net_dev, |
1536 | efx->port_enabled); | 1570 | "TX stuck with port_enabled=%d: resetting channels\n", |
1571 | efx->port_enabled); | ||
1537 | 1572 | ||
1538 | efx_schedule_reset(efx, RESET_TYPE_TX_WATCHDOG); | 1573 | efx_schedule_reset(efx, RESET_TYPE_TX_WATCHDOG); |
1539 | } | 1574 | } |
@@ -1552,7 +1587,7 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu) | |||
1552 | 1587 | ||
1553 | efx_stop_all(efx); | 1588 | efx_stop_all(efx); |
1554 | 1589 | ||
1555 | EFX_LOG(efx, "changing MTU to %d\n", new_mtu); | 1590 | netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu); |
1556 | 1591 | ||
1557 | efx_fini_channels(efx); | 1592 | efx_fini_channels(efx); |
1558 | 1593 | ||
@@ -1578,8 +1613,9 @@ static int efx_set_mac_address(struct net_device *net_dev, void *data) | |||
1578 | EFX_ASSERT_RESET_SERIALISED(efx); | 1613 | EFX_ASSERT_RESET_SERIALISED(efx); |
1579 | 1614 | ||
1580 | if (!is_valid_ether_addr(new_addr)) { | 1615 | if (!is_valid_ether_addr(new_addr)) { |
1581 | EFX_ERR(efx, "invalid ethernet MAC address requested: %pM\n", | 1616 | netif_err(efx, drv, efx->net_dev, |
1582 | new_addr); | 1617 | "invalid ethernet MAC address requested: %pM\n", |
1618 | new_addr); | ||
1583 | return -EINVAL; | 1619 | return -EINVAL; |
1584 | } | 1620 | } |
1585 | 1621 | ||
@@ -1682,7 +1718,6 @@ static int efx_register_netdev(struct efx_nic *efx) | |||
1682 | net_dev->watchdog_timeo = 5 * HZ; | 1718 | net_dev->watchdog_timeo = 5 * HZ; |
1683 | net_dev->irq = efx->pci_dev->irq; | 1719 | net_dev->irq = efx->pci_dev->irq; |
1684 | net_dev->netdev_ops = &efx_netdev_ops; | 1720 | net_dev->netdev_ops = &efx_netdev_ops; |
1685 | SET_NETDEV_DEV(net_dev, &efx->pci_dev->dev); | ||
1686 | SET_ETHTOOL_OPS(net_dev, &efx_ethtool_ops); | 1721 | SET_ETHTOOL_OPS(net_dev, &efx_ethtool_ops); |
1687 | 1722 | ||
1688 | /* Clear MAC statistics */ | 1723 | /* Clear MAC statistics */ |
@@ -1707,7 +1742,8 @@ static int efx_register_netdev(struct efx_nic *efx) | |||
1707 | 1742 | ||
1708 | rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_type); | 1743 | rc = device_create_file(&efx->pci_dev->dev, &dev_attr_phy_type); |
1709 | if (rc) { | 1744 | if (rc) { |
1710 | EFX_ERR(efx, "failed to init net dev attributes\n"); | 1745 | netif_err(efx, drv, efx->net_dev, |
1746 | "failed to init net dev attributes\n"); | ||
1711 | goto fail_registered; | 1747 | goto fail_registered; |
1712 | } | 1748 | } |
1713 | 1749 | ||
@@ -1715,7 +1751,7 @@ static int efx_register_netdev(struct efx_nic *efx) | |||
1715 | 1751 | ||
1716 | fail_locked: | 1752 | fail_locked: |
1717 | rtnl_unlock(); | 1753 | rtnl_unlock(); |
1718 | EFX_ERR(efx, "could not register net dev\n"); | 1754 | netif_err(efx, drv, efx->net_dev, "could not register net dev\n"); |
1719 | return rc; | 1755 | return rc; |
1720 | 1756 | ||
1721 | fail_registered: | 1757 | fail_registered: |
@@ -1780,7 +1816,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) | |||
1780 | 1816 | ||
1781 | rc = efx->type->init(efx); | 1817 | rc = efx->type->init(efx); |
1782 | if (rc) { | 1818 | if (rc) { |
1783 | EFX_ERR(efx, "failed to initialise NIC\n"); | 1819 | netif_err(efx, drv, efx->net_dev, "failed to initialise NIC\n"); |
1784 | goto fail; | 1820 | goto fail; |
1785 | } | 1821 | } |
1786 | 1822 | ||
@@ -1792,7 +1828,8 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok) | |||
1792 | if (rc) | 1828 | if (rc) |
1793 | goto fail; | 1829 | goto fail; |
1794 | if (efx->phy_op->reconfigure(efx)) | 1830 | if (efx->phy_op->reconfigure(efx)) |
1795 | EFX_ERR(efx, "could not restore PHY settings\n"); | 1831 | netif_err(efx, drv, efx->net_dev, |
1832 | "could not restore PHY settings\n"); | ||
1796 | } | 1833 | } |
1797 | 1834 | ||
1798 | efx->mac_op->reconfigure(efx); | 1835 | efx->mac_op->reconfigure(efx); |
@@ -1825,13 +1862,14 @@ int efx_reset(struct efx_nic *efx, enum reset_type method) | |||
1825 | int rc, rc2; | 1862 | int rc, rc2; |
1826 | bool disabled; | 1863 | bool disabled; |
1827 | 1864 | ||
1828 | EFX_INFO(efx, "resetting (%s)\n", RESET_TYPE(method)); | 1865 | netif_info(efx, drv, efx->net_dev, "resetting (%s)\n", |
1866 | RESET_TYPE(method)); | ||
1829 | 1867 | ||
1830 | efx_reset_down(efx, method); | 1868 | efx_reset_down(efx, method); |
1831 | 1869 | ||
1832 | rc = efx->type->reset(efx, method); | 1870 | rc = efx->type->reset(efx, method); |
1833 | if (rc) { | 1871 | if (rc) { |
1834 | EFX_ERR(efx, "failed to reset hardware\n"); | 1872 | netif_err(efx, drv, efx->net_dev, "failed to reset hardware\n"); |
1835 | goto out; | 1873 | goto out; |
1836 | } | 1874 | } |
1837 | 1875 | ||
@@ -1856,10 +1894,10 @@ out: | |||
1856 | 1894 | ||
1857 | if (disabled) { | 1895 | if (disabled) { |
1858 | dev_close(efx->net_dev); | 1896 | dev_close(efx->net_dev); |
1859 | EFX_ERR(efx, "has been disabled\n"); | 1897 | netif_err(efx, drv, efx->net_dev, "has been disabled\n"); |
1860 | efx->state = STATE_DISABLED; | 1898 | efx->state = STATE_DISABLED; |
1861 | } else { | 1899 | } else { |
1862 | EFX_LOG(efx, "reset complete\n"); | 1900 | netif_dbg(efx, drv, efx->net_dev, "reset complete\n"); |
1863 | } | 1901 | } |
1864 | return rc; | 1902 | return rc; |
1865 | } | 1903 | } |
@@ -1877,7 +1915,8 @@ static void efx_reset_work(struct work_struct *data) | |||
1877 | /* If we're not RUNNING then don't reset. Leave the reset_pending | 1915 | /* If we're not RUNNING then don't reset. Leave the reset_pending |
1878 | * flag set so that efx_pci_probe_main will be retried */ | 1916 | * flag set so that efx_pci_probe_main will be retried */ |
1879 | if (efx->state != STATE_RUNNING) { | 1917 | if (efx->state != STATE_RUNNING) { |
1880 | EFX_INFO(efx, "scheduled reset quenched. NIC not RUNNING\n"); | 1918 | netif_info(efx, drv, efx->net_dev, |
1919 | "scheduled reset quenched. NIC not RUNNING\n"); | ||
1881 | return; | 1920 | return; |
1882 | } | 1921 | } |
1883 | 1922 | ||
@@ -1891,7 +1930,8 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) | |||
1891 | enum reset_type method; | 1930 | enum reset_type method; |
1892 | 1931 | ||
1893 | if (efx->reset_pending != RESET_TYPE_NONE) { | 1932 | if (efx->reset_pending != RESET_TYPE_NONE) { |
1894 | EFX_INFO(efx, "quenching already scheduled reset\n"); | 1933 | netif_info(efx, drv, efx->net_dev, |
1934 | "quenching already scheduled reset\n"); | ||
1895 | return; | 1935 | return; |
1896 | } | 1936 | } |
1897 | 1937 | ||
@@ -1915,10 +1955,12 @@ void efx_schedule_reset(struct efx_nic *efx, enum reset_type type) | |||
1915 | } | 1955 | } |
1916 | 1956 | ||
1917 | if (method != type) | 1957 | if (method != type) |
1918 | EFX_LOG(efx, "scheduling %s reset for %s\n", | 1958 | netif_dbg(efx, drv, efx->net_dev, |
1919 | RESET_TYPE(method), RESET_TYPE(type)); | 1959 | "scheduling %s reset for %s\n", |
1960 | RESET_TYPE(method), RESET_TYPE(type)); | ||
1920 | else | 1961 | else |
1921 | EFX_LOG(efx, "scheduling %s reset\n", RESET_TYPE(method)); | 1962 | netif_dbg(efx, drv, efx->net_dev, "scheduling %s reset\n", |
1963 | RESET_TYPE(method)); | ||
1922 | 1964 | ||
1923 | efx->reset_pending = method; | 1965 | efx->reset_pending = method; |
1924 | 1966 | ||
@@ -2005,6 +2047,7 @@ static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type, | |||
2005 | INIT_WORK(&efx->reset_work, efx_reset_work); | 2047 | INIT_WORK(&efx->reset_work, efx_reset_work); |
2006 | INIT_DELAYED_WORK(&efx->monitor_work, efx_monitor); | 2048 | INIT_DELAYED_WORK(&efx->monitor_work, efx_monitor); |
2007 | efx->pci_dev = pci_dev; | 2049 | efx->pci_dev = pci_dev; |
2050 | efx->msg_enable = debug; | ||
2008 | efx->state = STATE_INIT; | 2051 | efx->state = STATE_INIT; |
2009 | efx->reset_pending = RESET_TYPE_NONE; | 2052 | efx->reset_pending = RESET_TYPE_NONE; |
2010 | strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name)); | 2053 | strlcpy(efx->name, pci_name(pci_dev), sizeof(efx->name)); |
@@ -2124,7 +2167,7 @@ static void efx_pci_remove(struct pci_dev *pci_dev) | |||
2124 | efx_pci_remove_main(efx); | 2167 | efx_pci_remove_main(efx); |
2125 | 2168 | ||
2126 | efx_fini_io(efx); | 2169 | efx_fini_io(efx); |
2127 | EFX_LOG(efx, "shutdown successful\n"); | 2170 | netif_dbg(efx, drv, efx->net_dev, "shutdown successful\n"); |
2128 | 2171 | ||
2129 | pci_set_drvdata(pci_dev, NULL); | 2172 | pci_set_drvdata(pci_dev, NULL); |
2130 | efx_fini_struct(efx); | 2173 | efx_fini_struct(efx); |
@@ -2149,13 +2192,15 @@ static int efx_pci_probe_main(struct efx_nic *efx) | |||
2149 | 2192 | ||
2150 | rc = efx->type->init(efx); | 2193 | rc = efx->type->init(efx); |
2151 | if (rc) { | 2194 | if (rc) { |
2152 | EFX_ERR(efx, "failed to initialise NIC\n"); | 2195 | netif_err(efx, probe, efx->net_dev, |
2196 | "failed to initialise NIC\n"); | ||
2153 | goto fail3; | 2197 | goto fail3; |
2154 | } | 2198 | } |
2155 | 2199 | ||
2156 | rc = efx_init_port(efx); | 2200 | rc = efx_init_port(efx); |
2157 | if (rc) { | 2201 | if (rc) { |
2158 | EFX_ERR(efx, "failed to initialise port\n"); | 2202 | netif_err(efx, probe, efx->net_dev, |
2203 | "failed to initialise port\n"); | ||
2159 | goto fail4; | 2204 | goto fail4; |
2160 | } | 2205 | } |
2161 | 2206 | ||
@@ -2211,11 +2256,13 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, | |||
2211 | NETIF_F_HIGHDMA | NETIF_F_TSO); | 2256 | NETIF_F_HIGHDMA | NETIF_F_TSO); |
2212 | efx = netdev_priv(net_dev); | 2257 | efx = netdev_priv(net_dev); |
2213 | pci_set_drvdata(pci_dev, efx); | 2258 | pci_set_drvdata(pci_dev, efx); |
2259 | SET_NETDEV_DEV(net_dev, &pci_dev->dev); | ||
2214 | rc = efx_init_struct(efx, type, pci_dev, net_dev); | 2260 | rc = efx_init_struct(efx, type, pci_dev, net_dev); |
2215 | if (rc) | 2261 | if (rc) |
2216 | goto fail1; | 2262 | goto fail1; |
2217 | 2263 | ||
2218 | EFX_INFO(efx, "Solarflare Communications NIC detected\n"); | 2264 | netif_info(efx, probe, efx->net_dev, |
2265 | "Solarflare Communications NIC detected\n"); | ||
2219 | 2266 | ||
2220 | /* Set up basic I/O (BAR mappings etc) */ | 2267 | /* Set up basic I/O (BAR mappings etc) */ |
2221 | rc = efx_init_io(efx); | 2268 | rc = efx_init_io(efx); |
@@ -2253,7 +2300,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, | |||
2253 | } | 2300 | } |
2254 | 2301 | ||
2255 | if (rc) { | 2302 | if (rc) { |
2256 | EFX_ERR(efx, "Could not reset NIC\n"); | 2303 | netif_err(efx, probe, efx->net_dev, "Could not reset NIC\n"); |
2257 | goto fail4; | 2304 | goto fail4; |
2258 | } | 2305 | } |
2259 | 2306 | ||
@@ -2265,7 +2312,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, | |||
2265 | if (rc) | 2312 | if (rc) |
2266 | goto fail5; | 2313 | goto fail5; |
2267 | 2314 | ||
2268 | EFX_LOG(efx, "initialisation successful\n"); | 2315 | netif_dbg(efx, probe, efx->net_dev, "initialisation successful\n"); |
2269 | 2316 | ||
2270 | rtnl_lock(); | 2317 | rtnl_lock(); |
2271 | efx_mtd_probe(efx); /* allowed to fail */ | 2318 | efx_mtd_probe(efx); /* allowed to fail */ |
@@ -2281,7 +2328,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev, | |||
2281 | efx_fini_struct(efx); | 2328 | efx_fini_struct(efx); |
2282 | fail1: | 2329 | fail1: |
2283 | WARN_ON(rc > 0); | 2330 | WARN_ON(rc > 0); |
2284 | EFX_LOG(efx, "initialisation failed. rc=%d\n", rc); | 2331 | netif_dbg(efx, drv, efx->net_dev, "initialisation failed. rc=%d\n", rc); |
2285 | free_netdev(net_dev); | 2332 | free_netdev(net_dev); |
2286 | return rc; | 2333 | return rc; |
2287 | } | 2334 | } |