aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/enic/vnic_rq.c
diff options
context:
space:
mode:
authorScott Feldman <scofeldm@cisco.com>2009-09-03 13:02:45 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-03 23:19:25 -0400
commit6fdfa97073a2bcbb60d900654c612b2ff09b9cb7 (patch)
tree3297813813e0a1a82664e13b52cbc79ecb36ae92 /drivers/net/enic/vnic_rq.c
parent491598a44f12fe8b862ab4123de1a1ffe9b86832 (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_rq.c')
-rw-r--r--drivers/net/enic/vnic_rq.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/net/enic/vnic_rq.c b/drivers/net/enic/vnic_rq.c
index 9365e63e821a..75583978a5e5 100644
--- a/drivers/net/enic/vnic_rq.c
+++ b/drivers/net/enic/vnic_rq.c
@@ -62,7 +62,6 @@ static int vnic_rq_alloc_bufs(struct vnic_rq *rq)
62 } 62 }
63 63
64 rq->to_use = rq->to_clean = rq->bufs[0]; 64 rq->to_use = rq->to_clean = rq->bufs[0];
65 rq->buf_index = 0;
66 65
67 return 0; 66 return 0;
68} 67}
@@ -113,12 +112,12 @@ int vnic_rq_alloc(struct vnic_dev *vdev, struct vnic_rq *rq, unsigned int index,
113 return 0; 112 return 0;
114} 113}
115 114
116void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index, 115void vnic_rq_init_start(struct vnic_rq *rq, unsigned int cq_index,
116 unsigned int fetch_index, unsigned int posted_index,
117 unsigned int error_interrupt_enable, 117 unsigned int error_interrupt_enable,
118 unsigned int error_interrupt_offset) 118 unsigned int error_interrupt_offset)
119{ 119{
120 u64 paddr; 120 u64 paddr;
121 u32 fetch_index;
122 121
123 paddr = (u64)rq->ring.base_addr | VNIC_PADDR_TARGET; 122 paddr = (u64)rq->ring.base_addr | VNIC_PADDR_TARGET;
124 writeq(paddr, &rq->ctrl->ring_base); 123 writeq(paddr, &rq->ctrl->ring_base);
@@ -128,15 +127,27 @@ void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index,
128 iowrite32(error_interrupt_offset, &rq->ctrl->error_interrupt_offset); 127 iowrite32(error_interrupt_offset, &rq->ctrl->error_interrupt_offset);
129 iowrite32(0, &rq->ctrl->dropped_packet_count); 128 iowrite32(0, &rq->ctrl->dropped_packet_count);
130 iowrite32(0, &rq->ctrl->error_status); 129 iowrite32(0, &rq->ctrl->error_status);
130 iowrite32(fetch_index, &rq->ctrl->fetch_index);
131 iowrite32(posted_index, &rq->ctrl->posted_index);
131 132
132 /* Use current fetch_index as the ring starting point */
133 fetch_index = ioread32(&rq->ctrl->fetch_index);
134 rq->to_use = rq->to_clean = 133 rq->to_use = rq->to_clean =
135 &rq->bufs[fetch_index / VNIC_RQ_BUF_BLK_ENTRIES] 134 &rq->bufs[fetch_index / VNIC_RQ_BUF_BLK_ENTRIES]
136 [fetch_index % VNIC_RQ_BUF_BLK_ENTRIES]; 135 [fetch_index % VNIC_RQ_BUF_BLK_ENTRIES];
137 iowrite32(fetch_index, &rq->ctrl->posted_index); 136}
137
138void vnic_rq_init(struct vnic_rq *rq, unsigned int cq_index,
139 unsigned int error_interrupt_enable,
140 unsigned int error_interrupt_offset)
141{
142 u32 fetch_index;
138 143
139 rq->buf_index = 0; 144 /* Use current fetch_index as the ring starting point */
145 fetch_index = ioread32(&rq->ctrl->fetch_index);
146
147 vnic_rq_init_start(rq, cq_index,
148 fetch_index, fetch_index,
149 error_interrupt_enable,
150 error_interrupt_offset);
140} 151}
141 152
142unsigned int vnic_rq_error_status(struct vnic_rq *rq) 153unsigned int vnic_rq_error_status(struct vnic_rq *rq)
@@ -192,8 +203,6 @@ void vnic_rq_clean(struct vnic_rq *rq,
192 [fetch_index % VNIC_RQ_BUF_BLK_ENTRIES]; 203 [fetch_index % VNIC_RQ_BUF_BLK_ENTRIES];
193 iowrite32(fetch_index, &rq->ctrl->posted_index); 204 iowrite32(fetch_index, &rq->ctrl->posted_index);
194 205
195 rq->buf_index = 0;
196
197 vnic_dev_clear_desc_ring(&rq->ring); 206 vnic_dev_clear_desc_ring(&rq->ring);
198} 207}
199 208