20 #include <linux/kernel.h>
21 #include <linux/errno.h>
22 #include <linux/types.h>
23 #include <linux/pci.h>
25 #include <linux/slab.h>
30 static int vnic_wq_alloc_bufs(
struct vnic_wq *wq)
39 for (i = 0; i < blks; i++) {
45 for (i = 0; i < blks; i++) {
88 unsigned int desc_count,
unsigned int desc_size)
97 pr_err(
"Failed to hook WQ[%d] resource\n", index);
107 err = vnic_wq_alloc_bufs(wq);
116 static void vnic_wq_init_start(
struct vnic_wq *wq,
unsigned int cq_index,
117 unsigned int fetch_index,
unsigned int posted_index,
118 unsigned int error_interrupt_enable,
119 unsigned int error_interrupt_offset)
122 unsigned int count = wq->
ring.desc_count;
130 iowrite32(error_interrupt_enable, &wq->
ctrl->error_interrupt_enable);
131 iowrite32(error_interrupt_offset, &wq->
ctrl->error_interrupt_offset);
140 unsigned int error_interrupt_enable,
141 unsigned int error_interrupt_offset)
143 vnic_wq_init_start(wq, cq_index, 0, 0,
144 error_interrupt_enable,
145 error_interrupt_offset);
165 for (wait = 0; wait < 1000; wait++) {
185 (*buf_clean)(wq,
buf);
187 buf = wq->to_clean = buf->
next;
188 wq->ring.desc_avail++;