aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/netxen/netxen_nic.h56
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c53
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h6
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c54
-rw-r--r--drivers/net/netxen/netxen_nic_hw.h10
-rw-r--r--drivers/net/netxen/netxen_nic_init.c61
-rw-r--r--drivers/net/netxen/netxen_nic_ioctl.h6
-rw-r--r--drivers/net/netxen/netxen_nic_isr.c48
-rw-r--r--drivers/net/netxen/netxen_nic_main.c54
-rw-r--r--drivers/net/netxen/netxen_nic_niu.c10
10 files changed, 165 insertions, 193 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index d925053fe597..d51f43709cb5 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -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,
@@ -89,8 +89,8 @@
89 * normalize a 64MB crb address to 32MB PCI window 89 * normalize a 64MB crb address to 32MB PCI window
90 * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1 90 * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1
91 */ 91 */
92#define NETXEN_CRB_NORMAL(reg) \ 92#define NETXEN_CRB_NORMAL(reg) \
93 (reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST 93 ((reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST)
94 94
95#define NETXEN_CRB_NORMALIZE(adapter, reg) \ 95#define NETXEN_CRB_NORMALIZE(adapter, reg) \
96 pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg)) 96 pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg))
@@ -164,7 +164,7 @@ enum {
164 164
165#define MAX_CMD_DESCRIPTORS 1024 165#define MAX_CMD_DESCRIPTORS 1024
166#define MAX_RCV_DESCRIPTORS 32768 166#define MAX_RCV_DESCRIPTORS 32768
167#define MAX_JUMBO_RCV_DESCRIPTORS 1024 167#define MAX_JUMBO_RCV_DESCRIPTORS 4096
168#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS 168#define MAX_RCVSTATUS_DESCRIPTORS MAX_RCV_DESCRIPTORS
169#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS 169#define MAX_JUMBO_RCV_DESC MAX_JUMBO_RCV_DESCRIPTORS
170#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS 170#define MAX_RCV_DESC MAX_RCV_DESCRIPTORS
@@ -559,7 +559,7 @@ typedef enum {
559#define PRIMARY_START (BOOTLD_START) 559#define PRIMARY_START (BOOTLD_START)
560#define FLASH_CRBINIT_SIZE (0x4000) 560#define FLASH_CRBINIT_SIZE (0x4000)
561#define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info)) 561#define FLASH_BRDCFG_SIZE (sizeof(struct netxen_board_info))
562#define FLASH_USER_SIZE (sizeof(netxen_user_info)/sizeof(u32)) 562#define FLASH_USER_SIZE (sizeof(struct netxen_user_info)/sizeof(u32))
563#define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START) 563#define FLASH_SECONDARY_SIZE (USER_START-SECONDARY_START)
564#define NUM_PRIMARY_SECTORS (0x20) 564#define NUM_PRIMARY_SECTORS (0x20)
565#define NUM_CONFIG_SECTORS (1) 565#define NUM_CONFIG_SECTORS (1)
@@ -572,7 +572,7 @@ typedef enum {
572#else 572#else
573#define DPRINTK(klevel, fmt, args...) do { \ 573#define DPRINTK(klevel, fmt, args...) do { \
574 printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\ 574 printk(KERN_##klevel PFX "%s: %s: " fmt, __FUNCTION__,\
575 (adapter != NULL && adapter->port != NULL && \ 575 (adapter != NULL && \
576 adapter->port[0] != NULL && \ 576 adapter->port[0] != NULL && \
577 adapter->port[0]->netdev != NULL) ? \ 577 adapter->port[0]->netdev != NULL) ? \
578 adapter->port[0]->netdev->name : NULL, \ 578 adapter->port[0]->netdev->name : NULL, \
@@ -703,8 +703,6 @@ struct netxen_recv_context {
703 703
704#define NETXEN_NIC_MSI_ENABLED 0x02 704#define NETXEN_NIC_MSI_ENABLED 0x02
705 705
706struct netxen_drvops;
707
708struct netxen_adapter { 706struct netxen_adapter {
709 struct netxen_hardware_context ahw; 707 struct netxen_hardware_context ahw;
710 int port_count; /* Number of configured ports */ 708 int port_count; /* Number of configured ports */
@@ -746,8 +744,21 @@ struct netxen_adapter {
746 struct netxen_recv_context recv_ctx[MAX_RCV_CTX]; 744 struct netxen_recv_context recv_ctx[MAX_RCV_CTX];
747 745
748 int is_up; 746 int is_up;
749 int work_done; 747 int (*enable_phy_interrupts) (struct netxen_adapter *, int);
750 struct netxen_drvops *ops; 748 int (*disable_phy_interrupts) (struct netxen_adapter *, int);
749 void (*handle_phy_intr) (struct netxen_adapter *);
750 int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t);
751 int (*set_mtu) (struct netxen_port *, int);
752 int (*set_promisc) (struct netxen_adapter *, int,
753 netxen_niu_prom_mode_t);
754 int (*unset_promisc) (struct netxen_adapter *, int,
755 netxen_niu_prom_mode_t);
756 int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
757 int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
758 int (*init_port) (struct netxen_adapter *, int);
759 void (*init_niu) (struct netxen_adapter *);
760 int (*stop_port) (struct netxen_adapter *, int);
761
751}; /* netxen_adapter structure */ 762}; /* netxen_adapter structure */
752 763
753/* Max number of xmit producer threads that can run simultaneously */ 764/* Max number of xmit producer threads that can run simultaneously */
@@ -829,23 +840,6 @@ static inline void __iomem *pci_base(struct netxen_adapter *adapter,
829 return NULL; 840 return NULL;
830} 841}
831 842
832struct netxen_drvops {
833 int (*enable_phy_interrupts) (struct netxen_adapter *, int);
834 int (*disable_phy_interrupts) (struct netxen_adapter *, int);
835 void (*handle_phy_intr) (struct netxen_adapter *);
836 int (*macaddr_set) (struct netxen_port *, netxen_ethernet_macaddr_t);
837 int (*set_mtu) (struct netxen_port *, int);
838 int (*set_promisc) (struct netxen_adapter *, int,
839 netxen_niu_prom_mode_t);
840 int (*unset_promisc) (struct netxen_adapter *, int,
841 netxen_niu_prom_mode_t);
842 int (*phy_read) (struct netxen_adapter *, long phy, long reg, u32 *);
843 int (*phy_write) (struct netxen_adapter *, long phy, long reg, u32 val);
844 int (*init_port) (struct netxen_adapter *, int);
845 void (*init_niu) (struct netxen_adapter *);
846 int (*stop_port) (struct netxen_adapter *, int);
847};
848
849extern char netxen_nic_driver_name[]; 843extern char netxen_nic_driver_name[];
850 844
851int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter, 845int netxen_niu_xgbe_enable_phy_interrupts(struct netxen_adapter *adapter,
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index 9a914aeba5bc..c7fcbf345db9 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.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,
@@ -118,7 +118,7 @@ netxen_nic_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *drvinfo)
118 u32 fw_minor = 0; 118 u32 fw_minor = 0;
119 u32 fw_build = 0; 119 u32 fw_build = 0;
120 120
121 strncpy(drvinfo->driver, "netxen_nic", 32); 121 strncpy(drvinfo->driver, netxen_nic_driver_name, 32);
122 strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32); 122 strncpy(drvinfo->version, NETXEN_NIC_LINUX_VERSIONID, 32);
123 fw_major = readl(NETXEN_CRB_NORMALIZE(adapter, 123 fw_major = readl(NETXEN_CRB_NORMALIZE(adapter,
124 NETXEN_FW_VERSION_MAJOR)); 124 NETXEN_FW_VERSION_MAJOR));
@@ -210,7 +210,6 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
210 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", 210 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
211 (netxen_brdtype_t) boardinfo->board_type); 211 (netxen_brdtype_t) boardinfo->board_type);
212 return -EIO; 212 return -EIO;
213
214 } 213 }
215 214
216 return 0; 215 return 0;
@@ -226,18 +225,18 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
226 /* read which mode */ 225 /* read which mode */
227 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 226 if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
228 /* autonegotiation */ 227 /* autonegotiation */
229 if (adapter->ops->phy_write 228 if (adapter->phy_write
230 && adapter->ops->phy_write(adapter, port->portnum, 229 && adapter->phy_write(adapter, port->portnum,
231 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, 230 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
232 (__le32) ecmd->autoneg) != 0) 231 (__le32) ecmd->autoneg) != 0)
233 return -EIO; 232 return -EIO;
234 else 233 else
235 port->link_autoneg = ecmd->autoneg; 234 port->link_autoneg = ecmd->autoneg;
236 235
237 if (adapter->ops->phy_read 236 if (adapter->phy_read
238 && adapter->ops->phy_read(adapter, port->portnum, 237 && adapter->phy_read(adapter, port->portnum,
239 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 238 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
240 &status) != 0) 239 &status) != 0)
241 return -EIO; 240 return -EIO;
242 241
243 /* speed */ 242 /* speed */
@@ -257,10 +256,10 @@ netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
257 netxen_clear_phy_duplex(status); 256 netxen_clear_phy_duplex(status);
258 if (ecmd->duplex == DUPLEX_FULL) 257 if (ecmd->duplex == DUPLEX_FULL)
259 netxen_set_phy_duplex(status); 258 netxen_set_phy_duplex(status);
260 if (adapter->ops->phy_write 259 if (adapter->phy_write
261 && adapter->ops->phy_write(adapter, port->portnum, 260 && adapter->phy_write(adapter, port->portnum,
262 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 261 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
263 *((int *)&status)) != 0) 262 *((int *)&status)) != 0)
264 return -EIO; 263 return -EIO;
265 else { 264 else {
266 port->link_speed = ecmd->speed; 265 port->link_speed = ecmd->speed;
@@ -422,10 +421,10 @@ static u32 netxen_nic_get_link(struct net_device *dev)
422 421
423 /* read which mode */ 422 /* read which mode */
424 if (adapter->ahw.board_type == NETXEN_NIC_GBE) { 423 if (adapter->ahw.board_type == NETXEN_NIC_GBE) {
425 if (adapter->ops->phy_read 424 if (adapter->phy_read
426 && adapter->ops->phy_read(adapter, port->portnum, 425 && adapter->phy_read(adapter, port->portnum,
427 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 426 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
428 &status) != 0) 427 &status) != 0)
429 return -EIO; 428 return -EIO;
430 else 429 else
431 return (netxen_get_phy_link(status)); 430 return (netxen_get_phy_link(status));
@@ -526,10 +525,10 @@ netxen_nic_set_pauseparam(struct net_device *dev,
526 *(u32 *) (&val)); 525 *(u32 *) (&val));
527 /* set autoneg */ 526 /* set autoneg */
528 autoneg = pause->autoneg; 527 autoneg = pause->autoneg;
529 if (adapter->ops->phy_write 528 if (adapter->phy_write
530 && adapter->ops->phy_write(adapter, port->portnum, 529 && adapter->phy_write(adapter, port->portnum,
531 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, 530 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
532 (__le32) autoneg) != 0) 531 (__le32) autoneg) != 0)
533 return -EIO; 532 return -EIO;
534 else { 533 else {
535 port->link_autoneg = pause->autoneg; 534 port->link_autoneg = pause->autoneg;
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index 72c6ec4ee2a0..fe8b675f9e72 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -1,7 +1,7 @@
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
@@ -16,10 +16,10 @@
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,
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 105c24f0ad4c..7470852ab582 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -1,7 +1,7 @@
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
@@ -16,10 +16,10 @@
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,
@@ -81,8 +81,8 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p)
81 DPRINTK(INFO, "valid ether addr\n"); 81 DPRINTK(INFO, "valid ether addr\n");
82 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); 82 memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
83 83
84 if (adapter->ops->macaddr_set) 84 if (adapter->macaddr_set)
85 adapter->ops->macaddr_set(port, addr->sa_data); 85 adapter->macaddr_set(port, addr->sa_data);
86 86
87 return 0; 87 return 0;
88} 88}
@@ -99,17 +99,17 @@ void netxen_nic_set_multi(struct net_device *netdev)
99 99
100 mc_ptr = netdev->mc_list; 100 mc_ptr = netdev->mc_list;
101 if (netdev->flags & IFF_PROMISC) { 101 if (netdev->flags & IFF_PROMISC) {
102 if (adapter->ops->set_promisc) 102 if (adapter->set_promisc)
103 adapter->ops->set_promisc(adapter, 103 adapter->set_promisc(adapter,
104 port->portnum, 104 port->portnum,
105 NETXEN_NIU_PROMISC_MODE); 105 NETXEN_NIU_PROMISC_MODE);
106 } else { 106 } else {
107 if (adapter->ops->unset_promisc && 107 if (adapter->unset_promisc &&
108 adapter->ahw.boardcfg.board_type 108 adapter->ahw.boardcfg.board_type
109 != NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) 109 != NETXEN_BRDTYPE_P2_SB31_10G_IMEZ)
110 adapter->ops->unset_promisc(adapter, 110 adapter->unset_promisc(adapter,
111 port->portnum, 111 port->portnum,
112 NETXEN_NIU_NON_PROMISC_MODE); 112 NETXEN_NIU_NON_PROMISC_MODE);
113 } 113 }
114 if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 114 if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
115 netxen_nic_mcr_set_mode_select(netxen_mac_addr_cntl_data, 0x03); 115 netxen_nic_mcr_set_mode_select(netxen_mac_addr_cntl_data, 0x03);
@@ -160,8 +160,8 @@ int netxen_nic_change_mtu(struct net_device *netdev, int mtu)
160 return -EINVAL; 160 return -EINVAL;
161 } 161 }
162 162
163 if (adapter->ops->set_mtu) 163 if (adapter->set_mtu)
164 adapter->ops->set_mtu(port, mtu); 164 adapter->set_mtu(port, mtu);
165 netdev->mtu = mtu; 165 netdev->mtu = mtu;
166 166
167 return 0; 167 return 0;
@@ -184,14 +184,12 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
184 struct netxen_recv_context *recv_ctx; 184 struct netxen_recv_context *recv_ctx;
185 struct netxen_rcv_desc_ctx *rcv_desc; 185 struct netxen_rcv_desc_ctx *rcv_desc;
186 186
187 DPRINTK(INFO, "crb_base: %lx %lx", NETXEN_PCI_CRBSPACE, 187 DPRINTK(INFO, "crb_base: %lx %x", NETXEN_PCI_CRBSPACE,
188 PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE)); 188 PCI_OFFSET_SECOND_RANGE(adapter, NETXEN_PCI_CRBSPACE));
189 DPRINTK(INFO, "cam base: %lx %lx", NETXEN_CRB_CAM, 189 DPRINTK(INFO, "cam base: %lx %x", NETXEN_CRB_CAM,
190 pci_base_offset(adapter, NETXEN_CRB_CAM)); 190 pci_base_offset(adapter, NETXEN_CRB_CAM));
191 DPRINTK(INFO, "cam RAM: %lx %lx", NETXEN_CAM_RAM_BASE, 191 DPRINTK(INFO, "cam RAM: %lx %x", NETXEN_CAM_RAM_BASE,
192 pci_base_offset(adapter, NETXEN_CAM_RAM_BASE)); 192 pci_base_offset(adapter, NETXEN_CAM_RAM_BASE));
193 DPRINTK(INFO, "NIC base:%lx %lx\n", NIC_CRB_BASE_PORT1,
194 pci_base_offset(adapter, NIC_CRB_BASE_PORT1));
195 193
196 /* Window 1 call */ 194 /* Window 1 call */
197 card_cmdring = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_CMDRING)); 195 card_cmdring = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_CMDPEG_CMDRING));
@@ -648,7 +646,7 @@ void netxen_nic_reg_write(struct netxen_adapter *adapter, u64 off, u32 val)
648 646
649 addr = NETXEN_CRB_NORMALIZE(adapter, off); 647 addr = NETXEN_CRB_NORMALIZE(adapter, off);
650 DPRINTK(INFO, "writing to base %lx offset %llx addr %p data %x\n", 648 DPRINTK(INFO, "writing to base %lx offset %llx addr %p data %x\n",
651 pci_base(adapter, off), off, addr); 649 pci_base(adapter, off), off, addr, val);
652 writel(val, addr); 650 writel(val, addr);
653 651
654} 652}
@@ -660,7 +658,7 @@ int netxen_nic_reg_read(struct netxen_adapter *adapter, u64 off)
660 658
661 addr = NETXEN_CRB_NORMALIZE(adapter, off); 659 addr = NETXEN_CRB_NORMALIZE(adapter, off);
662 DPRINTK(INFO, "reading from base %lx offset %llx addr %p\n", 660 DPRINTK(INFO, "reading from base %lx offset %llx addr %p\n",
663 adapter->ahw.pci_base, off, addr); 661 pci_base(adapter, off), off, addr);
664 val = readl(addr); 662 val = readl(addr);
665 writel(val, addr); 663 writel(val, addr);
666 664
@@ -848,8 +846,8 @@ void netxen_nic_stop_all_ports(struct netxen_adapter *adapter)
848 846
849 for (port_nr = 0; port_nr < adapter->ahw.max_ports; port_nr++) { 847 for (port_nr = 0; port_nr < adapter->ahw.max_ports; port_nr++) {
850 port = adapter->port[port_nr]; 848 port = adapter->port[port_nr];
851 if (adapter->ops->stop_port) 849 if (adapter->stop_port)
852 adapter->ops->stop_port(adapter, port->portnum); 850 adapter->stop_port(adapter, port->portnum);
853 } 851 }
854} 852}
855 853
@@ -878,8 +876,8 @@ void netxen_nic_set_link_parameters(struct netxen_port *port)
878 876
879 netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); 877 netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode);
880 if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ 878 if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */
881 if (adapter->ops->phy_read 879 if (adapter->phy_read
882 && adapter->ops-> 880 && adapter->
883 phy_read(adapter, port->portnum, 881 phy_read(adapter, port->portnum,
884 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 882 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
885 &status) == 0) { 883 &status) == 0) {
@@ -909,8 +907,8 @@ void netxen_nic_set_link_parameters(struct netxen_port *port)
909 port->link_duplex = -1; 907 port->link_duplex = -1;
910 break; 908 break;
911 } 909 }
912 if (adapter->ops->phy_read 910 if (adapter->phy_read
913 && adapter->ops-> 911 && adapter->
914 phy_read(adapter, port->portnum, 912 phy_read(adapter, port->portnum,
915 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, 913 NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG,
916 (__le32 *) & autoneg) != 0) 914 (__le32 *) & autoneg) != 0)
diff --git a/drivers/net/netxen/netxen_nic_hw.h b/drivers/net/netxen/netxen_nic_hw.h
index 201a636b7ab8..0685633a9c1e 100644
--- a/drivers/net/netxen/netxen_nic_hw.h
+++ b/drivers/net/netxen/netxen_nic_hw.h
@@ -1,7 +1,7 @@
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
@@ -16,10 +16,10 @@
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,
@@ -83,8 +83,8 @@ struct netxen_adapter;
83#define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20) 83#define NETXEN_PCI_MAPSIZE_BYTES (NETXEN_PCI_MAPSIZE << 20)
84 84
85#define NETXEN_NIC_LOCKED_READ_REG(X, Y) \ 85#define NETXEN_NIC_LOCKED_READ_REG(X, Y) \
86 addr = pci_base_offset(adapter, (X)); \ 86 addr = pci_base_offset(adapter, X); \
87 *(u32 *)Y = readl(addr); 87 *(u32 *)Y = readl((void __iomem*) addr);
88 88
89struct netxen_port; 89struct netxen_port;
90void netxen_nic_set_link_parameters(struct netxen_port *port); 90void netxen_nic_set_link_parameters(struct netxen_port *port);
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 0dca029bc3e5..deac1a3ae275 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.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,
@@ -212,37 +212,36 @@ void netxen_initialize_adapter_hw(struct netxen_adapter *adapter)
212 212
213void netxen_initialize_adapter_ops(struct netxen_adapter *adapter) 213void netxen_initialize_adapter_ops(struct netxen_adapter *adapter)
214{ 214{
215 struct netxen_drvops *ops = adapter->ops;
216 switch (adapter->ahw.board_type) { 215 switch (adapter->ahw.board_type) {
217 case NETXEN_NIC_GBE: 216 case NETXEN_NIC_GBE:
218 ops->enable_phy_interrupts = 217 adapter->enable_phy_interrupts =
219 netxen_niu_gbe_enable_phy_interrupts; 218 netxen_niu_gbe_enable_phy_interrupts;
220 ops->disable_phy_interrupts = 219 adapter->disable_phy_interrupts =
221 netxen_niu_gbe_disable_phy_interrupts; 220 netxen_niu_gbe_disable_phy_interrupts;
222 ops->handle_phy_intr = netxen_nic_gbe_handle_phy_intr; 221 adapter->handle_phy_intr = netxen_nic_gbe_handle_phy_intr;
223 ops->macaddr_set = netxen_niu_macaddr_set; 222 adapter->macaddr_set = netxen_niu_macaddr_set;
224 ops->set_mtu = netxen_nic_set_mtu_gb; 223 adapter->set_mtu = netxen_nic_set_mtu_gb;
225 ops->set_promisc = netxen_niu_set_promiscuous_mode; 224 adapter->set_promisc = netxen_niu_set_promiscuous_mode;
226 ops->unset_promisc = netxen_niu_set_promiscuous_mode; 225 adapter->unset_promisc = netxen_niu_set_promiscuous_mode;
227 ops->phy_read = netxen_niu_gbe_phy_read; 226 adapter->phy_read = netxen_niu_gbe_phy_read;
228 ops->phy_write = netxen_niu_gbe_phy_write; 227 adapter->phy_write = netxen_niu_gbe_phy_write;
229 ops->init_port = netxen_niu_gbe_init_port; 228 adapter->init_port = netxen_niu_gbe_init_port;
230 ops->init_niu = netxen_nic_init_niu_gb; 229 adapter->init_niu = netxen_nic_init_niu_gb;
231 ops->stop_port = netxen_niu_disable_gbe_port; 230 adapter->stop_port = netxen_niu_disable_gbe_port;
232 break; 231 break;
233 232
234 case NETXEN_NIC_XGBE: 233 case NETXEN_NIC_XGBE:
235 ops->enable_phy_interrupts = 234 adapter->enable_phy_interrupts =
236 netxen_niu_xgbe_enable_phy_interrupts; 235 netxen_niu_xgbe_enable_phy_interrupts;
237 ops->disable_phy_interrupts = 236 adapter->disable_phy_interrupts =
238 netxen_niu_xgbe_disable_phy_interrupts; 237 netxen_niu_xgbe_disable_phy_interrupts;
239 ops->handle_phy_intr = netxen_nic_xgbe_handle_phy_intr; 238 adapter->handle_phy_intr = netxen_nic_xgbe_handle_phy_intr;
240 ops->macaddr_set = netxen_niu_xg_macaddr_set; 239 adapter->macaddr_set = netxen_niu_xg_macaddr_set;
241 ops->set_mtu = netxen_nic_set_mtu_xgb; 240 adapter->set_mtu = netxen_nic_set_mtu_xgb;
242 ops->init_port = netxen_niu_xg_init_port; 241 adapter->init_port = netxen_niu_xg_init_port;
243 ops->set_promisc = netxen_niu_xg_set_promiscuous_mode; 242 adapter->set_promisc = netxen_niu_xg_set_promiscuous_mode;
244 ops->unset_promisc = netxen_niu_xg_set_promiscuous_mode; 243 adapter->unset_promisc = netxen_niu_xg_set_promiscuous_mode;
245 ops->stop_port = netxen_niu_disable_xg_port; 244 adapter->stop_port = netxen_niu_disable_xg_port;
246 break; 245 break;
247 246
248 default: 247 default:
@@ -383,8 +382,8 @@ int netxen_rom_wip_poll(struct netxen_adapter *adapter)
383 return 0; 382 return 0;
384} 383}
385 384
386static inline int do_rom_fast_write(struct netxen_adapter *adapter, 385static inline int do_rom_fast_write(struct netxen_adapter *adapter, int addr,
387 int addr, int data) 386 int data)
388{ 387{
389 if (netxen_rom_wren(adapter)) { 388 if (netxen_rom_wren(adapter)) {
390 return -1; 389 return -1;
@@ -734,8 +733,8 @@ void netxen_watchdog_task(unsigned long v)
734 netif_wake_queue(netdev); 733 netif_wake_queue(netdev);
735 } 734 }
736 735
737 if (adapter->ops->handle_phy_intr) 736 if (adapter->handle_phy_intr)
738 adapter->ops->handle_phy_intr(adapter); 737 adapter->handle_phy_intr(adapter);
739 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ); 738 mod_timer(&adapter->watchdog_timer, jiffies + 2 * HZ);
740} 739}
741 740
diff --git a/drivers/net/netxen/netxen_nic_ioctl.h b/drivers/net/netxen/netxen_nic_ioctl.h
index 23e53adbf123..8eef139f250b 100644
--- a/drivers/net/netxen/netxen_nic_ioctl.h
+++ b/drivers/net/netxen/netxen_nic_ioctl.h
@@ -1,7 +1,7 @@
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
@@ -16,10 +16,10 @@
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,
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c
index ae180fee8008..0f6e7b8b65db 100644
--- a/drivers/net/netxen/netxen_nic_isr.c
+++ b/drivers/net/netxen/netxen_nic_isr.c
@@ -1,7 +1,7 @@
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
@@ -16,10 +16,10 @@
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,
@@ -84,46 +84,41 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
84 struct netxen_port *port; 84 struct netxen_port *port;
85 85
86 /* This should clear the interrupt source */ 86 /* This should clear the interrupt source */
87 if (adapter->ops->phy_read) 87 if (adapter->phy_read)
88 adapter->ops->phy_read(adapter, portno, 88 adapter->phy_read(adapter, portno,
89 NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, 89 NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS,
90 &int_src); 90 &int_src);
91 if (int_src == 0) { 91 if (int_src == 0) {
92 DPRINTK(INFO, "No phy interrupts for port #%d\n", portno); 92 DPRINTK(INFO, "No phy interrupts for port #%d\n", portno);
93 return; 93 return;
94 } 94 }
95 if (adapter->ops->disable_phy_interrupts) 95 if (adapter->disable_phy_interrupts)
96 adapter->ops->disable_phy_interrupts(adapter, portno); 96 adapter->disable_phy_interrupts(adapter, portno);
97 97
98 port = adapter->port[portno]; 98 port = adapter->port[portno];
99 99
100 if (netxen_get_phy_int_jabber(int_src)) 100 if (netxen_get_phy_int_jabber(int_src))
101 DPRINTK(INFO, "NetXen: %s Jabber interrupt \n", 101 DPRINTK(INFO, "Jabber interrupt \n");
102 port->netdev->name);
103 102
104 if (netxen_get_phy_int_polarity_changed(int_src)) 103 if (netxen_get_phy_int_polarity_changed(int_src))
105 DPRINTK(INFO, "NetXen: %s POLARITY CHANGED int \n", 104 DPRINTK(INFO, "POLARITY CHANGED int \n");
106 port->netdev->name);
107 105
108 if (netxen_get_phy_int_energy_detect(int_src)) 106 if (netxen_get_phy_int_energy_detect(int_src))
109 DPRINTK(INFO, "NetXen: %s ENERGY DETECT INT \n", 107 DPRINTK(INFO, "ENERGY DETECT INT \n");
110 port->netdev->name);
111 108
112 if (netxen_get_phy_int_downshift(int_src)) 109 if (netxen_get_phy_int_downshift(int_src))
113 DPRINTK(INFO, "NetXen: %s DOWNSHIFT INT \n", 110 DPRINTK(INFO, "DOWNSHIFT INT \n");
114 port->netdev->name);
115 /* write it down later.. */ 111 /* write it down later.. */
116 if ((netxen_get_phy_int_speed_changed(int_src)) 112 if ((netxen_get_phy_int_speed_changed(int_src))
117 || (netxen_get_phy_int_link_status_changed(int_src))) { 113 || (netxen_get_phy_int_link_status_changed(int_src))) {
118 __le32 status; 114 __le32 status;
119 115
120 DPRINTK(INFO, "NetXen: %s SPEED CHANGED OR" 116 DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n");
121 " LINK STATUS CHANGED \n", port->netdev->name);
122 117
123 if (adapter->ops->phy_read 118 if (adapter->phy_read
124 && adapter->ops->phy_read(adapter, portno, 119 && adapter->phy_read(adapter, portno,
125 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, 120 NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS,
126 &status) == 0) { 121 &status) == 0) {
127 if (netxen_get_phy_int_link_status_changed(int_src)) { 122 if (netxen_get_phy_int_link_status_changed(int_src)) {
128 if (netxen_get_phy_link(status)) { 123 if (netxen_get_phy_link(status)) {
129 netxen_niu_gbe_init_port(adapter, 124 netxen_niu_gbe_init_port(adapter,
@@ -143,8 +138,8 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno,
143 } 138 }
144 } 139 }
145 } 140 }
146 if (adapter->ops->enable_phy_interrupts) 141 if (adapter->enable_phy_interrupts)
147 adapter->ops->enable_phy_interrupts(adapter, portno); 142 adapter->enable_phy_interrupts(adapter, portno);
148} 143}
149 144
150void netxen_nic_isr_other(struct netxen_adapter *adapter) 145void netxen_nic_isr_other(struct netxen_adapter *adapter)
@@ -159,8 +154,7 @@ void netxen_nic_isr_other(struct netxen_adapter *adapter)
159 154
160 qg_linksup = adapter->ahw.qg_linksup; 155 qg_linksup = adapter->ahw.qg_linksup;
161 adapter->ahw.qg_linksup = val; 156 adapter->ahw.qg_linksup = val;
162 DPRINTK(1, INFO, "%s: link update 0x%08x\n", netxen_nic_driver_name, 157 DPRINTK(INFO, "link update 0x%08x\n", val);
163 val);
164 for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) { 158 for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) {
165 linkup = val & 1; 159 linkup = val & 1;
166 if (linkup != (qg_linksup & 1)) { 160 if (linkup != (qg_linksup & 1)) {
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);
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c
index 7950a04532e6..ff74f1e413d4 100644
--- a/drivers/net/netxen/netxen_nic_niu.c
+++ b/drivers/net/netxen/netxen_nic_niu.c
@@ -1,7 +1,7 @@
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
@@ -16,10 +16,10 @@
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,
@@ -399,8 +399,8 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port)
399{ 399{
400 int result = 0; 400 int result = 0;
401 __le32 status; 401 __le32 status;
402 if (adapter->ops->disable_phy_interrupts) 402 if (adapter->disable_phy_interrupts)
403 adapter->ops->disable_phy_interrupts(adapter, port); 403 adapter->disable_phy_interrupts(adapter, port);
404 mdelay(2); 404 mdelay(2);
405 405
406 if (0 == 406 if (0 ==