diff options
author | Scott Feldman <scofeldm@cisco.com> | 2009-09-03 13:02:45 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-03 23:19:25 -0400 |
commit | 6fdfa97073a2bcbb60d900654c612b2ff09b9cb7 (patch) | |
tree | 3297813813e0a1a82664e13b52cbc79ecb36ae92 /drivers/net/enic/vnic_wq.c | |
parent | 491598a44f12fe8b862ab4123de1a1ffe9b86832 (diff) |
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 a576d04708ef..d2e00e51b7b5 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, | |||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index, | 115 | void vnic_wq_init_start(struct vnic_wq *wq, unsigned int cq_index, |
116 | unsigned int fetch_index, unsigned int posted_index, | ||
116 | unsigned int error_interrupt_enable, | 117 | unsigned int error_interrupt_enable, |
117 | unsigned int error_interrupt_offset) | 118 | unsigned int error_interrupt_offset) |
118 | { | 119 | { |
@@ -121,12 +122,25 @@ void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index, | |||
121 | paddr = (u64)wq->ring.base_addr | VNIC_PADDR_TARGET; | 122 | paddr = (u64)wq->ring.base_addr | VNIC_PADDR_TARGET; |
122 | writeq(paddr, &wq->ctrl->ring_base); | 123 | writeq(paddr, &wq->ctrl->ring_base); |
123 | iowrite32(wq->ring.desc_count, &wq->ctrl->ring_size); | 124 | iowrite32(wq->ring.desc_count, &wq->ctrl->ring_size); |
124 | iowrite32(0, &wq->ctrl->fetch_index); | 125 | iowrite32(fetch_index, &wq->ctrl->fetch_index); |
125 | iowrite32(0, &wq->ctrl->posted_index); | 126 | iowrite32(posted_index, &wq->ctrl->posted_index); |
126 | iowrite32(cq_index, &wq->ctrl->cq_index); | 127 | iowrite32(cq_index, &wq->ctrl->cq_index); |
127 | iowrite32(error_interrupt_enable, &wq->ctrl->error_interrupt_enable); | 128 | iowrite32(error_interrupt_enable, &wq->ctrl->error_interrupt_enable); |
128 | iowrite32(error_interrupt_offset, &wq->ctrl->error_interrupt_offset); | 129 | iowrite32(error_interrupt_offset, &wq->ctrl->error_interrupt_offset); |
129 | iowrite32(0, &wq->ctrl->error_status); | 130 | iowrite32(0, &wq->ctrl->error_status); |
131 | |||
132 | wq->to_use = wq->to_clean = | ||
133 | &wq->bufs[fetch_index / VNIC_WQ_BUF_BLK_ENTRIES] | ||
134 | [fetch_index % VNIC_WQ_BUF_BLK_ENTRIES]; | ||
135 | } | ||
136 | |||
137 | void vnic_wq_init(struct vnic_wq *wq, unsigned int cq_index, | ||
138 | unsigned int error_interrupt_enable, | ||
139 | unsigned int error_interrupt_offset) | ||
140 | { | ||
141 | vnic_wq_init_start(wq, cq_index, 0, 0, | ||
142 | error_interrupt_enable, | ||
143 | error_interrupt_offset); | ||
130 | } | 144 | } |
131 | 145 | ||
132 | unsigned int vnic_wq_error_status(struct vnic_wq *wq) | 146 | unsigned int vnic_wq_error_status(struct vnic_wq *wq) |