* [PATCH 0/3]qlcnic:bug fixes
@ 2011-01-10 10:15 Amit Kumar Salecha
2011-01-10 10:15 ` [PATCH 1/3] qlcnic: fix flash fw version read Amit Kumar Salecha
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Amit Kumar Salecha @ 2011-01-10 10:15 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty
Hi,
Series of 3 patches to fix bugs. Apply them on net-2.6.
Driver is reading incorrect flash fw version and fails to load,
"fix flash fw version read" patch fixes this.
-Amit
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] qlcnic: fix flash fw version read
2011-01-10 10:15 [PATCH 0/3]qlcnic:bug fixes Amit Kumar Salecha
@ 2011-01-10 10:15 ` Amit Kumar Salecha
2011-01-10 21:35 ` David Miller
2011-01-10 10:15 ` [PATCH 2/3] qlcnic: fix ethtool diagnostics test Amit Kumar Salecha
2011-01-10 10:15 ` [PATCH 3/3] qlcnic: change module parameter permissions Amit Kumar Salecha
2 siblings, 1 reply; 7+ messages in thread
From: Amit Kumar Salecha @ 2011-01-10 10:15 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty
Driver is reading flash fw version from defined address, this address
may be invalid. Indeed Driver should read address for fw version through
flash layout table. Flash layout table has defined region and address for
fw version address should be read from fw image region.
Driver has check for old firmware, this bug can cause driver load fail.
This patch will try to read fw version from flash image region, if that fails,
read from defined address.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic.h | 20 ++++++++++++
drivers/net/qlcnic/qlcnic_init.c | 63 +++++++++++++++++++++++++++++++++++++-
2 files changed, 82 insertions(+), 1 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 9c2a02d..14b6322 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -289,6 +289,26 @@ struct uni_data_desc{
u32 reserved[5];
};
+/* Flash Defines and Structures */
+#define QLCNIC_FLT_LOCATION 0x3F1000
+#define QLCNIC_FW_IMAGE_REGION 0x74
+struct qlcnic_flt_header {
+ u16 version;
+ u16 len;
+ u16 checksum;
+ u16 reserved;
+};
+
+struct qlcnic_flt_entry {
+ u8 region;
+ u8 reserved0;
+ u8 attrib;
+ u8 reserved1;
+ u32 size;
+ u32 start_addr;
+ u32 end_add;
+};
+
/* Magic number to let user know flash is programmed */
#define QLCNIC_BDINFO_MAGIC 0x12345678
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c
index 9b9c7c3..a7f1d5b 100644
--- a/drivers/net/qlcnic/qlcnic_init.c
+++ b/drivers/net/qlcnic/qlcnic_init.c
@@ -627,12 +627,73 @@ qlcnic_setup_idc_param(struct qlcnic_adapter *adapter) {
return 0;
}
+static int qlcnic_get_flt_entry(struct qlcnic_adapter *adapter, u8 region,
+ struct qlcnic_flt_entry *region_entry)
+{
+ struct qlcnic_flt_header flt_hdr;
+ struct qlcnic_flt_entry *flt_entry;
+ int i = 0, ret;
+ u32 entry_size;
+
+ memset(region_entry, 0, sizeof(struct qlcnic_flt_entry));
+ ret = qlcnic_rom_fast_read_words(adapter, QLCNIC_FLT_LOCATION,
+ (u8 *)&flt_hdr,
+ sizeof(struct qlcnic_flt_header));
+ if (ret) {
+ dev_warn(&adapter->pdev->dev,
+ "error reading flash layout header\n");
+ return -EIO;
+ }
+
+ entry_size = flt_hdr.len - sizeof(struct qlcnic_flt_header);
+ flt_entry = (struct qlcnic_flt_entry *)vzalloc(entry_size);
+ if (flt_entry == NULL) {
+ dev_warn(&adapter->pdev->dev, "error allocating memory\n");
+ return -EIO;
+ }
+
+ ret = qlcnic_rom_fast_read_words(adapter, QLCNIC_FLT_LOCATION +
+ sizeof(struct qlcnic_flt_header),
+ (u8 *)flt_entry, entry_size);
+ if (ret) {
+ dev_warn(&adapter->pdev->dev,
+ "error reading flash layout entries\n");
+ goto err_out;
+ }
+
+ while (i < (entry_size/sizeof(struct qlcnic_flt_entry))) {
+ if (flt_entry[i].region == region)
+ break;
+ i++;
+ }
+ if (i >= (entry_size/sizeof(struct qlcnic_flt_entry))) {
+ dev_warn(&adapter->pdev->dev,
+ "region=%x not found in %d regions\n", region, i);
+ ret = -EIO;
+ goto err_out;
+ }
+ memcpy(region_entry, &flt_entry[i], sizeof(struct qlcnic_flt_entry));
+
+err_out:
+ vfree(flt_entry);
+ return ret;
+}
+
int
qlcnic_check_flash_fw_ver(struct qlcnic_adapter *adapter)
{
+ struct qlcnic_flt_entry fw_entry;
u32 ver = -1, min_ver;
+ int ret;
- qlcnic_rom_fast_read(adapter, QLCNIC_FW_VERSION_OFFSET, (int *)&ver);
+ ret = qlcnic_get_flt_entry(adapter, QLCNIC_FW_IMAGE_REGION, &fw_entry);
+ if (!ret)
+ /* 0-4:-signature, 4-8:-fw version */
+ qlcnic_rom_fast_read(adapter, fw_entry.start_addr + 4,
+ (int *)&ver);
+ else
+ qlcnic_rom_fast_read(adapter, QLCNIC_FW_VERSION_OFFSET,
+ (int *)&ver);
ver = QLCNIC_DECODE_VERSION(ver);
min_ver = QLCNIC_MIN_FW_VERSION;
--
1.7.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] qlcnic: fix ethtool diagnostics test
2011-01-10 10:15 [PATCH 0/3]qlcnic:bug fixes Amit Kumar Salecha
2011-01-10 10:15 ` [PATCH 1/3] qlcnic: fix flash fw version read Amit Kumar Salecha
@ 2011-01-10 10:15 ` Amit Kumar Salecha
2011-01-10 21:35 ` David Miller
2011-01-10 10:15 ` [PATCH 3/3] qlcnic: change module parameter permissions Amit Kumar Salecha
2 siblings, 1 reply; 7+ messages in thread
From: Amit Kumar Salecha @ 2011-01-10 10:15 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty, Sony Chacko
From: Sony Chacko <sony.chacko@qlogic.com>
IRQ diag test was getting executed only when both register test
and link test passed. The test should get executed if ETH_TEST_FL_OFFLINE
flag is set.
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic_ethtool.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c
index 1e7af70..4c14510 100644
--- a/drivers/net/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/qlcnic/qlcnic_ethtool.c
@@ -672,7 +672,7 @@ qlcnic_diag_test(struct net_device *dev, struct ethtool_test *eth_test,
if (data[1])
eth_test->flags |= ETH_TEST_FL_FAILED;
- if (eth_test->flags == ETH_TEST_FL_OFFLINE) {
+ if (eth_test->flags & ETH_TEST_FL_OFFLINE) {
data[2] = qlcnic_irq_test(dev);
if (data[2])
eth_test->flags |= ETH_TEST_FL_FAILED;
--
1.7.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] qlcnic: change module parameter permissions
2011-01-10 10:15 [PATCH 0/3]qlcnic:bug fixes Amit Kumar Salecha
2011-01-10 10:15 ` [PATCH 1/3] qlcnic: fix flash fw version read Amit Kumar Salecha
2011-01-10 10:15 ` [PATCH 2/3] qlcnic: fix ethtool diagnostics test Amit Kumar Salecha
@ 2011-01-10 10:15 ` Amit Kumar Salecha
2011-01-10 21:35 ` David Miller
2 siblings, 1 reply; 7+ messages in thread
From: Amit Kumar Salecha @ 2011-01-10 10:15 UTC (permalink / raw)
To: davem; +Cc: netdev, ameen.rahman, anirban.chakraborty
o Updating module parameter after driver load is not supported
except auto_fw_reset parameter. Changing these parameter after
driver load, can have weird result.
o Update driver version to 5.0.15.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
---
drivers/net/qlcnic/qlcnic.h | 4 ++--
drivers/net/qlcnic/qlcnic_main.c | 10 +++++-----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h
index 14b6322..44e316f 100644
--- a/drivers/net/qlcnic/qlcnic.h
+++ b/drivers/net/qlcnic/qlcnic.h
@@ -34,8 +34,8 @@
#define _QLCNIC_LINUX_MAJOR 5
#define _QLCNIC_LINUX_MINOR 0
-#define _QLCNIC_LINUX_SUBVERSION 14
-#define QLCNIC_LINUX_VERSIONID "5.0.14"
+#define _QLCNIC_LINUX_SUBVERSION 15
+#define QLCNIC_LINUX_VERSIONID "5.0.15"
#define QLCNIC_DRV_IDC_VER 0x01
#define QLCNIC_DRIVER_VERSION ((_QLCNIC_LINUX_MAJOR << 16) |\
(_QLCNIC_LINUX_MINOR << 8) | (_QLCNIC_LINUX_SUBVERSION))
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 11e3a46..37c04b4 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -31,15 +31,15 @@ static const char qlcnic_driver_string[] = "QLogic 1/10 GbE "
static struct workqueue_struct *qlcnic_wq;
static int qlcnic_mac_learn;
-module_param(qlcnic_mac_learn, int, 0644);
+module_param(qlcnic_mac_learn, int, 0444);
MODULE_PARM_DESC(qlcnic_mac_learn, "Mac Filter (0=disabled, 1=enabled)");
static int use_msi = 1;
-module_param(use_msi, int, 0644);
+module_param(use_msi, int, 0444);
MODULE_PARM_DESC(use_msi, "MSI interrupt (0=disabled, 1=enabled");
static int use_msi_x = 1;
-module_param(use_msi_x, int, 0644);
+module_param(use_msi_x, int, 0444);
MODULE_PARM_DESC(use_msi_x, "MSI-X interrupt (0=disabled, 1=enabled");
static int auto_fw_reset = AUTO_FW_RESET_ENABLED;
@@ -47,11 +47,11 @@ module_param(auto_fw_reset, int, 0644);
MODULE_PARM_DESC(auto_fw_reset, "Auto firmware reset (0=disabled, 1=enabled");
static int load_fw_file;
-module_param(load_fw_file, int, 0644);
+module_param(load_fw_file, int, 0444);
MODULE_PARM_DESC(load_fw_file, "Load firmware from (0=flash, 1=file");
static int qlcnic_config_npars;
-module_param(qlcnic_config_npars, int, 0644);
+module_param(qlcnic_config_npars, int, 0444);
MODULE_PARM_DESC(qlcnic_config_npars, "Configure NPARs (0=disabled, 1=enabled");
static int __devinit qlcnic_probe(struct pci_dev *pdev,
--
1.7.3.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] qlcnic: fix flash fw version read
2011-01-10 10:15 ` [PATCH 1/3] qlcnic: fix flash fw version read Amit Kumar Salecha
@ 2011-01-10 21:35 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2011-01-10 21:35 UTC (permalink / raw)
To: amit.salecha; +Cc: netdev, ameen.rahman, anirban.chakraborty
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Mon, 10 Jan 2011 02:15:21 -0800
> Driver is reading flash fw version from defined address, this address
> may be invalid. Indeed Driver should read address for fw version through
> flash layout table. Flash layout table has defined region and address for
> fw version address should be read from fw image region.
>
> Driver has check for old firmware, this bug can cause driver load fail.
> This patch will try to read fw version from flash image region, if that fails,
> read from defined address.
>
> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] qlcnic: fix ethtool diagnostics test
2011-01-10 10:15 ` [PATCH 2/3] qlcnic: fix ethtool diagnostics test Amit Kumar Salecha
@ 2011-01-10 21:35 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2011-01-10 21:35 UTC (permalink / raw)
To: amit.salecha; +Cc: netdev, ameen.rahman, anirban.chakraborty, sony.chacko
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Mon, 10 Jan 2011 02:15:22 -0800
> From: Sony Chacko <sony.chacko@qlogic.com>
>
> IRQ diag test was getting executed only when both register test
> and link test passed. The test should get executed if ETH_TEST_FL_OFFLINE
> flag is set.
>
> Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] qlcnic: change module parameter permissions
2011-01-10 10:15 ` [PATCH 3/3] qlcnic: change module parameter permissions Amit Kumar Salecha
@ 2011-01-10 21:35 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2011-01-10 21:35 UTC (permalink / raw)
To: amit.salecha; +Cc: netdev, ameen.rahman, anirban.chakraborty
From: Amit Kumar Salecha <amit.salecha@qlogic.com>
Date: Mon, 10 Jan 2011 02:15:23 -0800
> o Updating module parameter after driver load is not supported
> except auto_fw_reset parameter. Changing these parameter after
> driver load, can have weird result.
>
> o Update driver version to 5.0.15.
>
> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Applied.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-01-10 21:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-10 10:15 [PATCH 0/3]qlcnic:bug fixes Amit Kumar Salecha
2011-01-10 10:15 ` [PATCH 1/3] qlcnic: fix flash fw version read Amit Kumar Salecha
2011-01-10 21:35 ` David Miller
2011-01-10 10:15 ` [PATCH 2/3] qlcnic: fix ethtool diagnostics test Amit Kumar Salecha
2011-01-10 21:35 ` David Miller
2011-01-10 10:15 ` [PATCH 3/3] qlcnic: change module parameter permissions Amit Kumar Salecha
2011-01-10 21:35 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).