aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/netxen/netxen_nic_main.c')
-rw-r--r--drivers/net/netxen/netxen_nic_main.c54
1 files changed, 21 insertions, 33 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 1cb662d5bd76..6dbdc8be3949 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -1,25 +1,25 @@
1/* 1/*
2 * Copyright (C) 2003 - 2006 NetXen, Inc. 2 * Copyright (C) 2003 - 2006 NetXen, Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License 6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2 7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version. 8 * of the License, or (at your option) any later version.
9 * 9 *
10 * This program is distributed in the hope that it will be useful, but 10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of 11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
18 * MA 02111-1307, USA. 18 * MA 02111-1307, USA.
19 * 19 *
20 * The full GNU General Public License is included in this distribution 20 * The full GNU General Public License is included in this distribution
21 * in the file called LICENSE. 21 * in the file called LICENSE.
22 * 22 *
23 * Contact Information: 23 * Contact Information:
24 * info@netxen.com 24 * info@netxen.com
25 * NetXen, 25 * NetXen,
@@ -233,16 +233,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
233 233
234 } 234 }
235 235
236 adapter->ops = kzalloc(sizeof(struct netxen_drvops), GFP_KERNEL);
237 if (adapter->ops == NULL) {
238 printk(KERN_ERR
239 "%s: Could not allocate memory for adapter->ops:%d\n",
240 netxen_nic_driver_name,
241 (int)sizeof(struct netxen_adapter));
242 err = -ENOMEM;
243 goto err_out_free_rx_buffer;
244 }
245
246 adapter->cmd_buf_arr = cmd_buf_arr; 236 adapter->cmd_buf_arr = cmd_buf_arr;
247 adapter->ahw.pci_base0 = mem_ptr0; 237 adapter->ahw.pci_base0 = mem_ptr0;
248 adapter->ahw.pci_base1 = mem_ptr1; 238 adapter->ahw.pci_base1 = mem_ptr1;
@@ -373,10 +363,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
373 netdev->dev_addr[4], 363 netdev->dev_addr[4],
374 netdev->dev_addr[5]); 364 netdev->dev_addr[5]);
375 } else { 365 } else {
376 if (adapter->ops->macaddr_set) 366 if (adapter->macaddr_set)
377 adapter->ops->macaddr_set(port, 367 adapter->macaddr_set(port,
378 netdev-> 368 netdev->dev_addr);
379 dev_addr);
380 } 369 }
381 } 370 }
382 INIT_WORK(&adapter->tx_timeout_task, 371 INIT_WORK(&adapter->tx_timeout_task,
@@ -427,7 +416,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
427 free_netdev(port->netdev); 416 free_netdev(port->netdev);
428 } 417 }
429 } 418 }
430 kfree(adapter->ops);
431 419
432 err_out_free_rx_buffer: 420 err_out_free_rx_buffer:
433 for (i = 0; i < MAX_RCV_CTX; ++i) { 421 for (i = 0; i < MAX_RCV_CTX; ++i) {
@@ -525,7 +513,6 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
525 } 513 }
526 514
527 vfree(adapter->cmd_buf_arr); 515 vfree(adapter->cmd_buf_arr);
528 kfree(adapter->ops);
529 kfree(adapter); 516 kfree(adapter);
530} 517}
531 518
@@ -557,15 +544,15 @@ static int netxen_nic_open(struct net_device *netdev)
557 err); 544 err);
558 return err; 545 return err;
559 } 546 }
560 if (adapter->ops->init_port 547 if (adapter->init_port
561 && adapter->ops->init_port(adapter, port->portnum) != 0) { 548 && adapter->init_port(adapter, port->portnum) != 0) {
562 printk(KERN_ERR "%s: Failed to initialize port %d\n", 549 printk(KERN_ERR "%s: Failed to initialize port %d\n",
563 netxen_nic_driver_name, port->portnum); 550 netxen_nic_driver_name, port->portnum);
564 netxen_free_hw_resources(adapter); 551 netxen_free_hw_resources(adapter);
565 return -EIO; 552 return -EIO;
566 } 553 }
567 if (adapter->ops->init_niu) 554 if (adapter->init_niu)
568 adapter->ops->init_niu(adapter); 555 adapter->init_niu(adapter);
569 for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { 556 for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) {
570 for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++) 557 for (ring = 0; ring < NUM_RCV_DESC_RINGS; ring++)
571 netxen_post_rx_buffers(adapter, ctx, ring); 558 netxen_post_rx_buffers(adapter, ctx, ring);
@@ -591,8 +578,8 @@ static int netxen_nic_open(struct net_device *netdev)
591 578
592 /* Done here again so that even if phantom sw overwrote it, 579 /* Done here again so that even if phantom sw overwrote it,
593 * we set it */ 580 * we set it */
594 if (adapter->ops->macaddr_set) 581 if (adapter->macaddr_set)
595 adapter->ops->macaddr_set(port, netdev->dev_addr); 582 adapter->macaddr_set(port, netdev->dev_addr);
596 netxen_nic_set_link_parameters(port); 583 netxen_nic_set_link_parameters(port);
597 584
598 netxen_nic_set_multi(netdev); 585 netxen_nic_set_multi(netdev);
@@ -1039,11 +1026,12 @@ static int netxen_nic_poll(struct net_device *netdev, int *budget)
1039 int done = 1; 1026 int done = 1;
1040 int ctx; 1027 int ctx;
1041 int this_work_done; 1028 int this_work_done;
1029 int work_done = 0;
1042 1030
1043 DPRINTK(INFO, "polling for %d descriptors\n", *budget); 1031 DPRINTK(INFO, "polling for %d descriptors\n", *budget);
1044 port->stats.polled++; 1032 port->stats.polled++;
1045 1033
1046 adapter->work_done = 0; 1034 work_done = 0;
1047 for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) { 1035 for (ctx = 0; ctx < MAX_RCV_CTX; ++ctx) {
1048 /* 1036 /*
1049 * Fairness issue. This will give undue weight to the 1037 * Fairness issue. This will give undue weight to the
@@ -1060,20 +1048,20 @@ static int netxen_nic_poll(struct net_device *netdev, int *budget)
1060 this_work_done = netxen_process_rcv_ring(adapter, ctx, 1048 this_work_done = netxen_process_rcv_ring(adapter, ctx,
1061 work_to_do / 1049 work_to_do /
1062 MAX_RCV_CTX); 1050 MAX_RCV_CTX);
1063 adapter->work_done += this_work_done; 1051 work_done += this_work_done;
1064 } 1052 }
1065 1053
1066 netdev->quota -= adapter->work_done; 1054 netdev->quota -= work_done;
1067 *budget -= adapter->work_done; 1055 *budget -= work_done;
1068 1056
1069 if (adapter->work_done >= work_to_do 1057 if (work_done >= work_to_do
1070 && netxen_nic_rx_has_work(adapter) != 0) 1058 && netxen_nic_rx_has_work(adapter) != 0)
1071 done = 0; 1059 done = 0;
1072 1060
1073 netxen_process_cmd_ring((unsigned long)adapter); 1061 netxen_process_cmd_ring((unsigned long)adapter);
1074 1062
1075 DPRINTK(INFO, "new work_done: %d work_to_do: %d\n", 1063 DPRINTK(INFO, "new work_done: %d work_to_do: %d\n",
1076 adapter->work_done, work_to_do); 1064 work_done, work_to_do);
1077 if (done) { 1065 if (done) {
1078 netif_rx_complete(netdev); 1066 netif_rx_complete(netdev);
1079 netxen_nic_enable_int(adapter); 1067 netxen_nic_enable_int(adapter);