aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_ethtool.c
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-04-07 18:50:45 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-08 18:58:29 -0400
commitf98a9f693b5f4919d9c4085a2fd8d67c7e152f3e (patch)
treeef0acb778f9bdb7fed66de7f099f772ef7af1175 /drivers/net/netxen/netxen_nic_ethtool.c
parent1fbe63235893e5dce28fe91d8465dd231b0cb3d9 (diff)
netxen: sanitize function names
Replace superfluous wrapper functions with two macros: NXWR32 replaces netxen_nic_reg_write, netxen_nic_write_w0, netxen_nic_read_w1, netxen_crb_writelit_adapter. NXRD32 replaces netxen_nic_reg_read, netxen_nic_read_w0, netxen_nic_read_w1. Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_ethtool.c')
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c59
1 files changed, 26 insertions, 33 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 6c5a111e80bf..a452b2facb77 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -92,12 +92,9 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
92 strncpy(drvinfo->driver, netxen_nic_driver_name, 32); 92 strncpy(drvinfo->driver, netxen_nic_driver_name, 32);
93 strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); 93 strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32);
94 write_lock_irqsave(&adapter->adapter_lock, flags); 94 write_lock_irqsave(&adapter->adapter_lock, flags);
95 fw_major = adapter->hw_read_wx(adapter, 95 fw_major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR);
96 NETXEN_FW_VERSION_MAJOR); 96 fw_minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR);
97 fw_minor = adapter->hw_read_wx(adapter, 97 fw_build = NXRD32(adapter, NETXEN_FW_VERSION_SUB);
98 NETXEN_FW_VERSION_MINOR);
99 fw_build = adapter->hw_read_wx(adapter,
100 NETXEN_FW_VERSION_SUB);
101 write_unlock_irqrestore(&adapter->adapter_lock, flags); 98 write_unlock_irqrestore(&adapter->adapter_lock, flags);
102 sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build); 99 sprintf(drvinfo->fw_version, "%d.%d.%d", fw_major, fw_minor, fw_build);
103 100
@@ -135,7 +132,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
135 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { 132 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
136 u32 val; 133 u32 val;
137 134
138 val = adapter->hw_read_wx(adapter, NETXEN_PORT_MODE_ADDR); 135 val = NXRD32(adapter, NETXEN_PORT_MODE_ADDR);
139 if (val == NETXEN_PORT_MODE_802_3_AP) { 136 if (val == NETXEN_PORT_MODE_802_3_AP) {
140 ecmd->supported = SUPPORTED_1000baseT_Full; 137 ecmd->supported = SUPPORTED_1000baseT_Full;
141 ecmd->advertising = ADVERTISED_1000baseT_Full; 138 ecmd->advertising = ADVERTISED_1000baseT_Full;
@@ -156,8 +153,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
156 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { 153 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
157 u16 pcifn = adapter->ahw.pci_func; 154 u16 pcifn = adapter->ahw.pci_func;
158 155
159 val = adapter->hw_read_wx(adapter, 156 val = NXRD32(adapter, P3_LINK_SPEED_REG(pcifn));
160 P3_LINK_SPEED_REG(pcifn));
161 ecmd->speed = P3_LINK_SPEED_MHZ * 157 ecmd->speed = P3_LINK_SPEED_MHZ *
162 P3_LINK_SPEED_VAL(pcifn, val); 158 P3_LINK_SPEED_VAL(pcifn, val);
163 } else 159 } else
@@ -423,12 +419,11 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
423 regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) | 419 regs->version = (1 << 24) | (adapter->ahw.revision_id << 16) |
424 (adapter->pdev)->device; 420 (adapter->pdev)->device;
425 /* which mode */ 421 /* which mode */
426 regs_buff[0] = adapter->hw_read_wx(adapter, NETXEN_NIU_MODE); 422 regs_buff[0] = NXRD32(adapter, NETXEN_NIU_MODE);
427 mode = regs_buff[0]; 423 mode = regs_buff[0];
428 424
429 /* Common registers to all the modes */ 425 /* Common registers to all the modes */
430 regs_buff[2] = adapter->hw_read_wx(adapter, 426 regs_buff[2] = NXRD32(adapter, NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER);
431 NETXEN_NIU_STRAP_VALUE_SAVE_HIGHER);
432 /* GB/XGB Mode */ 427 /* GB/XGB Mode */
433 mode = (mode / 2) - 1; 428 mode = (mode / 2) - 1;
434 window = 0; 429 window = 0;
@@ -439,7 +434,7 @@ netxen_nic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p)
439 window = adapter->physical_port * 434 window = adapter->physical_port *
440 NETXEN_NIC_PORT_WINDOW; 435 NETXEN_NIC_PORT_WINDOW;
441 436
442 regs_buff[i] = adapter->hw_read_wx(adapter, 437 regs_buff[i] = NXRD32(adapter,
443 niu_registers[mode].reg[i - 3] + window); 438 niu_registers[mode].reg[i - 3] + window);
444 } 439 }
445 440
@@ -464,7 +459,7 @@ static u32 netxen_nic_test_link(struct net_device *dev)
464 return !val; 459 return !val;
465 } 460 }
466 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { 461 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
467 val = adapter->hw_read_wx(adapter, CRB_XG_STATE); 462 val = NXRD32(adapter, CRB_XG_STATE);
468 return (val == XG_LINK_UP) ? 0 : 1; 463 return (val == XG_LINK_UP) ? 0 : 1;
469 } 464 }
470 return -EIO; 465 return -EIO;
@@ -528,10 +523,9 @@ netxen_nic_get_pauseparam(struct net_device *dev,
528 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 523 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
529 return; 524 return;
530 /* get flow control settings */ 525 /* get flow control settings */
531 val = netxen_nic_read_w0(adapter, 526 val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port));
532 NETXEN_NIU_GB_MAC_CONFIG_0(port));
533 pause->rx_pause = netxen_gb_get_rx_flowctl(val); 527 pause->rx_pause = netxen_gb_get_rx_flowctl(val);
534 val = netxen_nic_read_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL); 528 val = NXRD32(adapter, NETXEN_NIU_GB_PAUSE_CTL);
535 switch (port) { 529 switch (port) {
536 case 0: 530 case 0:
537 pause->tx_pause = !(netxen_gb_get_gb0_mask(val)); 531 pause->tx_pause = !(netxen_gb_get_gb0_mask(val));
@@ -551,7 +545,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
551 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) 545 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
552 return; 546 return;
553 pause->rx_pause = 1; 547 pause->rx_pause = 1;
554 val = netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL); 548 val = NXRD32(adapter, NETXEN_NIU_XG_PAUSE_CTL);
555 if (port == 0) 549 if (port == 0)
556 pause->tx_pause = !(netxen_xg_get_xg0_mask(val)); 550 pause->tx_pause = !(netxen_xg_get_xg0_mask(val));
557 else 551 else
@@ -574,18 +568,17 @@ netxen_nic_set_pauseparam(struct net_device *dev,
574 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 568 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
575 return -EIO; 569 return -EIO;
576 /* set flow control */ 570 /* set flow control */
577 val = netxen_nic_read_w0(adapter, 571 val = NXRD32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port));
578 NETXEN_NIU_GB_MAC_CONFIG_0(port));
579 572
580 if (pause->rx_pause) 573 if (pause->rx_pause)
581 netxen_gb_rx_flowctl(val); 574 netxen_gb_rx_flowctl(val);
582 else 575 else
583 netxen_gb_unset_rx_flowctl(val); 576 netxen_gb_unset_rx_flowctl(val);
584 577
585 netxen_nic_write_w0(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port), 578 NXWR32(adapter, NETXEN_NIU_GB_MAC_CONFIG_0(port),
586 val); 579 val);
587 /* set autoneg */ 580 /* set autoneg */
588 val = netxen_nic_read_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL); 581 val = NXRD32(adapter, NETXEN_NIU_GB_PAUSE_CTL);
589 switch (port) { 582 switch (port) {
590 case 0: 583 case 0:
591 if (pause->tx_pause) 584 if (pause->tx_pause)
@@ -613,11 +606,11 @@ netxen_nic_set_pauseparam(struct net_device *dev,
613 netxen_gb_set_gb3_mask(val); 606 netxen_gb_set_gb3_mask(val);
614 break; 607 break;
615 } 608 }
616 netxen_nic_write_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL, val); 609 NXWR32(adapter, NETXEN_NIU_GB_PAUSE_CTL, val);
617 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) { 610 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
618 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) 611 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
619 return -EIO; 612 return -EIO;
620 val = netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL); 613 val = NXRD32(adapter, NETXEN_NIU_XG_PAUSE_CTL);
621 if (port == 0) { 614 if (port == 0) {
622 if (pause->tx_pause) 615 if (pause->tx_pause)
623 netxen_xg_unset_xg0_mask(val); 616 netxen_xg_unset_xg0_mask(val);
@@ -629,7 +622,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
629 else 622 else
630 netxen_xg_set_xg1_mask(val); 623 netxen_xg_set_xg1_mask(val);
631 } 624 }
632 netxen_nic_write_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL, val); 625 NXWR32(adapter, NETXEN_NIU_XG_PAUSE_CTL, val);
633 } else { 626 } else {
634 printk(KERN_ERR "%s: Unknown board type: %x\n", 627 printk(KERN_ERR "%s: Unknown board type: %x\n",
635 netxen_nic_driver_name, 628 netxen_nic_driver_name,
@@ -643,14 +636,14 @@ static int netxen_nic_reg_test(struct net_device *dev)
643 struct netxen_adapter *adapter = netdev_priv(dev); 636 struct netxen_adapter *adapter = netdev_priv(dev);
644 u32 data_read, data_written; 637 u32 data_read, data_written;
645 638
646 data_read = netxen_nic_read_w0(adapter, NETXEN_PCIX_PH_REG(0)); 639 data_read = NXRD32(adapter, NETXEN_PCIX_PH_REG(0));
647 if ((data_read & 0xffff) != PHAN_VENDOR_ID) 640 if ((data_read & 0xffff) != PHAN_VENDOR_ID)
648 return 1; 641 return 1;
649 642
650 data_written = (u32)0xa5a5a5a5; 643 data_written = (u32)0xa5a5a5a5;
651 644
652 netxen_nic_reg_write(adapter, CRB_SCRATCHPAD_TEST, data_written); 645 NXWR32(adapter, CRB_SCRATCHPAD_TEST, data_written);
653 data_read = adapter->hw_read_wx(adapter, CRB_SCRATCHPAD_TEST); 646 data_read = NXRD32(adapter, CRB_SCRATCHPAD_TEST);
654 if (data_written != data_read) 647 if (data_written != data_read)
655 return 1; 648 return 1;
656 649
@@ -767,11 +760,11 @@ netxen_nic_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
767 if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) 760 if (NX_IS_REVISION_P2(adapter->ahw.revision_id))
768 return; 761 return;
769 762
770 wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG_NV); 763 wol_cfg = NXRD32(adapter, NETXEN_WOL_CONFIG_NV);
771 if (wol_cfg & (1UL << adapter->portnum)) 764 if (wol_cfg & (1UL << adapter->portnum))
772 wol->supported |= WAKE_MAGIC; 765 wol->supported |= WAKE_MAGIC;
773 766
774 wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG); 767 wol_cfg = NXRD32(adapter, NETXEN_WOL_CONFIG);
775 if (wol_cfg & (1UL << adapter->portnum)) 768 if (wol_cfg & (1UL << adapter->portnum))
776 wol->wolopts |= WAKE_MAGIC; 769 wol->wolopts |= WAKE_MAGIC;
777} 770}
@@ -788,16 +781,16 @@ netxen_nic_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
788 if (wol->wolopts & ~WAKE_MAGIC) 781 if (wol->wolopts & ~WAKE_MAGIC)
789 return -EOPNOTSUPP; 782 return -EOPNOTSUPP;
790 783
791 wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG_NV); 784 wol_cfg = NXRD32(adapter, NETXEN_WOL_CONFIG_NV);
792 if (!(wol_cfg & (1 << adapter->portnum))) 785 if (!(wol_cfg & (1 << adapter->portnum)))
793 return -EOPNOTSUPP; 786 return -EOPNOTSUPP;
794 787
795 wol_cfg = netxen_nic_reg_read(adapter, NETXEN_WOL_CONFIG); 788 wol_cfg = NXRD32(adapter, NETXEN_WOL_CONFIG);
796 if (wol->wolopts & WAKE_MAGIC) 789 if (wol->wolopts & WAKE_MAGIC)
797 wol_cfg |= 1UL << adapter->portnum; 790 wol_cfg |= 1UL << adapter->portnum;
798 else 791 else
799 wol_cfg &= ~(1UL << adapter->portnum); 792 wol_cfg &= ~(1UL << adapter->portnum);
800 netxen_nic_reg_write(adapter, NETXEN_WOL_CONFIG, wol_cfg); 793 NXWR32(adapter, NETXEN_WOL_CONFIG, wol_cfg);
801 794
802 return 0; 795 return 0;
803} 796}