diff options
author | Scott Feldman <scofeldm@cisco.com> | 2009-09-03 17:02:45 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-04 03:19:25 (GMT) |
commit | 6fdfa97073a2bcbb60d900654c612b2ff09b9cb7 (patch) | |
tree | 3297813813e0a1a82664e13b52cbc79ecb36ae92 /drivers/net/enic/vnic_wq.c | |
parent | 491598a44f12fe8b862ab4123de1a1ffe9b86832 (diff) | |
download | linux-6fdfa97073a2bcbb60d900654c612b2ff09b9cb7.tar.xz |
enic: organize device initialization/deinit into separate functions
To unclutter probe() a little bit, put all device initialization code
in one spot and device deinit code in another spot. Also remove unused
rq->buf_index variable/func.
Signed-off-by: Scott Feldman <scofeldm@cisco.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/enic/vnic_wq.c')
-rw-r--r-- | drivers/net/enic/vnic_wq.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/net/enic/vnic_wq.c b/drivers/net/enic/vnic_wq.c index a576d04..d2e00e5 100644 --- a/drivers/net/enic/vnic_wq.c +++ b/drivers/net/enic/vnic_wq.c @@ -112,7 +112,8 @@ int vnic_wq_alloc(struct vnic_dev *vdev, struct vnic_wq *wq, unsigned int index, return 0; } -void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index, +void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index, + unsigned int fetch_index, unsigned int posted_index, unsigned int error_interrupt_enable, unsigned int error_interrupt_offset) { @@ -121,12 +122,25 @@ void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index, paddr = (u64)wq->ring.base_addr | VNIC_PADDR_TARGET; writeq(paddr, &wq->ctrl->ring_base); iowrite32(wq->ring.desc_count, &wq->ctrl->ring_size); - iowrite32(0, &wq->ctrl->fetch_index); - iowrite32(0, &wq->ctrl->posted_index); + iowrite32(fetch_index, &wq->ctrl->fetch_index); + iowrite32(posted_index, &wq->ctrl->posted_index); iowrite32(cq_index, &wq->ctrl->cq_index); iowrite32(error_interrupt_enable, &wq->ctrl->error_interrupt_enable); iowrite32(error_interrupt_offset, &wq->ctrl->error_interrupt_offset); iowrite32(0, &wq->ctrl->error_status); + + wq->to_use = wq->to_clean = + &wq->bufs[fetch_index / VNIC_WQ_BUF_BLK_ENTRIES] + [fetch_index % VNIC_WQ_BUF_BLK_ENTRIES]; +} + +void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index, + unsigned int error_interrupt_enable, + unsigned int error_interrupt_offset) +{ + vnic_wq_init_start(wq, cq_index, 0, 0, + error_interrupt_enable, + error_interrupt_offset); } unsigned int vnic_wq_error_status(struct vnic_wq *wq) |