Commit ca7f41a4 authored by Sandeep Pillai's avatar Sandeep Pillai Committed by David S. Miller

enic: increment devcmd2 result ring in case of timeout

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: 373fb087 ("enic: add devcmd2")
Signed-off-by: default avatarSandeep Pillai <sanpilla@cisco.com>
Signed-off-by: default avatarGovindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b7d98729
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define DRV_NAME "enic" #define DRV_NAME "enic"
#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" #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 DRV_COPYRIGHT "Copyright 2008-2013 Cisco Systems, Inc"
#define ENIC_BARS_MAX 6 #define ENIC_BARS_MAX 6
......
...@@ -298,7 +298,8 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, ...@@ -298,7 +298,8 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
int wait) int wait)
{ {
struct devcmd2_controller *dc2c = vdev->devcmd2; struct devcmd2_controller *dc2c = vdev->devcmd2;
struct devcmd2_result *result = dc2c->result + dc2c->next_result; struct devcmd2_result *result;
u8 color;
unsigned int i; unsigned int i;
int delay, err; int delay, err;
u32 fetch_index, new_posted; u32 fetch_index, new_posted;
...@@ -336,13 +337,17 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, ...@@ -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) if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
return 0; return 0;
for (delay = 0; delay < wait; delay++) { result = dc2c->result + dc2c->next_result;
if (result->color == dc2c->color) { color = dc2c->color;
dc2c->next_result++; dc2c->next_result++;
if (dc2c->next_result == dc2c->result_size) { if (dc2c->next_result == dc2c->result_size) {
dc2c->next_result = 0; dc2c->next_result = 0;
dc2c->color = dc2c->color ? 0 : 1; dc2c->color = dc2c->color ? 0 : 1;
} }
for (delay = 0; delay < wait; delay++) {
if (result->color == color) {
if (result->error) { if (result->error) {
err = result->error; err = result->error;
if (err != ERR_ECMDUNKNOWN || if (err != ERR_ECMDUNKNOWN ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment