All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] enic: increment devcmd2 result ring in case of timeout
@ 2016-02-03  9:10 Govindarajulu Varadarajan
  2016-02-09  9:49 ` David Miller
  2016-02-09 10:02 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Govindarajulu Varadarajan @ 2016-02-03  9:10 UTC (permalink / raw)
  To: davem, netdev; +Cc: ssujith, benve, Sandeep Pillai, Govindarajulu Varadarajan

From: Sandeep Pillai <sanpilla@cisco.com>

Firmware posts the devcmd result in result ring. In case of timeout, driver
does not increment the current result pointer and firmware could post the
result after timeout has occurred. During next devcmd, driver would be
reading the result of previous devcmd.

Fix this by incrementing result even in case of timeout.

Fixes: 373fb0873d43 ("enic: add devcmd2")
Signed-off-by: Sandeep Pillai <sanpilla@cisco.com>
Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>
---
 drivers/net/ethernet/cisco/enic/enic.h     |  2 +-
 drivers/net/ethernet/cisco/enic/vnic_dev.c | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/cisco/enic/enic.h b/drivers/net/ethernet/cisco/enic/enic.h
index 1671fa3..7ba6d53 100644
--- a/drivers/net/ethernet/cisco/enic/enic.h
+++ b/drivers/net/ethernet/cisco/enic/enic.h
@@ -33,7 +33,7 @@
 
 #define DRV_NAME		"enic"
 #define DRV_DESCRIPTION		"Cisco VIC Ethernet NIC Driver"
-#define DRV_VERSION		"2.3.0.12"
+#define DRV_VERSION		"2.3.0.20"
 #define DRV_COPYRIGHT		"Copyright 2008-2013 Cisco Systems, Inc"
 
 #define ENIC_BARS_MAX		6
diff --git a/drivers/net/ethernet/cisco/enic/vnic_dev.c b/drivers/net/ethernet/cisco/enic/vnic_dev.c
index 1ffd105..1fdf5fe 100644
--- a/drivers/net/ethernet/cisco/enic/vnic_dev.c
+++ b/drivers/net/ethernet/cisco/enic/vnic_dev.c
@@ -298,7 +298,8 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 			  int wait)
 {
 	struct devcmd2_controller *dc2c = vdev->devcmd2;
-	struct devcmd2_result *result = dc2c->result + dc2c->next_result;
+	struct devcmd2_result *result;
+	u8 color;
 	unsigned int i;
 	int delay, err;
 	u32 fetch_index, new_posted;
@@ -336,13 +337,17 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
 	if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
 		return 0;
 
+	result = dc2c->result + dc2c->next_result;
+	color = dc2c->color;
+
+	dc2c->next_result++;
+	if (dc2c->next_result == dc2c->result_size) {
+		dc2c->next_result = 0;
+		dc2c->color = dc2c->color ? 0 : 1;
+	}
+
 	for (delay = 0; delay < wait; delay++) {
-		if (result->color == dc2c->color) {
-			dc2c->next_result++;
-			if (dc2c->next_result == dc2c->result_size) {
-				dc2c->next_result = 0;
-				dc2c->color = dc2c->color ? 0 : 1;
-			}
+		if (result->color == color) {
 			if (result->error) {
 				err = result->error;
 				if (err != ERR_ECMDUNKNOWN ||
-- 
2.6.2

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

* Re: [PATCH net] enic: increment devcmd2 result ring in case of timeout
  2016-02-03  9:10 [PATCH net] enic: increment devcmd2 result ring in case of timeout Govindarajulu Varadarajan
@ 2016-02-09  9:49 ` David Miller
  2016-02-09 10:02 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-02-09  9:49 UTC (permalink / raw)
  To: gvaradar; +Cc: netdev, ssujith, benve, sanpilla, _govind

From: Govindarajulu Varadarajan <gvaradar@cisco.com>
Date: Wed,  3 Feb 2016 14:40:44 +0530

> From: Sandeep Pillai <sanpilla@cisco.com>
> 
> Firmware posts the devcmd result in result ring. In case of timeout, driver
> does not increment the current result pointer and firmware could post the
> result after timeout has occurred. During next devcmd, driver would be
> reading the result of previous devcmd.
> 
> Fix this by incrementing result even in case of timeout.
> 
> Fixes: 373fb0873d43 ("enic: add devcmd2")
> Signed-off-by: Sandeep Pillai <sanpilla@cisco.com>
> Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>

Applied and queued up for -stable, thanks.

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

* Re: [PATCH net] enic: increment devcmd2 result ring in case of timeout
  2016-02-03  9:10 [PATCH net] enic: increment devcmd2 result ring in case of timeout Govindarajulu Varadarajan
  2016-02-09  9:49 ` David Miller
@ 2016-02-09 10:02 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-02-09 10:02 UTC (permalink / raw)
  To: gvaradar; +Cc: netdev, ssujith, benve, sanpilla, _govind

From: Govindarajulu Varadarajan <gvaradar@cisco.com>
Date: Wed,  3 Feb 2016 14:40:44 +0530

> From: Sandeep Pillai <sanpilla@cisco.com>
> 
> Firmware posts the devcmd result in result ring. In case of timeout, driver
> does not increment the current result pointer and firmware could post the
> result after timeout has occurred. During next devcmd, driver would be
> reading the result of previous devcmd.
> 
> Fix this by incrementing result even in case of timeout.
> 
> Fixes: 373fb0873d43 ("enic: add devcmd2")
> Signed-off-by: Sandeep Pillai <sanpilla@cisco.com>
> Signed-off-by: Govindarajulu Varadarajan <_govind@gmx.com>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2016-02-09 10:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-03  9:10 [PATCH net] enic: increment devcmd2 result ring in case of timeout Govindarajulu Varadarajan
2016-02-09  9:49 ` David Miller
2016-02-09 10:02 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.