aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2008-03-17 22:59:48 -0400
committerJeff Garzik <jeff@garzik.org>2008-03-25 23:16:15 -0400
commit443be7960be77f3345b44491c700ae4471b0fe57 (patch)
tree48a20558ab8b4726507948b6fc3c850cac13f84b /drivers/net/netxen
parent9e6db60825ef7e7999abc610ce256ba768e58162 (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')
-rw-r--r--drivers/net/netxen/netxen_nic.h1
-rw-r--r--drivers/net/netxen/netxen_nic_hdr.h12
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c2
-rw-r--r--drivers/net/netxen/netxen_nic_init.c2
-rw-r--r--drivers/net/netxen/netxen_nic_main.c56
-rw-r--r--drivers/net/netxen/netxen_nic_phan_reg.h3
6 files changed, 43 insertions, 33 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index 2bc5eaae141f..876cd0635f2e 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -942,6 +942,7 @@ struct netxen_adapter {
942 struct pci_dev *ctx_desc_pdev; 942 struct pci_dev *ctx_desc_pdev;
943 dma_addr_t ctx_desc_phys_addr; 943 dma_addr_t ctx_desc_phys_addr;
944 int intr_scheme; 944 int intr_scheme;
945 int msi_mode;
945 int (*enable_phy_interrupts) (struct netxen_adapter *); 946 int (*enable_phy_interrupts) (struct netxen_adapter *);
946 int (*disable_phy_interrupts) (struct netxen_adapter *); 947 int (*disable_phy_interrupts) (struct netxen_adapter *);
947 void (*handle_phy_intr) (struct netxen_adapter *); 948 void (*handle_phy_intr) (struct netxen_adapter *);
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h
index d72f8f8fcb50..160f605e58db 100644
--- a/drivers/net/netxen/netxen_nic_hdr.h
+++ b/drivers/net/netxen/netxen_nic_hdr.h
@@ -456,6 +456,12 @@ enum {
456#define ISR_INT_MASK_SLOW (NETXEN_PCIX_PS_REG(PCIX_INT_MASK)) 456#define ISR_INT_MASK_SLOW (NETXEN_PCIX_PS_REG(PCIX_INT_MASK))
457#define ISR_INT_TARGET_STATUS (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS)) 457#define ISR_INT_TARGET_STATUS (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS))
458#define ISR_INT_TARGET_MASK (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK)) 458#define ISR_INT_TARGET_MASK (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK))
459#define ISR_INT_TARGET_STATUS_F1 (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS_F1))
460#define ISR_INT_TARGET_MASK_F1 (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK_F1))
461#define ISR_INT_TARGET_STATUS_F2 (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS_F2))
462#define ISR_INT_TARGET_MASK_F2 (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK_F2))
463#define ISR_INT_TARGET_STATUS_F3 (NETXEN_PCIX_PS_REG(PCIX_TARGET_STATUS_F3))
464#define ISR_INT_TARGET_MASK_F3 (NETXEN_PCIX_PS_REG(PCIX_TARGET_MASK_F3))
459 465
460#define NETXEN_PCI_MAPSIZE 128 466#define NETXEN_PCI_MAPSIZE 128
461#define NETXEN_PCI_DDR_NET (0x00000000UL) 467#define NETXEN_PCI_DDR_NET (0x00000000UL)
@@ -662,6 +668,12 @@ enum {
662 668
663#define PCIX_TARGET_STATUS (0x10118) 669#define PCIX_TARGET_STATUS (0x10118)
664#define PCIX_TARGET_MASK (0x10128) 670#define PCIX_TARGET_MASK (0x10128)
671#define PCIX_TARGET_STATUS_F1 (0x10160)
672#define PCIX_TARGET_MASK_F1 (0x10170)
673#define PCIX_TARGET_STATUS_F2 (0x10164)
674#define PCIX_TARGET_MASK_F2 (0x10174)
675#define PCIX_TARGET_STATUS_F3 (0x10168)
676#define PCIX_TARGET_MASK_F3 (0x10178)
665 677
666#define PCIX_MSI_F0 (0x13000) 678#define PCIX_MSI_F0 (0x13000)
667#define PCIX_MSI_F1 (0x13004) 679#define PCIX_MSI_F1 (0x13004)
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 01355701bf8e..05748ca6f216 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -398,6 +398,8 @@ int netxen_nic_hw_resources(struct netxen_adapter *adapter)
398 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW)); 398 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_FW));
399 printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netxen_nic_driver_name, 399 printk(KERN_NOTICE "%s: FW capabilities:0x%x\n", netxen_nic_driver_name,
400 adapter->intr_scheme); 400 adapter->intr_scheme);
401 adapter->msi_mode = readl(
402 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_FW));
401 DPRINTK(INFO, "Receive Peg ready too. starting stuff\n"); 403 DPRINTK(INFO, "Receive Peg ready too. starting stuff\n");
402 404
403 addr = netxen_alloc(adapter->ahw.pdev, 405 addr = netxen_alloc(adapter->ahw.pdev,
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c
index 9e38bcb3fba9..43eb1f65152d 100644
--- a/drivers/net/netxen/netxen_nic_init.c
+++ b/drivers/net/netxen/netxen_nic_init.c
@@ -145,6 +145,8 @@ int netxen_init_firmware(struct netxen_adapter *adapter)
145 /* Window 1 call */ 145 /* Window 1 call */
146 writel(INTR_SCHEME_PERPORT, 146 writel(INTR_SCHEME_PERPORT,
147 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_HOST)); 147 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_CAPABILITIES_HOST));
148 writel(MSI_MODE_MULTIFUNC,
149 NETXEN_CRB_NORMALIZE(adapter, CRB_NIC_MSI_MODE_HOST));
148 writel(MPORT_MULTI_FUNCTION_MODE, 150 writel(MPORT_MULTI_FUNCTION_MODE,
149 NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE)); 151 NETXEN_CRB_NORMALIZE(adapter, CRB_MPORT_MODE));
150 writel(PHAN_INITIALIZE_ACK, 152 writel(PHAN_INITIALIZE_ACK,
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
152static 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
157static 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
152static void netxen_nic_disable_int(struct netxen_adapter *adapter) 162static 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
198static void netxen_nic_enable_int(struct netxen_adapter *adapter) 199static 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;
diff --git a/drivers/net/netxen/netxen_nic_phan_reg.h b/drivers/net/netxen/netxen_nic_phan_reg.h
index ffa3b7215ce8..a566b50f36f5 100644
--- a/drivers/net/netxen/netxen_nic_phan_reg.h
+++ b/drivers/net/netxen/netxen_nic_phan_reg.h
@@ -126,8 +126,11 @@
126 */ 126 */
127#define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8) 127#define CRB_NIC_CAPABILITIES_HOST NETXEN_NIC_REG(0x1a8)
128#define CRB_NIC_CAPABILITIES_FW NETXEN_NIC_REG(0x1dc) 128#define CRB_NIC_CAPABILITIES_FW NETXEN_NIC_REG(0x1dc)
129#define CRB_NIC_MSI_MODE_HOST NETXEN_NIC_REG(0x270)
130#define CRB_NIC_MSI_MODE_FW NETXEN_NIC_REG(0x274)
129 131
130#define INTR_SCHEME_PERPORT 0x1 132#define INTR_SCHEME_PERPORT 0x1
133#define MSI_MODE_MULTIFUNC 0x1
131 134
132/* used for ethtool tests */ 135/* used for ethtool tests */
133#define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280) 136#define CRB_SCRATCHPAD_TEST NETXEN_NIC_REG(0x280)