aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_ethtool.c
diff options
context:
space:
mode:
authorLinsys Contractor Mithlesh Thukral <mithlesh@netxen.com>2007-02-28 08:14:07 -0500
committerJeff Garzik <jeff@garzik.org>2007-03-02 20:02:28 -0500
commit0c25cfe18afffbc88a2bef28732be9e4846153fe (patch)
tree78cce22e91a7e6d5eeb379e24c8c258c508f157a /drivers/net/netxen/netxen_nic_ethtool.c
parentd518725fa68c2a90e04bea56a399d3d1c026269d (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/netxen/netxen_nic_ethtool.c')
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c144
1 files changed, 26 insertions, 118 deletions
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
84static const char netxen_nic_gstrings_test[][ETH_GSTRING_LEN] = { 84static 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
397static void
398netxen_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
405static u32 netxen_nic_test_link(struct net_device *dev) 396static 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
607static int netxen_nic_reg_test(struct net_device *dev) 601static 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
705static int netxen_nic_diag_test_count(struct net_device *dev) 620static 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,