ionic: remove the cq_info to save more memory
With a little simple math we don't need another struct array to find the completion structs, so we can remove the ionic_cq_info altogether. This doesn't really save anything in the ionic_cq since it gets padded out to the cacheline, but it does remove the parallel array allocation of 8 * num_descriptors, or about 8 Kbytes per queue in a default configuration. Suggested-by: Neel Patel <npatel2@amd.com> Reviewed-by: Brett Creeley <brett.creeley@amd.com> Signed-off-by: Shannon Nelson <shannon.nelson@amd.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
ae24a8f88b
commit
65e548f6b0
@@ -633,39 +633,20 @@ int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ionic_cq_map(struct ionic_cq *cq, void *base, dma_addr_t base_pa)
|
||||
{
|
||||
struct ionic_cq_info *cur;
|
||||
unsigned int i;
|
||||
|
||||
cq->base = base;
|
||||
cq->base_pa = base_pa;
|
||||
|
||||
for (i = 0, cur = cq->info; i < cq->num_descs; i++, cur++)
|
||||
cur->cq_desc = base + (i * cq->desc_size);
|
||||
}
|
||||
|
||||
void ionic_cq_bind(struct ionic_cq *cq, struct ionic_queue *q)
|
||||
{
|
||||
cq->bound_q = q;
|
||||
}
|
||||
|
||||
unsigned int ionic_cq_service(struct ionic_cq *cq, unsigned int work_to_do,
|
||||
ionic_cq_cb cb, ionic_cq_done_cb done_cb,
|
||||
void *done_arg)
|
||||
{
|
||||
struct ionic_cq_info *cq_info;
|
||||
unsigned int work_done = 0;
|
||||
|
||||
if (work_to_do == 0)
|
||||
return 0;
|
||||
|
||||
cq_info = &cq->info[cq->tail_idx];
|
||||
while (cb(cq, cq_info)) {
|
||||
while (cb(cq)) {
|
||||
if (cq->tail_idx == cq->num_descs - 1)
|
||||
cq->done_color = !cq->done_color;
|
||||
|
||||
cq->tail_idx = (cq->tail_idx + 1) & (cq->num_descs - 1);
|
||||
cq_info = &cq->info[cq->tail_idx];
|
||||
|
||||
if (++work_done >= work_to_do)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user