netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/4] qlcnic: Bug fixes.
@ 2014-09-22  9:51 Manish Chopra
  2014-09-22  9:51 ` [PATCH net 1/4] qlcnic: Use qlcnic_83xx_flash_read32() API instead of lockless version of the API Manish Chopra
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Manish Chopra @ 2014-09-22  9:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept-GELinuxNICDev

Hi David,

This patch series contains following bug fixes:

* Fixes related to ethtool statistics.
* Fix for flash read related API.

Please apply this series to 'net'.

Thanks,
Manish

Manish Chopra (3):
  qlcnic: Fix memory corruption while reading stats using ethtool.
  qlcnic: Remove __QLCNIC_DEV_UP bit check to read TX queues
    statistics.
  qlcnic: Fix ordering of stats in stats buffer.

Sony Chacko (1):
  qlcnic: Use qlcnic_83xx_flash_read32() API instead of lockless
    version of the API.

 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c  |    5 ++---
 .../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c    |   10 +++++-----
 2 files changed, 7 insertions(+), 8 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net 1/4] qlcnic: Use qlcnic_83xx_flash_read32() API instead of lockless version of the API.
  2014-09-22  9:51 [PATCH net 0/4] qlcnic: Bug fixes Manish Chopra
@ 2014-09-22  9:51 ` Manish Chopra
  2014-09-22  9:51 ` [PATCH net 2/4] qlcnic: Fix memory corruption while reading stats using ethtool Manish Chopra
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Manish Chopra @ 2014-09-22  9:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept-GELinuxNICDev, Sony Chacko

From: Sony Chacko <sony.chacko@qlogic.com>

In qlcnic_83xx_setup_idc_parameters() routine use qlcnic_83xx_flash_read32() API
which takes flash lock internally instead of the lockless version
qlcnic_83xx_lockless_flash_read32().

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
---
 .../net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c  |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
index 86783e1..3172cdf 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
@@ -1177,9 +1177,8 @@ static void qlcnic_83xx_setup_idc_parameters(struct qlcnic_adapter *adapter)
 {
 	u32 idc_params, val;
 
-	if (qlcnic_83xx_lockless_flash_read32(adapter,
-					      QLC_83XX_IDC_FLASH_PARAM_ADDR,
-					      (u8 *)&idc_params, 1)) {
+	if (qlcnic_83xx_flash_read32(adapter, QLC_83XX_IDC_FLASH_PARAM_ADDR,
+				     (u8 *)&idc_params, 1)) {
 		dev_info(&adapter->pdev->dev,
 			 "%s:failed to get IDC params from flash\n", __func__);
 		adapter->dev_init_timeo = QLC_83XX_IDC_INIT_TIMEOUT_SECS;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 2/4] qlcnic: Fix memory corruption while reading stats using ethtool.
  2014-09-22  9:51 [PATCH net 0/4] qlcnic: Bug fixes Manish Chopra
  2014-09-22  9:51 ` [PATCH net 1/4] qlcnic: Use qlcnic_83xx_flash_read32() API instead of lockless version of the API Manish Chopra
@ 2014-09-22  9:51 ` Manish Chopra
  2014-09-22  9:51 ` [PATCH net 3/4] qlcnic: Remove __QLCNIC_DEV_UP bit check to read TX queues statistics Manish Chopra
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Manish Chopra @ 2014-09-22  9:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept-GELinuxNICDev

o  Driver is doing memset with zero for total number of stats bytes when
   it has already filled some data in the stats buffer, which can overwrite
   memory area beyond the length of stats buffer.

o  Fix this by initializing stats buffer with zero before filling any data in it.

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
---
 .../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c    |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 141f116..2d77b76 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -1333,12 +1333,11 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev,
 	struct qlcnic_host_tx_ring *tx_ring;
 	struct qlcnic_esw_statistics port_stats;
 	struct qlcnic_mac_statistics mac_stats;
-	int index, ret, length, size, tx_size, ring;
+	int index, ret, length, size, ring;
 	char *p;
 
-	tx_size = adapter->drv_tx_rings * QLCNIC_TX_STATS_LEN;
+	memset(data, 0, stats->n_stats * sizeof(u64));
 
-	memset(data, 0, tx_size * sizeof(u64));
 	for (ring = 0, index = 0; ring < adapter->drv_tx_rings; ring++) {
 		if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) {
 			tx_ring = &adapter->tx_ring[ring];
@@ -1347,7 +1346,6 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev,
 		}
 	}
 
-	memset(data, 0, stats->n_stats * sizeof(u64));
 	length = QLCNIC_STATS_LEN;
 	for (index = 0; index < length; index++) {
 		p = (char *)adapter + qlcnic_gstrings_stats[index].stat_offset;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 3/4] qlcnic: Remove __QLCNIC_DEV_UP bit check to read TX queues statistics.
  2014-09-22  9:51 [PATCH net 0/4] qlcnic: Bug fixes Manish Chopra
  2014-09-22  9:51 ` [PATCH net 1/4] qlcnic: Use qlcnic_83xx_flash_read32() API instead of lockless version of the API Manish Chopra
  2014-09-22  9:51 ` [PATCH net 2/4] qlcnic: Fix memory corruption while reading stats using ethtool Manish Chopra
@ 2014-09-22  9:51 ` Manish Chopra
  2014-09-22  9:51 ` [PATCH net 4/4] qlcnic: Fix ordering of stats in stats buffer Manish Chopra
  2014-09-26 19:12 ` [PATCH net 0/4] qlcnic: Bug fixes David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Manish Chopra @ 2014-09-22  9:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept-GELinuxNICDev

o TX queues stats must be read when queues are allocated regardless
  of interface is up or not.

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
---
 .../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c    |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 2d77b76..863c445 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -1339,7 +1339,7 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev,
 	memset(data, 0, stats->n_stats * sizeof(u64));
 
 	for (ring = 0, index = 0; ring < adapter->drv_tx_rings; ring++) {
-		if (test_bit(__QLCNIC_DEV_UP, &adapter->state)) {
+		if (adapter->is_up == QLCNIC_ADAPTER_UP_MAGIC) {
 			tx_ring = &adapter->tx_ring[ring];
 			data = qlcnic_fill_tx_queue_stats(data, tx_ring);
 			qlcnic_update_stats(adapter);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net 4/4] qlcnic: Fix ordering of stats in stats buffer.
  2014-09-22  9:51 [PATCH net 0/4] qlcnic: Bug fixes Manish Chopra
                   ` (2 preceding siblings ...)
  2014-09-22  9:51 ` [PATCH net 3/4] qlcnic: Remove __QLCNIC_DEV_UP bit check to read TX queues statistics Manish Chopra
@ 2014-09-22  9:51 ` Manish Chopra
  2014-09-26 19:12 ` [PATCH net 0/4] qlcnic: Bug fixes David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: Manish Chopra @ 2014-09-22  9:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, Dept-GELinuxNICDev

o When TX queues are not allocated, driver does not fill TX queues stats in the buffer.
  However, it is also not advancing data pointer by TX queue stats length, which would
  misplace all successive stats data in the buffer and will result in mismatch between
  stats strings and it's values.

o Fix this by advancing data pointer by TX queue stats length when
  queues are not allocated.

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
---
 .../net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c    |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
index 863c445..494e810 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
@@ -1343,6 +1343,8 @@ static void qlcnic_get_ethtool_stats(struct net_device *dev,
 			tx_ring = &adapter->tx_ring[ring];
 			data = qlcnic_fill_tx_queue_stats(data, tx_ring);
 			qlcnic_update_stats(adapter);
+		} else {
+			data += QLCNIC_TX_STATS_LEN;
 		}
 	}
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net 0/4] qlcnic: Bug fixes.
  2014-09-22  9:51 [PATCH net 0/4] qlcnic: Bug fixes Manish Chopra
                   ` (3 preceding siblings ...)
  2014-09-22  9:51 ` [PATCH net 4/4] qlcnic: Fix ordering of stats in stats buffer Manish Chopra
@ 2014-09-26 19:12 ` David Miller
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2014-09-26 19:12 UTC (permalink / raw)
  To: manish.chopra; +Cc: netdev, Dept-GELinuxNICDev

From: Manish Chopra <manish.chopra@qlogic.com>
Date: Mon, 22 Sep 2014 05:51:49 -0400

> This patch series contains following bug fixes:
> 
> * Fixes related to ethtool statistics.
> * Fix for flash read related API.
> 
> Please apply this series to 'net'.

Series applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-26 19:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-22  9:51 [PATCH net 0/4] qlcnic: Bug fixes Manish Chopra
2014-09-22  9:51 ` [PATCH net 1/4] qlcnic: Use qlcnic_83xx_flash_read32() API instead of lockless version of the API Manish Chopra
2014-09-22  9:51 ` [PATCH net 2/4] qlcnic: Fix memory corruption while reading stats using ethtool Manish Chopra
2014-09-22  9:51 ` [PATCH net 3/4] qlcnic: Remove __QLCNIC_DEV_UP bit check to read TX queues statistics Manish Chopra
2014-09-22  9:51 ` [PATCH net 4/4] qlcnic: Fix ordering of stats in stats buffer Manish Chopra
2014-09-26 19:12 ` [PATCH net 0/4] qlcnic: Bug fixes 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).