aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorRajesh Borundia <rajesh.borundia@qlogic.com>2011-09-19 04:49:52 -0400
committerDavid S. Miller <davem@davemloft.net>2011-09-20 14:57:15 -0400
commite3feb266c344394ce06bdecdfa05071118249c88 (patch)
tree9c32b19ce514a85f4706ed70726bc492fedb9c6d /drivers/net
parenta7ffa289445edf73c7797eac1dfa645a9784015a (diff)
netxen: Add pcie workaround
o A performance drop was seen with firmware loaded from flash. This workaround fixes it. o Updated driver version to 4.0.77 Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic.h4
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c63
2 files changed, 64 insertions, 3 deletions
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h
index 196b660e1d91..a876dffd7101 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h
@@ -53,8 +53,8 @@
53 53
54#define _NETXEN_NIC_LINUX_MAJOR 4 54#define _NETXEN_NIC_LINUX_MAJOR 4
55#define _NETXEN_NIC_LINUX_MINOR 0 55#define _NETXEN_NIC_LINUX_MINOR 0
56#define _NETXEN_NIC_LINUX_SUBVERSION 76 56#define _NETXEN_NIC_LINUX_SUBVERSION 77
57#define NETXEN_NIC_LINUX_VERSIONID "4.0.76" 57#define NETXEN_NIC_LINUX_VERSIONID "4.0.77"
58 58
59#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) 59#define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c))
60#define _major(v) (((v) >> 24) & 0xff) 60#define _major(v) (((v) >> 24) & 0xff)
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 694130ebc75b..dc9e21af2dd1 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -400,6 +400,63 @@ static void netxen_set_port_mode(struct netxen_adapter *adapter)
400 } 400 }
401} 401}
402 402
403#define PCI_CAP_ID_GEN 0x10
404
405static void netxen_pcie_strap_init(struct netxen_adapter *adapter)
406{
407 u32 pdevfuncsave;
408 u32 c8c9value = 0;
409 u32 chicken = 0;
410 u32 control = 0;
411 int i, pos;
412 struct pci_dev *pdev;
413
414 pdev = adapter->pdev;
415
416 chicken = NXRD32(adapter, NETXEN_PCIE_REG(PCIE_CHICKEN3));
417 /* clear chicken3.25:24 */
418 chicken &= 0xFCFFFFFF;
419 /*
420 * if gen1 and B0, set F1020 - if gen 2, do nothing
421 * if gen2 set to F1000
422 */
423 pos = pci_find_capability(pdev, PCI_CAP_ID_GEN);
424 if (pos == 0xC0) {
425 pci_read_config_dword(pdev, pos + 0x10, &control);
426 if ((control & 0x000F0000) != 0x00020000) {
427 /* set chicken3.24 if gen1 */
428 chicken |= 0x01000000;
429 }
430 dev_info(&adapter->pdev->dev, "Gen2 strapping detected\n");
431 c8c9value = 0xF1000;
432 } else {
433 /* set chicken3.24 if gen1 */
434 chicken |= 0x01000000;
435 dev_info(&adapter->pdev->dev, "Gen1 strapping detected\n");
436 if (adapter->ahw.revision_id == NX_P3_B0)
437 c8c9value = 0xF1020;
438 else
439 c8c9value = 0;
440 }
441
442 NXWR32(adapter, NETXEN_PCIE_REG(PCIE_CHICKEN3), chicken);
443
444 if (!c8c9value)
445 return;
446
447 pdevfuncsave = pdev->devfn;
448 if (pdevfuncsave & 0x07)
449 return;
450
451 for (i = 0; i < 8; i++) {
452 pci_read_config_dword(pdev, pos + 8, &control);
453 pci_read_config_dword(pdev, pos + 8, &control);
454 pci_write_config_dword(pdev, pos + 8, c8c9value);
455 pdev->devfn++;
456 }
457 pdev->devfn = pdevfuncsave;
458}
459
403static void netxen_set_msix_bit(struct pci_dev *pdev, int enable) 460static void netxen_set_msix_bit(struct pci_dev *pdev, int enable)
404{ 461{
405 u32 control; 462 u32 control;
@@ -867,7 +924,7 @@ netxen_start_firmware(struct netxen_adapter *adapter)
867 if (err < 0) 924 if (err < 0)
868 goto err_out; 925 goto err_out;
869 if (err == 0) 926 if (err == 0)
870 goto wait_init; 927 goto pcie_strap_init;
871 928
872 if (first_boot != 0x55555555) { 929 if (first_boot != 0x55555555) {
873 NXWR32(adapter, CRB_CMDPEG_STATE, 0); 930 NXWR32(adapter, CRB_CMDPEG_STATE, 0);
@@ -910,6 +967,10 @@ netxen_start_firmware(struct netxen_adapter *adapter)
910 | (_NETXEN_NIC_LINUX_SUBVERSION); 967 | (_NETXEN_NIC_LINUX_SUBVERSION);
911 NXWR32(adapter, CRB_DRIVER_VERSION, val); 968 NXWR32(adapter, CRB_DRIVER_VERSION, val);
912 969
970pcie_strap_init:
971 if (NX_IS_REVISION_P3(adapter->ahw.revision_id))
972 netxen_pcie_strap_init(adapter);
973
913wait_init: 974wait_init:
914 /* Handshake with the card before we register the devices. */ 975 /* Handshake with the card before we register the devices. */
915 err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE); 976 err = netxen_phantom_init(adapter, NETXEN_NIC_PEG_TUNE);