aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_ethtool.c
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-03-09 04:50:56 -0400
committerDavid S. Miller <davem@davemloft.net>2009-03-10 08:10:04 -0400
commit1e2d0059fc24c84356721c16c2ad0590c38015a0 (patch)
treed968ab1ea6c4a7b3fe95cb75686576d57c0ab2e9 /drivers/net/netxen/netxen_nic_ethtool.c
parentbecf46a012db667c562bbbe589c14e100b62e5a4 (diff)
netxen: annotate board_config and board_type
Remove huge board config structure from each instance, read only necessary fields from flash. Replace board_type with port_type (1G/10G), there's another board_type field describing card type (SFP/XFP/CX4). 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.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index f811880a57c5..8b4bdfd6a117 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -115,10 +115,9 @@ static int
115netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) 115netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
116{ 116{
117 struct netxen_adapter *adapter = netdev_priv(dev); 117 struct netxen_adapter *adapter = netdev_priv(dev);
118 struct netxen_board_info *boardinfo = &adapter->ahw.boardcfg;
119 118
120 /* read which mode */ 119 /* read which mode */
121 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 120 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
122 ecmd->supported = (SUPPORTED_10baseT_Half | 121 ecmd->supported = (SUPPORTED_10baseT_Half |
123 SUPPORTED_10baseT_Full | 122 SUPPORTED_10baseT_Full |
124 SUPPORTED_100baseT_Half | 123 SUPPORTED_100baseT_Half |
@@ -137,7 +136,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
137 ecmd->duplex = adapter->link_duplex; 136 ecmd->duplex = adapter->link_duplex;
138 ecmd->autoneg = adapter->link_autoneg; 137 ecmd->autoneg = adapter->link_autoneg;
139 138
140 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 139 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
141 u32 val; 140 u32 val;
142 141
143 adapter->hw_read_wx(adapter, NETXEN_PORT_MODE_ADDR, &val, 4); 142 adapter->hw_read_wx(adapter, NETXEN_PORT_MODE_ADDR, &val, 4);
@@ -169,7 +168,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
169 ecmd->phy_address = adapter->physical_port; 168 ecmd->phy_address = adapter->physical_port;
170 ecmd->transceiver = XCVR_EXTERNAL; 169 ecmd->transceiver = XCVR_EXTERNAL;
171 170
172 switch ((netxen_brdtype_t) boardinfo->board_type) { 171 switch ((netxen_brdtype_t)adapter->ahw.board_type) {
173 case NETXEN_BRDTYPE_P2_SB35_4G: 172 case NETXEN_BRDTYPE_P2_SB35_4G:
174 case NETXEN_BRDTYPE_P2_SB31_2G: 173 case NETXEN_BRDTYPE_P2_SB31_2G:
175 case NETXEN_BRDTYPE_P3_REF_QG: 174 case NETXEN_BRDTYPE_P3_REF_QG:
@@ -185,7 +184,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
185 ecmd->supported |= SUPPORTED_TP; 184 ecmd->supported |= SUPPORTED_TP;
186 ecmd->advertising |= ADVERTISED_TP; 185 ecmd->advertising |= ADVERTISED_TP;
187 ecmd->port = PORT_TP; 186 ecmd->port = PORT_TP;
188 ecmd->autoneg = (boardinfo->board_type == 187 ecmd->autoneg = (adapter->ahw.board_type ==
189 NETXEN_BRDTYPE_P2_SB31_10G_CX4) ? 188 NETXEN_BRDTYPE_P2_SB31_10G_CX4) ?
190 (AUTONEG_DISABLE) : (adapter->link_autoneg); 189 (AUTONEG_DISABLE) : (adapter->link_autoneg);
191 break; 190 break;
@@ -212,7 +211,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
212 ecmd->autoneg = AUTONEG_DISABLE; 211 ecmd->autoneg = AUTONEG_DISABLE;
213 break; 212 break;
214 case NETXEN_BRDTYPE_P3_10G_TP: 213 case NETXEN_BRDTYPE_P3_10G_TP:
215 if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 214 if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
216 ecmd->autoneg = AUTONEG_DISABLE; 215 ecmd->autoneg = AUTONEG_DISABLE;
217 ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); 216 ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP);
218 ecmd->advertising |= 217 ecmd->advertising |=
@@ -228,7 +227,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
228 break; 227 break;
229 default: 228 default:
230 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", 229 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
231 (netxen_brdtype_t) boardinfo->board_type); 230 (netxen_brdtype_t)adapter->ahw.board_type);
232 return -EIO; 231 return -EIO;
233 } 232 }
234 233
@@ -242,7 +241,7 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
242 __u32 status; 241 __u32 status;
243 242
244 /* read which mode */ 243 /* read which mode */
245 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 244 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
246 /* autonegotiation */ 245 /* autonegotiation */
247 if (adapter->phy_write 246 if (adapter->phy_write
248 && adapter->phy_write(adapter, 247 && adapter->phy_write(adapter,
@@ -430,7 +429,7 @@ static u32 netxen_nic_test_link(struct net_device *dev)
430 int val; 429 int val;
431 430
432 /* read which mode */ 431 /* read which mode */
433 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 432 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
434 if (adapter->phy_read 433 if (adapter->phy_read
435 && adapter->phy_read(adapter, 434 && adapter->phy_read(adapter,
436 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 435 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
@@ -440,7 +439,7 @@ static u32 netxen_nic_test_link(struct net_device *dev)
440 val = netxen_get_phy_link(status); 439 val = netxen_get_phy_link(status);
441 return !val; 440 return !val;
442 } 441 }
443 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 442 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
444 val = adapter->pci_read_normalize(adapter, CRB_XG_STATE); 443 val = adapter->pci_read_normalize(adapter, CRB_XG_STATE);
445 return (val == XG_LINK_UP) ? 0 : 1; 444 return (val == XG_LINK_UP) ? 0 : 1;
446 } 445 }
@@ -483,7 +482,7 @@ netxen_nic_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
483 rds_rings[RCV_DESC_JUMBO_CTXID].max_rx_desc_count; 482 rds_rings[RCV_DESC_JUMBO_CTXID].max_rx_desc_count;
484 ring->tx_pending = adapter->max_tx_desc_count; 483 ring->tx_pending = adapter->max_tx_desc_count;
485 484
486 if (adapter->ahw.board_type == NETXEN_NIC_GBE) 485 if (adapter->ahw.port_type == NETXEN_NIC_GBE)
487 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_1G; 486 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_1G;
488 else 487 else
489 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_10G; 488 ring->rx_max_pending = MAX_RCV_DESCRIPTORS_10G;
@@ -501,7 +500,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
501 __u32 val; 500 __u32 val;
502 int port = adapter->physical_port; 501 int port = adapter->physical_port;
503 502
504 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 503 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
505 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 504 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
506 return; 505 return;
507 /* get flow control settings */ 506 /* get flow control settings */
@@ -524,7 +523,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
524 pause->tx_pause = !(netxen_gb_get_gb3_mask(val)); 523 pause->tx_pause = !(netxen_gb_get_gb3_mask(val));
525 break; 524 break;
526 } 525 }
527 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 526 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
528 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) 527 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
529 return; 528 return;
530 pause->rx_pause = 1; 529 pause->rx_pause = 1;
@@ -535,7 +534,7 @@ netxen_nic_get_pauseparam(struct net_device *dev,
535 pause->tx_pause = !(netxen_xg_get_xg1_mask(val)); 534 pause->tx_pause = !(netxen_xg_get_xg1_mask(val));
536 } else { 535 } else {
537 printk(KERN_ERR"%s: Unknown board type: %x\n", 536 printk(KERN_ERR"%s: Unknown board type: %x\n",
538 netxen_nic_driver_name, adapter->ahw.board_type); 537 netxen_nic_driver_name, adapter->ahw.port_type);
539 } 538 }
540} 539}
541 540
@@ -547,7 +546,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
547 __u32 val; 546 __u32 val;
548 int port = adapter->physical_port; 547 int port = adapter->physical_port;
549 /* read mode */ 548 /* read mode */
550 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 549 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
551 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) 550 if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS))
552 return -EIO; 551 return -EIO;
553 /* set flow control */ 552 /* set flow control */
@@ -591,7 +590,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
591 break; 590 break;
592 } 591 }
593 netxen_nic_write_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL, val); 592 netxen_nic_write_w0(adapter, NETXEN_NIU_GB_PAUSE_CTL, val);
594 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 593 } else if (adapter->ahw.port_type == NETXEN_NIC_XGBE) {
595 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) 594 if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS))
596 return -EIO; 595 return -EIO;
597 netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL, &val); 596 netxen_nic_read_w0(adapter, NETXEN_NIU_XG_PAUSE_CTL, &val);
@@ -610,7 +609,7 @@ netxen_nic_set_pauseparam(struct net_device *dev,
610 } else { 609 } else {
611 printk(KERN_ERR "%s: Unknown board type: %x\n", 610 printk(KERN_ERR "%s: Unknown board type: %x\n",
612 netxen_nic_driver_name, 611 netxen_nic_driver_name,
613 adapter->ahw.board_type); 612 adapter->ahw.port_type);
614 } 613 }
615 return 0; 614 return 0;
616} 615}