Commit dafc2199 authored by Govindarajulu Varadarajan's avatar Govindarajulu Varadarajan Committed by David S. Miller

enic: reduce ioread in devcmd2

posted_index is RO in firmware. We need not do ioread everytime to get
posted index. Store posted index locally.
Signed-off-by: default avatarGovindarajulu Varadarajan <_govind@gmx.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6e85d5ad
...@@ -301,12 +301,12 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, ...@@ -301,12 +301,12 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
struct devcmd2_result *result = dc2c->result + dc2c->next_result; struct devcmd2_result *result = dc2c->result + dc2c->next_result;
unsigned int i; unsigned int i;
int delay, err; int delay, err;
u32 fetch_index, posted, new_posted; u32 fetch_index, new_posted;
u32 posted = dc2c->posted;
posted = ioread32(&dc2c->wq_ctrl->posted_index);
fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index); fetch_index = ioread32(&dc2c->wq_ctrl->fetch_index);
if (posted == 0xFFFFFFFF || fetch_index == 0xFFFFFFFF) if (fetch_index == 0xFFFFFFFF)
return -ENODEV; return -ENODEV;
new_posted = (posted + 1) % DEVCMD2_RING_SIZE; new_posted = (posted + 1) % DEVCMD2_RING_SIZE;
...@@ -331,6 +331,7 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd, ...@@ -331,6 +331,7 @@ static int _vnic_dev_cmd2(struct vnic_dev *vdev, enum vnic_devcmd_cmd cmd,
*/ */
wmb(); wmb();
iowrite32(new_posted, &dc2c->wq_ctrl->posted_index); iowrite32(new_posted, &dc2c->wq_ctrl->posted_index);
dc2c->posted = new_posted;
if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT) if (dc2c->cmd_ring[posted].flags & DEVCMD2_FNORESULT)
return 0; return 0;
...@@ -402,6 +403,7 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev) ...@@ -402,6 +403,7 @@ static int vnic_dev_init_devcmd2(struct vnic_dev *vdev)
enic_wq_init_start(&vdev->devcmd2->wq, 0, fetch_index, fetch_index, 0, enic_wq_init_start(&vdev->devcmd2->wq, 0, fetch_index, fetch_index, 0,
0); 0);
vdev->devcmd2->posted = fetch_index;
vnic_wq_enable(&vdev->devcmd2->wq); vnic_wq_enable(&vdev->devcmd2->wq);
err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring, err = vnic_dev_alloc_desc_ring(vdev, &vdev->devcmd2->results_ring,
......
...@@ -97,6 +97,7 @@ struct devcmd2_controller { ...@@ -97,6 +97,7 @@ struct devcmd2_controller {
int color; int color;
struct vnic_dev_ring results_ring; struct vnic_dev_ring results_ring;
struct vnic_wq wq; struct vnic_wq wq;
u32 posted;
}; };
static inline unsigned int vnic_wq_desc_avail(struct vnic_wq *wq) static inline unsigned int vnic_wq_desc_avail(struct vnic_wq *wq)
......
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