diff options
Diffstat (limited to 'drivers/net/netxen/netxen_nic_isr.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_isr.c | 87 |
1 files changed, 40 insertions, 47 deletions
diff --git a/drivers/net/netxen/netxen_nic_isr.c b/drivers/net/netxen/netxen_nic_isr.c index be366e48007c..f60c96991913 100644 --- a/drivers/net/netxen/netxen_nic_isr.c +++ b/drivers/net/netxen/netxen_nic_isr.c | |||
@@ -6,12 +6,12 @@ | |||
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, |
@@ -34,6 +34,7 @@ | |||
34 | #include "netxen_nic_hw.h" | 34 | #include "netxen_nic_hw.h" |
35 | #include "netxen_nic_phan_reg.h" | 35 | #include "netxen_nic_phan_reg.h" |
36 | 36 | ||
37 | #if 0 | ||
37 | /* | 38 | /* |
38 | * netxen_nic_get_stats - Get System Network Statistics | 39 | * netxen_nic_get_stats - Get System Network Statistics |
39 | * @netdev: network interface device structure | 40 | * @netdev: network interface device structure |
@@ -41,7 +42,7 @@ | |||
41 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | 42 | struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) |
42 | { | 43 | { |
43 | struct netxen_port *port = netdev_priv(netdev); | 44 | struct netxen_port *port = netdev_priv(netdev); |
44 | struct net_device_stats *stats = &port->net_stats; | 45 | struct net_device_stats *stats = &adapter->net_stats; |
45 | 46 | ||
46 | memset(stats, 0, sizeof(*stats)); | 47 | memset(stats, 0, sizeof(*stats)); |
47 | 48 | ||
@@ -64,11 +65,10 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | |||
64 | 65 | ||
65 | return stats; | 66 | return stats; |
66 | } | 67 | } |
67 | 68 | #endif | |
68 | void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno, | 69 | void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 link) |
69 | u32 link) | ||
70 | { | 70 | { |
71 | struct net_device *netdev = (adapter->port[portno])->netdev; | 71 | struct net_device *netdev = adapter->netdev; |
72 | 72 | ||
73 | if (link) | 73 | if (link) |
74 | netif_carrier_on(netdev); | 74 | netif_carrier_on(netdev); |
@@ -76,15 +76,13 @@ void netxen_indicate_link_status(struct netxen_adapter *adapter, u32 portno, | |||
76 | netif_carrier_off(netdev); | 76 | netif_carrier_off(netdev); |
77 | } | 77 | } |
78 | 78 | ||
79 | void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno, | 79 | void netxen_handle_port_int(struct netxen_adapter *adapter, u32 enable) |
80 | u32 enable) | ||
81 | { | 80 | { |
82 | __u32 int_src; | 81 | __u32 int_src; |
83 | struct netxen_port *port; | ||
84 | 82 | ||
85 | /* This should clear the interrupt source */ | 83 | /* This should clear the interrupt source */ |
86 | if (adapter->phy_read) | 84 | if (adapter->phy_read) |
87 | adapter->phy_read(adapter, portno, | 85 | adapter->phy_read(adapter, adapter->portnum, |
88 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, | 86 | NETXEN_NIU_GB_MII_MGMT_ADDR_INT_STATUS, |
89 | &int_src); | 87 | &int_src); |
90 | if (int_src == 0) { | 88 | if (int_src == 0) { |
@@ -92,9 +90,7 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno, | |||
92 | return; | 90 | return; |
93 | } | 91 | } |
94 | if (adapter->disable_phy_interrupts) | 92 | if (adapter->disable_phy_interrupts) |
95 | adapter->disable_phy_interrupts(adapter, portno); | 93 | adapter->disable_phy_interrupts(adapter, adapter->portnum); |
96 | |||
97 | port = adapter->port[portno]; | ||
98 | 94 | ||
99 | if (netxen_get_phy_int_jabber(int_src)) | 95 | if (netxen_get_phy_int_jabber(int_src)) |
100 | DPRINTK(INFO, "Jabber interrupt \n"); | 96 | DPRINTK(INFO, "Jabber interrupt \n"); |
@@ -115,64 +111,60 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 portno, | |||
115 | DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n"); | 111 | DPRINTK(INFO, "SPEED CHANGED OR LINK STATUS CHANGED \n"); |
116 | 112 | ||
117 | if (adapter->phy_read | 113 | if (adapter->phy_read |
118 | && adapter->phy_read(adapter, portno, | 114 | && adapter->phy_read(adapter, adapter->portnum, |
119 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 115 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
120 | &status) == 0) { | 116 | &status) == 0) { |
121 | if (netxen_get_phy_int_link_status_changed(int_src)) { | 117 | if (netxen_get_phy_int_link_status_changed(int_src)) { |
122 | if (netxen_get_phy_link(status)) { | 118 | if (netxen_get_phy_link(status)) { |
123 | netxen_niu_gbe_init_port(adapter, | 119 | netxen_niu_gbe_init_port( |
124 | portno); | 120 | adapter, |
125 | printk("%s: %s Link UP\n", | 121 | adapter->portnum); |
122 | printk(KERN_INFO "%s: %s Link UP\n", | ||
126 | netxen_nic_driver_name, | 123 | netxen_nic_driver_name, |
127 | port->netdev->name); | 124 | adapter->netdev->name); |
128 | 125 | ||
129 | } else { | 126 | } else { |
130 | printk("%s: %s Link DOWN\n", | 127 | printk(KERN_INFO "%s: %s Link DOWN\n", |
131 | netxen_nic_driver_name, | 128 | netxen_nic_driver_name, |
132 | port->netdev->name); | 129 | adapter->netdev->name); |
133 | } | 130 | } |
134 | netxen_indicate_link_status(adapter, portno, | 131 | netxen_indicate_link_status(adapter, |
135 | netxen_get_phy_link | 132 | netxen_get_phy_link |
136 | (status)); | 133 | (status)); |
137 | } | 134 | } |
138 | } | 135 | } |
139 | } | 136 | } |
140 | if (adapter->enable_phy_interrupts) | 137 | if (adapter->enable_phy_interrupts) |
141 | adapter->enable_phy_interrupts(adapter, portno); | 138 | adapter->enable_phy_interrupts(adapter, adapter->portnum); |
142 | } | 139 | } |
143 | 140 | ||
144 | void netxen_nic_isr_other(struct netxen_adapter *adapter) | 141 | void netxen_nic_isr_other(struct netxen_adapter *adapter) |
145 | { | 142 | { |
146 | u32 portno; | 143 | int portno = adapter->portnum; |
147 | u32 val, linkup, qg_linksup; | 144 | u32 val, linkup, qg_linksup; |
148 | 145 | ||
149 | /* verify the offset */ | 146 | /* verify the offset */ |
150 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); | 147 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); |
148 | val = val >> adapter->portnum; | ||
151 | if (val == adapter->ahw.qg_linksup) | 149 | if (val == adapter->ahw.qg_linksup) |
152 | return; | 150 | return; |
153 | 151 | ||
154 | qg_linksup = adapter->ahw.qg_linksup; | 152 | qg_linksup = adapter->ahw.qg_linksup; |
155 | adapter->ahw.qg_linksup = val; | 153 | adapter->ahw.qg_linksup = val; |
156 | DPRINTK(INFO, "link update 0x%08x\n", val); | 154 | DPRINTK(INFO, "link update 0x%08x\n", val); |
157 | for (portno = 0; portno < NETXEN_NIU_MAX_GBE_PORTS; portno++) { | ||
158 | linkup = val & 1; | ||
159 | if (linkup != (qg_linksup & 1)) { | ||
160 | printk(KERN_INFO "%s: %s PORT %d link %s\n", | ||
161 | adapter->port[portno]->netdev->name, | ||
162 | netxen_nic_driver_name, portno, | ||
163 | ((linkup == 0) ? "down" : "up")); | ||
164 | netxen_indicate_link_status(adapter, portno, linkup); | ||
165 | if (linkup) | ||
166 | netxen_nic_set_link_parameters(adapter-> | ||
167 | port[portno]); | ||
168 | 155 | ||
169 | } | 156 | linkup = val & 1; |
170 | val = val >> 1; | ||
171 | qg_linksup = qg_linksup >> 1; | ||
172 | } | ||
173 | 157 | ||
174 | adapter->stats.otherints++; | 158 | if (linkup != (qg_linksup & 1)) { |
159 | printk(KERN_INFO "%s: %s PORT %d link %s\n", | ||
160 | adapter->netdev->name, | ||
161 | netxen_nic_driver_name, portno, | ||
162 | ((linkup == 0) ? "down" : "up")); | ||
163 | netxen_indicate_link_status(adapter, linkup); | ||
164 | if (linkup) | ||
165 | netxen_nic_set_link_parameters(adapter); | ||
175 | 166 | ||
167 | } | ||
176 | } | 168 | } |
177 | 169 | ||
178 | void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter) | 170 | void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter) |
@@ -182,26 +174,27 @@ void netxen_nic_gbe_handle_phy_intr(struct netxen_adapter *adapter) | |||
182 | 174 | ||
183 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) | 175 | void netxen_nic_xgbe_handle_phy_intr(struct netxen_adapter *adapter) |
184 | { | 176 | { |
185 | struct net_device *netdev = adapter->port[0]->netdev; | 177 | struct net_device *netdev = adapter->netdev; |
186 | u32 val; | 178 | u32 val, val1; |
187 | 179 | ||
188 | /* WINDOW = 1 */ | 180 | /* WINDOW = 1 */ |
189 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); | 181 | val = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_XG_STATE)); |
182 | val1 = val & 0xff; | ||
190 | 183 | ||
191 | if (adapter->ahw.xg_linkup == 1 && val != XG_LINK_UP) { | 184 | if (adapter->ahw.xg_linkup == 1 && val1 != XG_LINK_UP) { |
192 | printk(KERN_INFO "%s: %s NIC Link is down\n", | 185 | printk(KERN_INFO "%s: %s NIC Link is down\n", |
193 | netxen_nic_driver_name, netdev->name); | 186 | netxen_nic_driver_name, netdev->name); |
194 | adapter->ahw.xg_linkup = 0; | 187 | adapter->ahw.xg_linkup = 0; |
195 | /* read twice to clear sticky bits */ | 188 | /* read twice to clear sticky bits */ |
196 | /* WINDOW = 0 */ | 189 | /* WINDOW = 0 */ |
197 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val); | 190 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1); |
198 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val); | 191 | netxen_nic_read_w0(adapter, NETXEN_NIU_XG_STATUS, &val1); |
199 | 192 | ||
200 | if ((val & 0xffb) != 0xffb) { | 193 | if ((val & 0xffb) != 0xffb) { |
201 | printk(KERN_INFO "%s ISR: Sync/Align BAD: 0x%08x\n", | 194 | printk(KERN_INFO "%s ISR: Sync/Align BAD: 0x%08x\n", |
202 | netxen_nic_driver_name, val); | 195 | netxen_nic_driver_name, val1); |
203 | } | 196 | } |
204 | } else if (adapter->ahw.xg_linkup == 0 && val == XG_LINK_UP) { | 197 | } else if (adapter->ahw.xg_linkup == 0 && val1 == XG_LINK_UP) { |
205 | printk(KERN_INFO "%s: %s NIC Link is up\n", | 198 | printk(KERN_INFO "%s: %s NIC Link is up\n", |
206 | netxen_nic_driver_name, netdev->name); | 199 | netxen_nic_driver_name, netdev->name); |
207 | adapter->ahw.xg_linkup = 1; | 200 | adapter->ahw.xg_linkup = 1; |