diff options
author | Mithlesh Thukral <mithlesh@netxen.com> | 2007-04-20 10:53:05 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 11:01:05 -0400 |
commit | 13ba9c7714cfa40821d29090442de14d01d6eb33 (patch) | |
tree | 3e588342e36e85fb557c46e18efabbac6c69f80c /drivers/net/netxen/netxen_nic_niu.c | |
parent | 3176ff3ee71bddbd1d68e6a9e28dbcf0a2960c95 (diff) |
NetXen: Removal of redundant argument passing
NetXen: Removal of redundant function call parameters and bug fixes.
This patch will remove the redundant paramters which were being passed to
many functions since now adapter->portnum can be used.
Signed-off-by: Mithlesh Thukral <mithlesh@netxen.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_niu.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_niu.c | 96 |
1 files changed, 43 insertions, 53 deletions
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index f6befc32aa58..ad2486f2f646 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -88,12 +88,13 @@ static inline int phy_unlock(struct netxen_adapter *adapter) | |||
88 | * -1 on error | 88 | * -1 on error |
89 | * | 89 | * |
90 | */ | 90 | */ |
91 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, | 91 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long reg, |
92 | long reg, __u32 * readval) | 92 | __u32 * readval) |
93 | { | 93 | { |
94 | long timeout = 0; | 94 | long timeout = 0; |
95 | long result = 0; | 95 | long result = 0; |
96 | long restore = 0; | 96 | long restore = 0; |
97 | long phy = adapter->portnum; | ||
97 | __u32 address; | 98 | __u32 address; |
98 | __u32 command; | 99 | __u32 command; |
99 | __u32 status; | 100 | __u32 status; |
@@ -183,12 +184,13 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, | |||
183 | * -1 on error | 184 | * -1 on error |
184 | * | 185 | * |
185 | */ | 186 | */ |
186 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, | 187 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long reg, |
187 | long phy, long reg, __u32 val) | 188 | __u32 val) |
188 | { | 189 | { |
189 | long timeout = 0; | 190 | long timeout = 0; |
190 | long result = 0; | 191 | long result = 0; |
191 | long restore = 0; | 192 | long restore = 0; |
193 | long phy = adapter->portnum; | ||
192 | __u32 address; | 194 | __u32 address; |
193 | __u32 command; | 195 | __u32 command; |
194 | __u32 status; | 196 | __u32 status; |
@@ -258,15 +260,13 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, | |||
258 | return result; | 260 | return result; |
259 | } | 261 | } |
260 | 262 | ||
261 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter, | 263 | int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter) |
262 | int port) | ||
263 | { | 264 | { |
264 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_INT_MASK, 0x3f); | 265 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_INT_MASK, 0x3f); |
265 | return 0; | 266 | return 0; |
266 | } | 267 | } |
267 | 268 | ||
268 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, | 269 | int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter) |
269 | int port) | ||
270 | { | 270 | { |
271 | int result = 0; | 271 | int result = 0; |
272 | __u32 enable = 0; | 272 | __u32 enable = 0; |
@@ -275,7 +275,7 @@ int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, | |||
275 | netxen_set_phy_int_speed_changed(enable); | 275 | netxen_set_phy_int_speed_changed(enable); |
276 | 276 | ||
277 | if (0 != | 277 | if (0 != |
278 | netxen_niu_gbe_phy_write(adapter, port, | 278 | netxen_niu_gbe_phy_write(adapter, |
279 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, | 279 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, |
280 | enable)) | 280 | enable)) |
281 | result = -EIO; | 281 | result = -EIO; |
@@ -283,38 +283,34 @@ int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, | |||
283 | return result; | 283 | return result; |
284 | } | 284 | } |
285 | 285 | ||
286 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter, | 286 | int netxen_niu_xgbe_disable_phy_interrupts(struct netxen_adapter *adapter) |
287 | int port) | ||
288 | { | 287 | { |
289 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_INT_MASK, 0x7f); | 288 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_INT_MASK, 0x7f); |
290 | return 0; | 289 | return 0; |
291 | } | 290 | } |
292 | 291 | ||
293 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter, | 292 | int netxen_niu_gbe_disable_phy_interrupts(struct netxen_adapter *adapter) |
294 | int port) | ||
295 | { | 293 | { |
296 | int result = 0; | 294 | int result = 0; |
297 | if (0 != | 295 | if (0 != |
298 | netxen_niu_gbe_phy_write(adapter, port, | 296 | netxen_niu_gbe_phy_write(adapter, |
299 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, 0)) | 297 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_ENABLE, 0)) |
300 | result = -EIO; | 298 | result = -EIO; |
301 | 299 | ||
302 | return result; | 300 | return result; |
303 | } | 301 | } |
304 | 302 | ||
305 | int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter, | 303 | int netxen_niu_xgbe_clear_phy_interrupts(struct netxen_adapter *adapter) |
306 | int port) | ||
307 | { | 304 | { |
308 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_ACTIVE_INT, -1); | 305 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_ACTIVE_INT, -1); |
309 | return 0; | 306 | return 0; |
310 | } | 307 | } |
311 | 308 | ||
312 | int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter, | 309 | int netxen_niu_gbe_clear_phy_interrupts(struct netxen_adapter *adapter) |
313 | int port) | ||
314 | { | 310 | { |
315 | int result = 0; | 311 | int result = 0; |
316 | if (0 != | 312 | if (0 != |
317 | netxen_niu_gbe_phy_write(adapter, port, | 313 | netxen_niu_gbe_phy_write(adapter, |
318 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | 314 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, |
319 | -EIO)) | 315 | -EIO)) |
320 | result = -EIO; | 316 | result = -EIO; |
@@ -355,9 +351,9 @@ void netxen_niu_gbe_set_mii_mode(struct netxen_adapter *adapter, | |||
355 | 0x5); | 351 | 0x5); |
356 | } | 352 | } |
357 | 353 | ||
358 | if (netxen_niu_gbe_enable_phy_interrupts(adapter, port)) | 354 | if (netxen_niu_gbe_enable_phy_interrupts(adapter)) |
359 | printk(KERN_ERR PFX "ERROR enabling PHY interrupts\n"); | 355 | printk(KERN_ERR PFX "ERROR enabling PHY interrupts\n"); |
360 | if (netxen_niu_gbe_clear_phy_interrupts(adapter, port)) | 356 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) |
361 | printk(KERN_ERR PFX "ERROR clearing PHY interrupts\n"); | 357 | printk(KERN_ERR PFX "ERROR clearing PHY interrupts\n"); |
362 | } | 358 | } |
363 | 359 | ||
@@ -393,9 +389,9 @@ void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, | |||
393 | 0x5); | 389 | 0x5); |
394 | } | 390 | } |
395 | 391 | ||
396 | if (netxen_niu_gbe_enable_phy_interrupts(adapter, port)) | 392 | if (netxen_niu_gbe_enable_phy_interrupts(adapter)) |
397 | printk(KERN_ERR PFX "ERROR enabling PHY interrupts\n"); | 393 | printk(KERN_ERR PFX "ERROR enabling PHY interrupts\n"); |
398 | if (netxen_niu_gbe_clear_phy_interrupts(adapter, port)) | 394 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) |
399 | printk(KERN_ERR PFX "ERROR clearing PHY interrupts\n"); | 395 | printk(KERN_ERR PFX "ERROR clearing PHY interrupts\n"); |
400 | } | 396 | } |
401 | 397 | ||
@@ -404,11 +400,11 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
404 | int result = 0; | 400 | int result = 0; |
405 | __u32 status; | 401 | __u32 status; |
406 | if (adapter->disable_phy_interrupts) | 402 | if (adapter->disable_phy_interrupts) |
407 | adapter->disable_phy_interrupts(adapter, port); | 403 | adapter->disable_phy_interrupts(adapter); |
408 | mdelay(2); | 404 | mdelay(2); |
409 | 405 | ||
410 | if (0 == | 406 | if (0 == |
411 | netxen_niu_gbe_phy_read(adapter, port, | 407 | netxen_niu_gbe_phy_read(adapter, |
412 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 408 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
413 | &status)) { | 409 | &status)) { |
414 | if (netxen_get_phy_link(status)) { | 410 | if (netxen_get_phy_link(status)) { |
@@ -439,13 +435,13 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
439 | | NETXEN_GB_MAC_ENABLE_TX_RX | 435 | | NETXEN_GB_MAC_ENABLE_TX_RX |
440 | | | 436 | | |
441 | NETXEN_GB_MAC_PAUSED_FRMS); | 437 | NETXEN_GB_MAC_PAUSED_FRMS); |
442 | if (netxen_niu_gbe_clear_phy_interrupts(adapter, port)) | 438 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) |
443 | printk(KERN_ERR PFX | 439 | printk(KERN_ERR PFX |
444 | "ERROR clearing PHY interrupts\n"); | 440 | "ERROR clearing PHY interrupts\n"); |
445 | if (netxen_niu_gbe_enable_phy_interrupts(adapter, port)) | 441 | if (netxen_niu_gbe_enable_phy_interrupts(adapter)) |
446 | printk(KERN_ERR PFX | 442 | printk(KERN_ERR PFX |
447 | "ERROR enabling PHY interrupts\n"); | 443 | "ERROR enabling PHY interrupts\n"); |
448 | if (netxen_niu_gbe_clear_phy_interrupts(adapter, port)) | 444 | if (netxen_niu_gbe_clear_phy_interrupts(adapter)) |
449 | printk(KERN_ERR PFX | 445 | printk(KERN_ERR PFX |
450 | "ERROR clearing PHY interrupts\n"); | 446 | "ERROR clearing PHY interrupts\n"); |
451 | result = -1; | 447 | result = -1; |
@@ -458,24 +454,14 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
458 | 454 | ||
459 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) | 455 | int netxen_niu_xg_init_port(struct netxen_adapter *adapter, int port) |
460 | { | 456 | { |
461 | u32 reg = 0, ret = 0; | 457 | u32 ret = 0; |
462 | 458 | int portnum = adapter->portnum; | |
463 | if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) { | 459 | netxen_crb_writelit_adapter(adapter, |
464 | netxen_crb_writelit_adapter(adapter, | 460 | NETXEN_NIU_XGE_CONFIG_1 +(0x10000 * portnum), |
465 | NETXEN_NIU_XG1_CONFIG_0, 0x5); | 461 | 0x1447); |
466 | /* XXX hack for Mez cards: both ports in promisc mode */ | ||
467 | netxen_nic_hw_read_wx(adapter, | ||
468 | NETXEN_NIU_XGE_CONFIG_1, ®, 4); | ||
469 | reg = (reg | 0x2000UL); | ||
470 | netxen_crb_writelit_adapter(adapter, | ||
471 | NETXEN_NIU_XGE_CONFIG_1, reg); | ||
472 | reg = 0; | ||
473 | netxen_nic_hw_read_wx(adapter, | ||
474 | NETXEN_NIU_XG1_CONFIG_1, ®, 4); | ||
475 | reg = (reg | 0x2000UL); | ||
476 | netxen_crb_writelit_adapter(adapter, | 462 | netxen_crb_writelit_adapter(adapter, |
477 | NETXEN_NIU_XG1_CONFIG_1, reg); | 463 | NETXEN_NIU_XG1_CONFIG_1 + |
478 | } | 464 | (0x10000 * portnum), 0x5); |
479 | 465 | ||
480 | return ret; | 466 | return ret; |
481 | } | 467 | } |
@@ -498,7 +484,7 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | |||
498 | * The read of the PHY INT status will clear the pending | 484 | * The read of the PHY INT status will clear the pending |
499 | * interrupt status | 485 | * interrupt status |
500 | */ | 486 | */ |
501 | if (netxen_niu_gbe_phy_read(adapter, port, | 487 | if (netxen_niu_gbe_phy_read(adapter, |
502 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | 488 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, |
503 | &int_src) != 0) | 489 | &int_src) != 0) |
504 | result = -EINVAL; | 490 | result = -EINVAL; |
@@ -535,7 +521,7 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | |||
535 | printk(KERN_INFO PFX | 521 | printk(KERN_INFO PFX |
536 | "speed_changed or link status changed"); | 522 | "speed_changed or link status changed"); |
537 | if (netxen_niu_gbe_phy_read | 523 | if (netxen_niu_gbe_phy_read |
538 | (adapter, port, | 524 | (adapter, |
539 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 525 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
540 | &status) == 0) { | 526 | &status) == 0) { |
541 | if (netxen_get_phy_speed(status) == 2) { | 527 | if (netxen_get_phy_speed(status) == 2) { |
@@ -581,10 +567,11 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | |||
581 | * Note that the passed-in value must already be in network byte order. | 567 | * Note that the passed-in value must already be in network byte order. |
582 | */ | 568 | */ |
583 | int netxen_niu_macaddr_get(struct netxen_adapter *adapter, | 569 | int netxen_niu_macaddr_get(struct netxen_adapter *adapter, |
584 | int phy, netxen_ethernet_macaddr_t * addr) | 570 | netxen_ethernet_macaddr_t * addr) |
585 | { | 571 | { |
586 | u32 stationhigh; | 572 | u32 stationhigh; |
587 | u32 stationlow; | 573 | u32 stationlow; |
574 | int phy = adapter->portnum; | ||
588 | u8 val[8]; | 575 | u8 val[8]; |
589 | 576 | ||
590 | if (addr == NULL) | 577 | if (addr == NULL) |
@@ -633,7 +620,7 @@ int netxen_niu_macaddr_set(struct netxen_adapter *adapter, | |||
633 | (adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy), &val, 4)) | 620 | (adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy), &val, 4)) |
634 | return -2; | 621 | return -2; |
635 | 622 | ||
636 | netxen_niu_macaddr_get(adapter, phy, | 623 | netxen_niu_macaddr_get(adapter, |
637 | (netxen_ethernet_macaddr_t *) mac_addr); | 624 | (netxen_ethernet_macaddr_t *) mac_addr); |
638 | if (memcmp(mac_addr, addr, 6) == 0) | 625 | if (memcmp(mac_addr, addr, 6) == 0) |
639 | break; | 626 | break; |
@@ -845,9 +832,10 @@ int netxen_niu_xg_macaddr_set(struct netxen_adapter *adapter, | |||
845 | * Return the current station MAC address. | 832 | * Return the current station MAC address. |
846 | * Note that the passed-in value must already be in network byte order. | 833 | * Note that the passed-in value must already be in network byte order. |
847 | */ | 834 | */ |
848 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy, | 835 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, |
849 | netxen_ethernet_macaddr_t * addr) | 836 | netxen_ethernet_macaddr_t * addr) |
850 | { | 837 | { |
838 | int phy = adapter->portnum; | ||
851 | u32 stationhigh; | 839 | u32 stationhigh; |
852 | u32 stationlow; | 840 | u32 stationlow; |
853 | u8 val[8]; | 841 | u8 val[8]; |
@@ -877,17 +865,19 @@ int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, | |||
877 | __u32 reg; | 865 | __u32 reg; |
878 | int port = adapter->portnum; | 866 | int port = adapter->portnum; |
879 | 867 | ||
880 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 868 | if ((port < 0) || (port > NETXEN_NIU_MAX_XG_PORTS)) |
881 | return -EINVAL; | 869 | return -EINVAL; |
882 | 870 | ||
883 | if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_CONFIG_1, ®, 4)) | 871 | if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_CONFIG_1 + |
872 | (0x10000 * port), ®, 4)) | ||
884 | return -EIO; | 873 | return -EIO; |
885 | if (mode == NETXEN_NIU_PROMISC_MODE) | 874 | if (mode == NETXEN_NIU_PROMISC_MODE) |
886 | reg = (reg | 0x2000UL); | 875 | reg = (reg | 0x2000UL); |
887 | else | 876 | else |
888 | reg = (reg & ~0x2000UL); | 877 | reg = (reg & ~0x2000UL); |
889 | 878 | ||
890 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_XGE_CONFIG_1, reg); | 879 | netxen_crb_writelit_adapter(adapter, NETXEN_NIU_XGE_CONFIG_1 + |
880 | (0x10000 * port), reg); | ||
891 | 881 | ||
892 | return 0; | 882 | return 0; |
893 | } | 883 | } |