diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2008-03-17 22:59:48 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2008-03-25 23:16:15 -0400 |
commit | 443be7960be77f3345b44491c700ae4471b0fe57 (patch) | |
tree | 48a20558ab8b4726507948b6fc3c850cac13f84b /drivers/net/netxen/netxen_nic_main.c | |
parent | 9e6db60825ef7e7999abc610ce256ba768e58162 (diff) |
netxen: improve msi support
Recent netxen firmware has new scheme of generating MSI interrupts, it
raises interrupt and blocks itself, waiting for driver to unmask. This
reduces chance of spurious interrupts.
The driver will be able to deal with older firmware as well.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Tested-by: Vernon Mauery <mauery@us.ibm.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.c | 56 |
1 files changed, 23 insertions, 33 deletions
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 9737eae5ef11..cd665da85c7f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -149,33 +149,31 @@ static void netxen_nic_update_cmd_consumer(struct netxen_adapter *adapter, | |||
149 | 149 | ||
150 | #define ADAPTER_LIST_SIZE 12 | 150 | #define ADAPTER_LIST_SIZE 12 |
151 | 151 | ||
152 | static uint32_t msi_tgt_status[4] = { | ||
153 | ISR_INT_TARGET_STATUS, ISR_INT_TARGET_STATUS_F1, | ||
154 | ISR_INT_TARGET_STATUS_F2, ISR_INT_TARGET_STATUS_F3 | ||
155 | }; | ||
156 | |||
157 | static uint32_t sw_int_mask[4] = { | ||
158 | CRB_SW_INT_MASK_0, CRB_SW_INT_MASK_1, | ||
159 | CRB_SW_INT_MASK_2, CRB_SW_INT_MASK_3 | ||
160 | }; | ||
161 | |||
152 | static void netxen_nic_disable_int(struct netxen_adapter *adapter) | 162 | static void netxen_nic_disable_int(struct netxen_adapter *adapter) |
153 | { | 163 | { |
154 | uint32_t mask = 0x7ff; | 164 | u32 mask = 0x7ff; |
155 | int retries = 32; | 165 | int retries = 32; |
166 | int port = adapter->portnum; | ||
167 | int pci_fn = adapter->ahw.pci_func; | ||
156 | 168 | ||
157 | DPRINTK(1, INFO, "Entered ISR Disable \n"); | 169 | if (adapter->msi_mode != MSI_MODE_MULTIFUNC) { |
158 | 170 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, sw_int_mask[port])); | |
159 | switch (adapter->portnum) { | ||
160 | case 0: | ||
161 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0)); | ||
162 | break; | ||
163 | case 1: | ||
164 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1)); | ||
165 | break; | ||
166 | case 2: | ||
167 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2)); | ||
168 | break; | ||
169 | case 3: | ||
170 | writel(0x0, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3)); | ||
171 | break; | ||
172 | } | 171 | } |
173 | 172 | ||
174 | if (adapter->intr_scheme != -1 && | 173 | if (adapter->intr_scheme != -1 && |
175 | adapter->intr_scheme != INTR_SCHEME_PERPORT) | 174 | adapter->intr_scheme != INTR_SCHEME_PERPORT) |
176 | writel(mask,PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); | 175 | writel(mask,PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); |
177 | 176 | ||
178 | /* Window = 0 or 1 */ | ||
179 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | 177 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { |
180 | do { | 178 | do { |
181 | writel(0xffffffff, | 179 | writel(0xffffffff, |
@@ -190,14 +188,18 @@ static void netxen_nic_disable_int(struct netxen_adapter *adapter) | |||
190 | printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n", | 188 | printk(KERN_NOTICE "%s: Failed to disable interrupt completely\n", |
191 | netxen_nic_driver_name); | 189 | netxen_nic_driver_name); |
192 | } | 190 | } |
191 | } else { | ||
192 | if (adapter->msi_mode == MSI_MODE_MULTIFUNC) { | ||
193 | writel(0xffffffff, PCI_OFFSET_SECOND_RANGE(adapter, | ||
194 | msi_tgt_status[pci_fn])); | ||
195 | } | ||
193 | } | 196 | } |
194 | |||
195 | DPRINTK(1, INFO, "Done with Disable Int\n"); | ||
196 | } | 197 | } |
197 | 198 | ||
198 | static void netxen_nic_enable_int(struct netxen_adapter *adapter) | 199 | static void netxen_nic_enable_int(struct netxen_adapter *adapter) |
199 | { | 200 | { |
200 | u32 mask; | 201 | u32 mask; |
202 | int port = adapter->portnum; | ||
201 | 203 | ||
202 | DPRINTK(1, INFO, "Entered ISR Enable \n"); | 204 | DPRINTK(1, INFO, "Entered ISR Enable \n"); |
203 | 205 | ||
@@ -218,20 +220,7 @@ static void netxen_nic_enable_int(struct netxen_adapter *adapter) | |||
218 | writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); | 220 | writel(mask, PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK)); |
219 | } | 221 | } |
220 | 222 | ||
221 | switch (adapter->portnum) { | 223 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, sw_int_mask[port])); |
222 | case 0: | ||
223 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_0)); | ||
224 | break; | ||
225 | case 1: | ||
226 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_1)); | ||
227 | break; | ||
228 | case 2: | ||
229 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_2)); | ||
230 | break; | ||
231 | case 3: | ||
232 | writel(0x1, NETXEN_CRB_NORMALIZE(adapter, CRB_SW_INT_MASK_3)); | ||
233 | break; | ||
234 | } | ||
235 | 224 | ||
236 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | 225 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { |
237 | mask = 0xbff; | 226 | mask = 0xbff; |
@@ -401,6 +390,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
401 | 390 | ||
402 | /* this will be read from FW later */ | 391 | /* this will be read from FW later */ |
403 | adapter->intr_scheme = -1; | 392 | adapter->intr_scheme = -1; |
393 | adapter->msi_mode = -1; | ||
404 | 394 | ||
405 | /* This will be reset for mezz cards */ | 395 | /* This will be reset for mezz cards */ |
406 | adapter->portnum = pci_func_id; | 396 | adapter->portnum = pci_func_id; |