aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_main.c
diff options
context:
space:
mode:
authorMithlesh Thukral <mithlesh@netxen.com>2007-04-20 10:53:05 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:01:05 -0400
commit13ba9c7714cfa40821d29090442de14d01d6eb33 (patch)
tree3e588342e36e85fb557c46e18efabbac6c69f80c /drivers/net/netxen/netxen_nic_main.c
parent3176ff3ee71bddbd1d68e6a9e28dbcf0a2960c95 (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_main.c')
-rw-r--r--drivers/net/netxen/netxen_nic_main.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 514cb393f489..4e1a6aa91412 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -233,6 +233,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
233 memset(adapter, 0 , sizeof(struct netxen_adapter)); 233 memset(adapter, 0 , sizeof(struct netxen_adapter));
234 234
235 adapter->ahw.pdev = pdev; 235 adapter->ahw.pdev = pdev;
236 adapter->ahw.pci_func = pci_func_id;
237
236 /* remap phys address */ 238 /* remap phys address */
237 mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */ 239 mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */
238 mem_len = pci_resource_len(pdev, 0); 240 mem_len = pci_resource_len(pdev, 0);
@@ -275,7 +277,12 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
275 DPRINTK(INFO, "doorbell ioremaped at %p\n", db_ptr); 277 DPRINTK(INFO, "doorbell ioremaped at %p\n", db_ptr);
276 278
277 adapter->max_tx_desc_count = MAX_CMD_DESCRIPTORS; 279 adapter->max_tx_desc_count = MAX_CMD_DESCRIPTORS;
278 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS; 280 if ((adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB35_4G) ||
281 (adapter->ahw.boardcfg.board_type ==
282 NETXEN_BRDTYPE_P2_SB31_2G))
283 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
284 else
285 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS;
279 adapter->max_jumbo_rx_desc_count = MAX_JUMBO_RCV_DESCRIPTORS; 286 adapter->max_jumbo_rx_desc_count = MAX_JUMBO_RCV_DESCRIPTORS;
280 adapter->max_lro_rx_desc_count = MAX_LRO_RCV_DESCRIPTORS; 287 adapter->max_lro_rx_desc_count = MAX_LRO_RCV_DESCRIPTORS;
281 288
@@ -382,8 +389,13 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
382 spin_lock_init(&adapter->tx_lock); 389 spin_lock_init(&adapter->tx_lock);
383 spin_lock_init(&adapter->lock); 390 spin_lock_init(&adapter->lock);
384 netxen_initialize_adapter_sw(adapter); /* initialize the buffers in adapter */ 391 netxen_initialize_adapter_sw(adapter); /* initialize the buffers in adapter */
392 /* Mezz cards have PCI function 0,2,3 enabled */
393 if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ)
394 if (pci_func_id >= 2)
395 adapter->portnum = pci_func_id - 2;
396
385#ifdef CONFIG_IA64 397#ifdef CONFIG_IA64
386 if(netxen_probe_flag == 0) { 398 if(adapter->portnum == 0) {
387 netxen_pinit_from_rom(adapter, 0); 399 netxen_pinit_from_rom(adapter, 0);
388 udelay(500); 400 udelay(500);
389 netxen_load_firmware(adapter); 401 netxen_load_firmware(adapter);
@@ -399,11 +411,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
399 * Adapter in our case is quad port so initialize it before 411 * Adapter in our case is quad port so initialize it before
400 * initializing the ports 412 * initializing the ports
401 */ 413 */
402 netxen_initialize_adapter_hw(adapter); /* initialize the adapter */
403 414
404 if (adapter->ahw.boardcfg.board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) 415 /* initialize the adapter */
405 if (pci_func_id >= 2) 416 netxen_initialize_adapter_hw(adapter);
406 adapter->portnum = pci_func_id - 2;
407 417
408 netxen_initialize_adapter_ops(adapter); 418 netxen_initialize_adapter_ops(adapter);
409 419
@@ -426,7 +436,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
426 valid_mac = 0; 436 valid_mac = 0;
427 437
428 if (valid_mac) { 438 if (valid_mac) {
429 unsigned char *p = (unsigned char *)&mac_addr[i]; 439 unsigned char *p = (unsigned char *)&mac_addr[adapter->portnum];
430 netdev->dev_addr[0] = *(p + 5); 440 netdev->dev_addr[0] = *(p + 5);
431 netdev->dev_addr[1] = *(p + 4); 441 netdev->dev_addr[1] = *(p + 4);
432 netdev->dev_addr[2] = *(p + 3); 442 netdev->dev_addr[2] = *(p + 3);
@@ -461,7 +471,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
461 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_LO)); 471 writel(0, NETXEN_CRB_NORMALIZE(adapter, CRB_HOST_CMD_ADDR_LO));
462 472
463 /* do this before waking up pegs so that we have valid dummy dma addr */ 473 /* do this before waking up pegs so that we have valid dummy dma addr */
464 err = netxen_initialize_adapter_offload(adapter); 474 if (adapter->portnum == 0)
475 err = netxen_initialize_adapter_offload(adapter);
465 if (err) 476 if (err)
466 goto err_out_free_dev; 477 goto err_out_free_dev;
467 478
@@ -487,6 +498,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
487 */ 498 */
488 udelay(100); 499 udelay(100);
489 INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task); 500 INIT_WORK(&adapter->tx_timeout_task, netxen_tx_timeout_task);
501 netxen_nic_erase_pxe(adapter);
490 netif_carrier_off(netdev); 502 netif_carrier_off(netdev);
491 netif_stop_queue(netdev); 503 netif_stop_queue(netdev);
492 504
@@ -566,8 +578,8 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
566 int i; 578 int i;
567 int ctxid, ring; 579 int ctxid, ring;
568 580
569 netdev = pci_get_drvdata(pdev); 581 adapter = pci_get_drvdata(pdev);
570 adapter = netdev_priv(netdev); 582 netdev = adapter->netdev;
571 if (adapter == NULL) 583 if (adapter == NULL)
572 return; 584 return;
573 585