diff options
author | Linsys Contractor Mithlesh Thukral <mithlesh@netxen.com> | 2007-02-28 08:14:07 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-03-02 20:02:28 -0500 |
commit | 0c25cfe18afffbc88a2bef28732be9e4846153fe (patch) | |
tree | 78cce22e91a7e6d5eeb379e24c8c258c508f157a /drivers/net | |
parent | d518725fa68c2a90e04bea56a399d3d1c026269d (diff) |
NetXen: Updates, removal of unsupported features and minor bug fixes.
Signed-off-by: Mithlesh Thukral <mithlesh@netxen.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 4 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 144 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_main.c | 4 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_phan_reg.h | 3 |
4 files changed, 34 insertions, 121 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 2807ef400fb5..81742e4e5610 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -72,6 +72,8 @@ | |||
72 | #define FLASH_SECTOR_SIZE (64 * 1024) | 72 | #define FLASH_SECTOR_SIZE (64 * 1024) |
73 | #define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE) | 73 | #define FLASH_TOTAL_SIZE (NUM_FLASH_SECTORS * FLASH_SECTOR_SIZE) |
74 | 74 | ||
75 | #define PHAN_VENDOR_ID 0x4040 | ||
76 | |||
75 | #define RCV_DESC_RINGSIZE \ | 77 | #define RCV_DESC_RINGSIZE \ |
76 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) | 78 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) |
77 | #define STATUS_DESC_RINGSIZE \ | 79 | #define STATUS_DESC_RINGSIZE \ |
@@ -82,7 +84,7 @@ | |||
82 | (sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count) | 84 | (sizeof(struct netxen_cmd_buffer) * adapter->max_tx_desc_count) |
83 | #define RCV_BUFFSIZE \ | 85 | #define RCV_BUFFSIZE \ |
84 | (sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count) | 86 | (sizeof(struct netxen_rx_buffer) * rcv_desc->max_rx_desc_count) |
85 | #define find_diff_among(a,b,range) ((a)<(b)?((b)-(a)):((b)+(range)-(a))) | 87 | #define find_diff_among(a,b,range) ((a)<=(b)?((b)-(a)):((b)+(range)-(a))) |
86 | 88 | ||
87 | #define NETXEN_NETDEV_STATUS 0x1 | 89 | #define NETXEN_NETDEV_STATUS 0x1 |
88 | #define NETXEN_RCV_PRODUCER_OFFSET 0 | 90 | #define NETXEN_RCV_PRODUCER_OFFSET 0 |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 6252e9a87278..986ef98db229 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -82,8 +82,7 @@ static const struct netxen_nic_stats netxen_nic_gstrings_stats[] = { | |||
82 | #define NETXEN_NIC_STATS_LEN ARRAY_SIZE(netxen_nic_gstrings_stats) | 82 | #define NETXEN_NIC_STATS_LEN ARRAY_SIZE(netxen_nic_gstrings_stats) |
83 | 83 | ||
84 | static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = { | 84 | static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = { |
85 | "Register_Test_offline", "EEPROM_Test_offline", | 85 | "Register_Test_on_offline", |
86 | "Interrupt_Test_offline", "Loopback_Test_offline", | ||
87 | "Link_Test_on_offline" | 86 | "Link_Test_on_offline" |
88 | }; | 87 | }; |
89 | 88 | ||
@@ -394,19 +393,12 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | |||
394 | } | 393 | } |
395 | } | 394 | } |
396 | 395 | ||
397 | static void | ||
398 | netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
399 | { | ||
400 | wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_MAGIC; | ||
401 | /* options can be added depending upon the mode */ | ||
402 | wol->wolopts = 0; | ||
403 | } | ||
404 | |||
405 | static u32 netxen_nic_test_link(struct net_device *dev) | 396 | static u32 netxen_nic_test_link(struct net_device *dev) |
406 | { | 397 | { |
407 | struct netxen_port *port = netdev_priv(dev); | 398 | struct netxen_port *port = netdev_priv(dev); |
408 | struct netxen_adapter *adapter = port->adapter; | 399 | struct netxen_adapter *adapter = port->adapter; |
409 | __u32 status; | 400 | __u32 status; |
401 | int val; | ||
410 | 402 | ||
411 | /* read which mode */ | 403 | /* read which mode */ |
412 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | 404 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { |
@@ -415,11 +407,13 @@ static u32 netxen_nic_test_link(struct net_device *dev) | |||
415 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 407 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
416 | &status) != 0) | 408 | &status) != 0) |
417 | return -EIO; | 409 | return -EIO; |
418 | else | 410 | else { |
419 | return (netxen_get_phy_link(status)); | 411 | val = netxen_get_phy_link(status); |
412 | return !val; | ||
413 | } | ||
420 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { | 414 | } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { |
421 | int val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); | 415 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); |
422 | return val == XG_LINK_UP; | 416 | return (val == XG_LINK_UP) ? 0 : 1; |
423 | } | 417 | } |
424 | return -EIO; | 418 | return -EIO; |
425 | } | 419 | } |
@@ -606,100 +600,21 @@ netxen_nic_set_pauseparam(struct net_device *dev, | |||
606 | 600 | ||
607 | static int netxen_nic_reg_test(struct net_device *dev) | 601 | static int netxen_nic_reg_test(struct net_device *dev) |
608 | { | 602 | { |
609 | struct netxen_port *port = netdev_priv(dev); | 603 | struct netxen_adapter *adapter = netdev_priv(dev); |
610 | struct netxen_adapter *adapter = port->adapter; | 604 | u32 data_read, data_written; |
611 | u32 data_read, data_written, save; | ||
612 | __u32 mode; | ||
613 | |||
614 | /* | ||
615 | * first test the "Read Only" registers by writing which mode | ||
616 | */ | ||
617 | netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); | ||
618 | if (netxen_get_niu_enable_ge(mode)) { /* GB Mode */ | ||
619 | netxen_nic_read_w0(adapter, | ||
620 | NETXEN_NIU_GB_MII_MGMT_STATUS(port->portnum), | ||
621 | &data_read); | ||
622 | |||
623 | save = data_read; | ||
624 | if (data_read) | ||
625 | data_written = data_read & NETXEN_NIC_INVALID_DATA; | ||
626 | else | ||
627 | data_written = NETXEN_NIC_INVALID_DATA; | ||
628 | netxen_nic_write_w0(adapter, | ||
629 | NETXEN_NIU_GB_MII_MGMT_STATUS(port-> | ||
630 | portnum), | ||
631 | data_written); | ||
632 | netxen_nic_read_w0(adapter, | ||
633 | NETXEN_NIU_GB_MII_MGMT_STATUS(port->portnum), | ||
634 | &data_read); | ||
635 | |||
636 | if (data_written == data_read) { | ||
637 | netxen_nic_write_w0(adapter, | ||
638 | NETXEN_NIU_GB_MII_MGMT_STATUS(port-> | ||
639 | portnum), | ||
640 | save); | ||
641 | |||
642 | return 0; | ||
643 | } | ||
644 | |||
645 | /* netxen_niu_gb_mii_mgmt_indicators is read only */ | ||
646 | netxen_nic_read_w0(adapter, | ||
647 | NETXEN_NIU_GB_MII_MGMT_INDICATE(port-> | ||
648 | portnum), | ||
649 | &data_read); | ||
650 | |||
651 | save = data_read; | ||
652 | if (data_read) | ||
653 | data_written = data_read & NETXEN_NIC_INVALID_DATA; | ||
654 | else | ||
655 | data_written = NETXEN_NIC_INVALID_DATA; | ||
656 | netxen_nic_write_w0(adapter, | ||
657 | NETXEN_NIU_GB_MII_MGMT_INDICATE(port-> | ||
658 | portnum), | ||
659 | data_written); | ||
660 | |||
661 | netxen_nic_read_w0(adapter, | ||
662 | NETXEN_NIU_GB_MII_MGMT_INDICATE(port-> | ||
663 | portnum), | ||
664 | &data_read); | ||
665 | |||
666 | if (data_written == data_read) { | ||
667 | netxen_nic_write_w0(adapter, | ||
668 | NETXEN_NIU_GB_MII_MGMT_INDICATE | ||
669 | (port->portnum), save); | ||
670 | return 0; | ||
671 | } | ||
672 | 605 | ||
673 | /* netxen_niu_gb_interface_status is read only */ | 606 | netxen_nic_read_w0(adapter, NETXEN_PCIX_PH_REG(0), &data_read); |
674 | netxen_nic_read_w0(adapter, | 607 | if ((data_read & 0xffff) != PHAN_VENDOR_ID) |
675 | NETXEN_NIU_GB_INTERFACE_STATUS(port-> | 608 | return 1; |
676 | portnum), | ||
677 | &data_read); | ||
678 | 609 | ||
679 | save = data_read; | 610 | data_written = (u32)0xa5a5a5a5; |
680 | if (data_read) | ||
681 | data_written = data_read & NETXEN_NIC_INVALID_DATA; | ||
682 | else | ||
683 | data_written = NETXEN_NIC_INVALID_DATA; | ||
684 | netxen_nic_write_w0(adapter, | ||
685 | NETXEN_NIU_GB_INTERFACE_STATUS(port-> | ||
686 | portnum), | ||
687 | data_written); | ||
688 | 611 | ||
689 | netxen_nic_read_w0(adapter, | 612 | netxen_nic_reg_write(adapter, CRB_SCRATCHPAD_TEST, data_written); |
690 | NETXEN_NIU_GB_INTERFACE_STATUS(port-> | 613 | data_read = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_SCRATCHPAD_TEST)); |
691 | portnum), | 614 | if (data_written != data_read) |
692 | &data_read); | 615 | return 1; |
693 | 616 | ||
694 | if (data_written == data_read) { | 617 | return 0; |
695 | netxen_nic_write_w0(adapter, | ||
696 | NETXEN_NIU_GB_INTERFACE_STATUS | ||
697 | (port->portnum), save); | ||
698 | |||
699 | return 0; | ||
700 | } | ||
701 | } /* GB Mode */ | ||
702 | return 1; | ||
703 | } | 618 | } |
704 | 619 | ||
705 | static int netxen_nic_diag_test_count(struct net_device *dev) | 620 | static int netxen_nic_diag_test_count(struct net_device *dev) |
@@ -713,26 +628,20 @@ netxen_nic_diag_test(struct net_device *dev, struct ethtool_test *eth_test, | |||
713 | { | 628 | { |
714 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */ | 629 | if (eth_test->flags == ETH_TEST_FL_OFFLINE) { /* offline tests */ |
715 | /* link test */ | 630 | /* link test */ |
716 | if (!(data[4] = (u64) netxen_nic_test_link(dev))) | 631 | if ((data[1] = (u64) netxen_nic_test_link(dev))) |
717 | eth_test->flags |= ETH_TEST_FL_FAILED; | 632 | eth_test->flags |= ETH_TEST_FL_FAILED; |
718 | 633 | ||
719 | if (netif_running(dev)) | ||
720 | dev->stop(dev); | ||
721 | |||
722 | /* register tests */ | 634 | /* register tests */ |
723 | if (!(data[0] = netxen_nic_reg_test(dev))) | 635 | if ((data[0] = netxen_nic_reg_test(dev))) |
724 | eth_test->flags |= ETH_TEST_FL_FAILED; | 636 | eth_test->flags |= ETH_TEST_FL_FAILED; |
725 | /* other tests pass as of now */ | ||
726 | data[1] = data[2] = data[3] = 1; | ||
727 | if (netif_running(dev)) | ||
728 | dev->open(dev); | ||
729 | } else { /* online tests */ | 637 | } else { /* online tests */ |
730 | /* link test */ | 638 | /* register tests */ |
731 | if (!(data[4] = (u64) netxen_nic_test_link(dev))) | 639 | if((data[0] = netxen_nic_reg_test(dev))) |
732 | eth_test->flags |= ETH_TEST_FL_FAILED; | 640 | eth_test->flags |= ETH_TEST_FL_FAILED; |
733 | 641 | ||
734 | /* other tests pass by default */ | 642 | /* link test */ |
735 | data[0] = data[1] = data[2] = data[3] = 1; | 643 | if ((data[1] = (u64) netxen_nic_test_link(dev))) |
644 | eth_test->flags |= ETH_TEST_FL_FAILED; | ||
736 | } | 645 | } |
737 | } | 646 | } |
738 | 647 | ||
@@ -783,7 +692,6 @@ struct ethtool_ops netxen_nic_ethtool_ops = { | |||
783 | .get_drvinfo = netxen_nic_get_drvinfo, | 692 | .get_drvinfo = netxen_nic_get_drvinfo, |
784 | .get_regs_len = netxen_nic_get_regs_len, | 693 | .get_regs_len = netxen_nic_get_regs_len, |
785 | .get_regs = netxen_nic_get_regs, | 694 | .get_regs = netxen_nic_get_regs, |
786 | .get_wol = netxen_nic_get_wol, | ||
787 | .get_link = ethtool_op_get_link, | 695 | .get_link = ethtool_op_get_link, |
788 | .get_eeprom_len = netxen_nic_get_eeprom_len, | 696 | .get_eeprom_len = netxen_nic_get_eeprom_len, |
789 | .get_eeprom = netxen_nic_get_eeprom, | 697 | .get_eeprom = netxen_nic_get_eeprom, |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 1bf3d494b92f..2227504ed4c0 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -42,8 +42,6 @@ | |||
42 | #include <linux/dma-mapping.h> | 42 | #include <linux/dma-mapping.h> |
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | 44 | ||
45 | #define PHAN_VENDOR_ID 0x4040 | ||
46 | |||
47 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); | 45 | MODULE_DESCRIPTION("NetXen Multi port (1/10) Gigabit Network Driver"); |
48 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
49 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); | 47 | MODULE_VERSION(NETXEN_NIC_LINUX_VERSIONID); |
@@ -379,6 +377,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
379 | netdev->tx_timeout = netxen_tx_timeout; | 377 | netdev->tx_timeout = netxen_tx_timeout; |
380 | netdev->watchdog_timeo = HZ; | 378 | netdev->watchdog_timeo = HZ; |
381 | 379 | ||
380 | netxen_nic_change_mtu(netdev, netdev->mtu); | ||
381 | |||
382 | SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); | 382 | SET_ETHTOOL_OPS(netdev, &netxen_nic_ethtool_ops); |
383 | netdev->poll = netxen_nic_poll; | 383 | netdev->poll = netxen_nic_poll; |
384 | netdev->weight = NETXEN_NETDEV_WEIGHT; | 384 | netdev->weight = NETXEN_NETDEV_WEIGHT; |
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h index 7879f855af0b..0c7c94328b7f 100644 --- a/drivers/net/netxen/netxen_nic_phan_reg.h +++ b/drivers/net/netxen/netxen_nic_phan_reg.h | |||
@@ -102,6 +102,9 @@ | |||
102 | #define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0) | 102 | #define CRB_CMD_CONSUMER_OFFSET_1 NETXEN_NIC_REG(0x1b0) |
103 | #define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4) | 103 | #define CRB_TEMP_STATE NETXEN_NIC_REG(0x1b4) |
104 | 104 | ||
105 | /* used for ethtool tests */ | ||
106 | #define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280) | ||
107 | |||
105 | /* | 108 | /* |
106 | * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address | 109 | * CrbPortPhanCntrHi/Lo is used to pass the address of HostPhantomIndex address |
107 | * which can be read by the Phantom host to get producer/consumer indexes from | 110 | * which can be read by the Phantom host to get producer/consumer indexes from |