diff options
author | Auke Kok <auke-jan.h.kok@intel.com> | 2006-05-23 13:34:59 -0400 |
---|---|---|
committer | Auke Kok <juke-jan.h.kok@intel.com> | 2006-05-23 13:34:59 -0400 |
commit | ec9c3f5d3b8c4dd7340800f02eed87bdf0233e3b (patch) | |
tree | 5397e9b952cf06246b8360bab0e27f91eb329ae4 /drivers/net/ixgb/ixgb_main.c | |
parent | c85fd6f0dedcec411438768bb5ebd133b1ae3347 (diff) |
ixgb: use DPRINTK and msglvl, and ethtool to control it
Use DPRINTK and msglvl, and ethtool to control it. Add proper names
to netdev structs and mappings.
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: John Ronciak <john.ronciak@intel.com>
Diffstat (limited to 'drivers/net/ixgb/ixgb_main.c')
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 0de3ed08ff56..4115bf360d93 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -150,6 +150,11 @@ MODULE_DESCRIPTION("Intel(R) PRO/10GbE Network Driver"); | |||
150 | MODULE_LICENSE("GPL"); | 150 | MODULE_LICENSE("GPL"); |
151 | MODULE_VERSION(DRV_VERSION); | 151 | MODULE_VERSION(DRV_VERSION); |
152 | 152 | ||
153 | #define DEFAULT_DEBUG_LEVEL_SHIFT 3 | ||
154 | static int debug = DEFAULT_DEBUG_LEVEL_SHIFT; | ||
155 | module_param(debug, int, 0); | ||
156 | MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); | ||
157 | |||
153 | /* some defines for controlling descriptor fetches in h/w */ | 158 | /* some defines for controlling descriptor fetches in h/w */ |
154 | #define RXDCTL_WTHRESH_DEFAULT 16 /* chip writes back at this many or RXT0 */ | 159 | #define RXDCTL_WTHRESH_DEFAULT 16 /* chip writes back at this many or RXT0 */ |
155 | #define RXDCTL_PTHRESH_DEFAULT 0 /* chip considers prefech below | 160 | #define RXDCTL_PTHRESH_DEFAULT 0 /* chip considers prefech below |
@@ -251,7 +256,7 @@ ixgb_up(struct ixgb_adapter *adapter) | |||
251 | if (!pcix) | 256 | if (!pcix) |
252 | adapter->have_msi = FALSE; | 257 | adapter->have_msi = FALSE; |
253 | else if((err = pci_enable_msi(adapter->pdev))) { | 258 | else if((err = pci_enable_msi(adapter->pdev))) { |
254 | printk (KERN_ERR | 259 | DPRINTK(PROBE, ERR, |
255 | "Unable to allocate MSI interrupt Error: %d\n", err); | 260 | "Unable to allocate MSI interrupt Error: %d\n", err); |
256 | adapter->have_msi = FALSE; | 261 | adapter->have_msi = FALSE; |
257 | /* proceed to try to request regular interrupt */ | 262 | /* proceed to try to request regular interrupt */ |
@@ -261,8 +266,11 @@ ixgb_up(struct ixgb_adapter *adapter) | |||
261 | #endif | 266 | #endif |
262 | if((err = request_irq(adapter->pdev->irq, &ixgb_intr, | 267 | if((err = request_irq(adapter->pdev->irq, &ixgb_intr, |
263 | SA_SHIRQ | SA_SAMPLE_RANDOM, | 268 | SA_SHIRQ | SA_SAMPLE_RANDOM, |
264 | netdev->name, netdev))) | 269 | netdev->name, netdev))) { |
270 | DPRINTK(PROBE, ERR, | ||
271 | "Unable to allocate interrupt Error: %d\n", err); | ||
265 | return err; | 272 | return err; |
273 | } | ||
266 | 274 | ||
267 | /* disable interrupts and get the hardware into a known state */ | 275 | /* disable interrupts and get the hardware into a known state */ |
268 | IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff); | 276 | IXGB_WRITE_REG(&adapter->hw, IMC, 0xffffffff); |
@@ -328,7 +336,7 @@ ixgb_reset(struct ixgb_adapter *adapter) | |||
328 | 336 | ||
329 | ixgb_adapter_stop(&adapter->hw); | 337 | ixgb_adapter_stop(&adapter->hw); |
330 | if(!ixgb_init_hw(&adapter->hw)) | 338 | if(!ixgb_init_hw(&adapter->hw)) |
331 | IXGB_DBG("ixgb_init_hw failed.\n"); | 339 | DPRINTK(PROBE, ERR, "ixgb_init_hw failed.\n"); |
332 | } | 340 | } |
333 | 341 | ||
334 | /** | 342 | /** |
@@ -365,7 +373,8 @@ ixgb_probe(struct pci_dev *pdev, | |||
365 | } else { | 373 | } else { |
366 | if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) || | 374 | if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK)) || |
367 | (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) { | 375 | (err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK))) { |
368 | IXGB_ERR("No usable DMA configuration, aborting\n"); | 376 | printk(KERN_ERR |
377 | "ixgb: No usable DMA configuration, aborting\n"); | ||
369 | goto err_dma_mask; | 378 | goto err_dma_mask; |
370 | } | 379 | } |
371 | pci_using_dac = 0; | 380 | pci_using_dac = 0; |
@@ -390,6 +399,7 @@ ixgb_probe(struct pci_dev *pdev, | |||
390 | adapter->netdev = netdev; | 399 | adapter->netdev = netdev; |
391 | adapter->pdev = pdev; | 400 | adapter->pdev = pdev; |
392 | adapter->hw.back = adapter; | 401 | adapter->hw.back = adapter; |
402 | adapter->msg_enable = netif_msg_init(debug, DEFAULT_DEBUG_LEVEL_SHIFT); | ||
393 | 403 | ||
394 | mmio_start = pci_resource_start(pdev, BAR_0); | 404 | mmio_start = pci_resource_start(pdev, BAR_0); |
395 | mmio_len = pci_resource_len(pdev, BAR_0); | 405 | mmio_len = pci_resource_len(pdev, BAR_0); |
@@ -430,6 +440,7 @@ ixgb_probe(struct pci_dev *pdev, | |||
430 | netdev->poll_controller = ixgb_netpoll; | 440 | netdev->poll_controller = ixgb_netpoll; |
431 | #endif | 441 | #endif |
432 | 442 | ||
443 | strcpy(netdev->name, pci_name(pdev)); | ||
433 | netdev->mem_start = mmio_start; | 444 | netdev->mem_start = mmio_start; |
434 | netdev->mem_end = mmio_start + mmio_len; | 445 | netdev->mem_end = mmio_start + mmio_len; |
435 | netdev->base_addr = adapter->hw.io_base; | 446 | netdev->base_addr = adapter->hw.io_base; |
@@ -461,7 +472,7 @@ ixgb_probe(struct pci_dev *pdev, | |||
461 | /* make sure the EEPROM is good */ | 472 | /* make sure the EEPROM is good */ |
462 | 473 | ||
463 | if(!ixgb_validate_eeprom_checksum(&adapter->hw)) { | 474 | if(!ixgb_validate_eeprom_checksum(&adapter->hw)) { |
464 | printk(KERN_ERR "The EEPROM Checksum Is Not Valid\n"); | 475 | DPRINTK(PROBE, ERR, "The EEPROM Checksum Is Not Valid\n"); |
465 | err = -EIO; | 476 | err = -EIO; |
466 | goto err_eeprom; | 477 | goto err_eeprom; |
467 | } | 478 | } |
@@ -470,6 +481,7 @@ ixgb_probe(struct pci_dev *pdev, | |||
470 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); | 481 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); |
471 | 482 | ||
472 | if(!is_valid_ether_addr(netdev->perm_addr)) { | 483 | if(!is_valid_ether_addr(netdev->perm_addr)) { |
484 | DPRINTK(PROBE, ERR, "Invalid MAC Address\n"); | ||
473 | err = -EIO; | 485 | err = -EIO; |
474 | goto err_eeprom; | 486 | goto err_eeprom; |
475 | } | 487 | } |
@@ -483,6 +495,7 @@ ixgb_probe(struct pci_dev *pdev, | |||
483 | INIT_WORK(&adapter->tx_timeout_task, | 495 | INIT_WORK(&adapter->tx_timeout_task, |
484 | (void (*)(void *))ixgb_tx_timeout_task, netdev); | 496 | (void (*)(void *))ixgb_tx_timeout_task, netdev); |
485 | 497 | ||
498 | strcpy(netdev->name, "eth%d"); | ||
486 | if((err = register_netdev(netdev))) | 499 | if((err = register_netdev(netdev))) |
487 | goto err_register; | 500 | goto err_register; |
488 | 501 | ||
@@ -491,8 +504,7 @@ ixgb_probe(struct pci_dev *pdev, | |||
491 | netif_carrier_off(netdev); | 504 | netif_carrier_off(netdev); |
492 | netif_stop_queue(netdev); | 505 | netif_stop_queue(netdev); |
493 | 506 | ||
494 | printk(KERN_INFO "%s: Intel(R) PRO/10GbE Network Connection\n", | 507 | DPRINTK(PROBE, INFO, "Intel(R) PRO/10GbE Network Connection\n"); |
495 | netdev->name); | ||
496 | ixgb_check_options(adapter); | 508 | ixgb_check_options(adapter); |
497 | /* reset the hardware with the new settings */ | 509 | /* reset the hardware with the new settings */ |
498 | 510 | ||
@@ -573,7 +585,7 @@ ixgb_sw_init(struct ixgb_adapter *adapter) | |||
573 | hw->mac_type = ixgb_82597; | 585 | hw->mac_type = ixgb_82597; |
574 | else { | 586 | else { |
575 | /* should never have loaded on this device */ | 587 | /* should never have loaded on this device */ |
576 | printk(KERN_ERR "ixgb: unsupported device id\n"); | 588 | DPRINTK(PROBE, ERR, "unsupported device id\n"); |
577 | } | 589 | } |
578 | 590 | ||
579 | /* enable flow control to be programmed */ | 591 | /* enable flow control to be programmed */ |
@@ -671,6 +683,8 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter) | |||
671 | size = sizeof(struct ixgb_buffer) * txdr->count; | 683 | size = sizeof(struct ixgb_buffer) * txdr->count; |
672 | txdr->buffer_info = vmalloc(size); | 684 | txdr->buffer_info = vmalloc(size); |
673 | if(!txdr->buffer_info) { | 685 | if(!txdr->buffer_info) { |
686 | DPRINTK(PROBE, ERR, | ||
687 | "Unable to allocate transmit descriptor ring memory\n"); | ||
674 | return -ENOMEM; | 688 | return -ENOMEM; |
675 | } | 689 | } |
676 | memset(txdr->buffer_info, 0, size); | 690 | memset(txdr->buffer_info, 0, size); |
@@ -683,6 +697,8 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter) | |||
683 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); | 697 | txdr->desc = pci_alloc_consistent(pdev, txdr->size, &txdr->dma); |
684 | if(!txdr->desc) { | 698 | if(!txdr->desc) { |
685 | vfree(txdr->buffer_info); | 699 | vfree(txdr->buffer_info); |
700 | DPRINTK(PROBE, ERR, | ||
701 | "Unable to allocate transmit descriptor memory\n"); | ||
686 | return -ENOMEM; | 702 | return -ENOMEM; |
687 | } | 703 | } |
688 | memset(txdr->desc, 0, txdr->size); | 704 | memset(txdr->desc, 0, txdr->size); |
@@ -756,6 +772,8 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter) | |||
756 | size = sizeof(struct ixgb_buffer) * rxdr->count; | 772 | size = sizeof(struct ixgb_buffer) * rxdr->count; |
757 | rxdr->buffer_info = vmalloc(size); | 773 | rxdr->buffer_info = vmalloc(size); |
758 | if(!rxdr->buffer_info) { | 774 | if(!rxdr->buffer_info) { |
775 | DPRINTK(PROBE, ERR, | ||
776 | "Unable to allocate receive descriptor ring\n"); | ||
759 | return -ENOMEM; | 777 | return -ENOMEM; |
760 | } | 778 | } |
761 | memset(rxdr->buffer_info, 0, size); | 779 | memset(rxdr->buffer_info, 0, size); |
@@ -769,6 +787,8 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter) | |||
769 | 787 | ||
770 | if(!rxdr->desc) { | 788 | if(!rxdr->desc) { |
771 | vfree(rxdr->buffer_info); | 789 | vfree(rxdr->buffer_info); |
790 | DPRINTK(PROBE, ERR, | ||
791 | "Unable to allocate receive descriptors\n"); | ||
772 | return -ENOMEM; | 792 | return -ENOMEM; |
773 | } | 793 | } |
774 | memset(rxdr->desc, 0, rxdr->size); | 794 | memset(rxdr->desc, 0, rxdr->size); |
@@ -1118,8 +1138,8 @@ ixgb_watchdog(unsigned long data) | |||
1118 | 1138 | ||
1119 | if(adapter->hw.link_up) { | 1139 | if(adapter->hw.link_up) { |
1120 | if(!netif_carrier_ok(netdev)) { | 1140 | if(!netif_carrier_ok(netdev)) { |
1121 | printk(KERN_INFO "ixgb: %s NIC Link is Up %d Mbps %s\n", | 1141 | DPRINTK(LINK, INFO, |
1122 | netdev->name, 10000, "Full Duplex"); | 1142 | "NIC Link is Up 10000 Mbps Full Duplex\n"); |
1123 | adapter->link_speed = 10000; | 1143 | adapter->link_speed = 10000; |
1124 | adapter->link_duplex = FULL_DUPLEX; | 1144 | adapter->link_duplex = FULL_DUPLEX; |
1125 | netif_carrier_on(netdev); | 1145 | netif_carrier_on(netdev); |
@@ -1129,9 +1149,7 @@ ixgb_watchdog(unsigned long data) | |||
1129 | if(netif_carrier_ok(netdev)) { | 1149 | if(netif_carrier_ok(netdev)) { |
1130 | adapter->link_speed = 0; | 1150 | adapter->link_speed = 0; |
1131 | adapter->link_duplex = 0; | 1151 | adapter->link_duplex = 0; |
1132 | printk(KERN_INFO | 1152 | DPRINTK(LINK, INFO, "NIC Link is Down\n"); |
1133 | "ixgb: %s NIC Link is Down\n", | ||
1134 | netdev->name); | ||
1135 | netif_carrier_off(netdev); | 1153 | netif_carrier_off(netdev); |
1136 | netif_stop_queue(netdev); | 1154 | netif_stop_queue(netdev); |
1137 | 1155 | ||
@@ -1529,7 +1547,7 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu) | |||
1529 | 1547 | ||
1530 | if((max_frame < IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) | 1548 | if((max_frame < IXGB_MIN_ENET_FRAME_SIZE_WITHOUT_FCS + ENET_FCS_LENGTH) |
1531 | || (max_frame > IXGB_MAX_JUMBO_FRAME_SIZE + ENET_FCS_LENGTH)) { | 1549 | || (max_frame > IXGB_MAX_JUMBO_FRAME_SIZE + ENET_FCS_LENGTH)) { |
1532 | IXGB_ERR("Invalid MTU setting\n"); | 1550 | DPRINTK(PROBE, ERR, "Invalid MTU setting %d\n", new_mtu); |
1533 | return -EINVAL; | 1551 | return -EINVAL; |
1534 | } | 1552 | } |
1535 | 1553 | ||