Commit 01658924 authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller

ionic: carry idev in ionic_cq struct

Remove the idev field from ionic_queue, which saves us a
bit of space, and add it into ionic_cq where there's room
within some cacheline padding.  Use this pointer rather
than doing a multi level reference from lif->ionic.
Suggested-by: default avatarNeel Patel <npatel2@amd.com>
Reviewed-by: default avatarBrett Creeley <brett.creeley@amd.com>
Signed-off-by: default avatarShannon Nelson <shannon.nelson@amd.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 36a47c90
...@@ -629,6 +629,7 @@ int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq, ...@@ -629,6 +629,7 @@ int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
cq->desc_size = desc_size; cq->desc_size = desc_size;
cq->tail_idx = 0; cq->tail_idx = 0;
cq->done_color = 1; cq->done_color = 1;
cq->idev = &lif->ionic->idev;
return 0; return 0;
} }
...@@ -673,7 +674,6 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev, ...@@ -673,7 +674,6 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev,
return -EINVAL; return -EINVAL;
q->lif = lif; q->lif = lif;
q->idev = idev;
q->index = index; q->index = index;
q->num_descs = num_descs; q->num_descs = num_descs;
q->desc_size = desc_size; q->desc_size = desc_size;
......
...@@ -240,7 +240,6 @@ struct ionic_queue { ...@@ -240,7 +240,6 @@ struct ionic_queue {
unsigned int max_sg_elems; unsigned int max_sg_elems;
u64 features; u64 features;
u64 drop; u64 drop;
struct ionic_dev *idev;
unsigned int type; unsigned int type;
unsigned int hw_index; unsigned int hw_index;
unsigned int hw_type; unsigned int hw_type;
...@@ -296,6 +295,7 @@ struct ionic_cq { ...@@ -296,6 +295,7 @@ struct ionic_cq {
unsigned int desc_size; unsigned int desc_size;
void *base; void *base;
dma_addr_t base_pa; dma_addr_t base_pa;
struct ionic_dev *idev;
} ____cacheline_aligned_in_smp; } ____cacheline_aligned_in_smp;
struct ionic; struct ionic;
......
...@@ -948,14 +948,9 @@ int ionic_tx_napi(struct napi_struct *napi, int budget) ...@@ -948,14 +948,9 @@ int ionic_tx_napi(struct napi_struct *napi, int budget)
{ {
struct ionic_qcq *qcq = napi_to_qcq(napi); struct ionic_qcq *qcq = napi_to_qcq(napi);
struct ionic_cq *cq = napi_to_cq(napi); struct ionic_cq *cq = napi_to_cq(napi);
struct ionic_dev *idev;
struct ionic_lif *lif;
u32 work_done = 0; u32 work_done = 0;
u32 flags = 0; u32 flags = 0;
lif = cq->bound_q->lif;
idev = &lif->ionic->idev;
work_done = ionic_tx_cq_service(cq, budget); work_done = ionic_tx_cq_service(cq, budget);
if (unlikely(!budget)) if (unlikely(!budget))
...@@ -969,7 +964,7 @@ int ionic_tx_napi(struct napi_struct *napi, int budget) ...@@ -969,7 +964,7 @@ int ionic_tx_napi(struct napi_struct *napi, int budget)
if (work_done || flags) { if (work_done || flags) {
flags |= IONIC_INTR_CRED_RESET_COALESCE; flags |= IONIC_INTR_CRED_RESET_COALESCE;
ionic_intr_credits(idev->intr_ctrl, ionic_intr_credits(cq->idev->intr_ctrl,
cq->bound_intr->index, cq->bound_intr->index,
work_done, flags); work_done, flags);
} }
...@@ -992,17 +987,12 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) ...@@ -992,17 +987,12 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
{ {
struct ionic_qcq *qcq = napi_to_qcq(napi); struct ionic_qcq *qcq = napi_to_qcq(napi);
struct ionic_cq *cq = napi_to_cq(napi); struct ionic_cq *cq = napi_to_cq(napi);
struct ionic_dev *idev;
struct ionic_lif *lif;
u32 work_done = 0; u32 work_done = 0;
u32 flags = 0; u32 flags = 0;
if (unlikely(!budget)) if (unlikely(!budget))
return budget; return budget;
lif = cq->bound_q->lif;
idev = &lif->ionic->idev;
work_done = ionic_cq_service(cq, budget, work_done = ionic_cq_service(cq, budget,
ionic_rx_service, NULL, NULL); ionic_rx_service, NULL, NULL);
...@@ -1017,7 +1007,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) ...@@ -1017,7 +1007,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
if (work_done || flags) { if (work_done || flags) {
flags |= IONIC_INTR_CRED_RESET_COALESCE; flags |= IONIC_INTR_CRED_RESET_COALESCE;
ionic_intr_credits(idev->intr_ctrl, ionic_intr_credits(cq->idev->intr_ctrl,
cq->bound_intr->index, cq->bound_intr->index,
work_done, flags); work_done, flags);
} }
...@@ -1034,7 +1024,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) ...@@ -1034,7 +1024,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
struct ionic_cq *rxcq = napi_to_cq(napi); struct ionic_cq *rxcq = napi_to_cq(napi);
unsigned int qi = rxcq->bound_q->index; unsigned int qi = rxcq->bound_q->index;
struct ionic_qcq *txqcq; struct ionic_qcq *txqcq;
struct ionic_dev *idev;
struct ionic_lif *lif; struct ionic_lif *lif;
struct ionic_cq *txcq; struct ionic_cq *txcq;
bool resched = false; bool resched = false;
...@@ -1043,7 +1032,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) ...@@ -1043,7 +1032,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
u32 flags = 0; u32 flags = 0;
lif = rxcq->bound_q->lif; lif = rxcq->bound_q->lif;
idev = &lif->ionic->idev;
txqcq = lif->txqcqs[qi]; txqcq = lif->txqcqs[qi];
txcq = &lif->txqcqs[qi]->cq; txcq = &lif->txqcqs[qi]->cq;
...@@ -1066,7 +1054,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) ...@@ -1066,7 +1054,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
if (rx_work_done || flags) { if (rx_work_done || flags) {
flags |= IONIC_INTR_CRED_RESET_COALESCE; flags |= IONIC_INTR_CRED_RESET_COALESCE;
ionic_intr_credits(idev->intr_ctrl, rxcq->bound_intr->index, ionic_intr_credits(rxcq->idev->intr_ctrl, rxcq->bound_intr->index,
tx_work_done + rx_work_done, flags); tx_work_done + rx_work_done, flags);
} }
...@@ -1310,12 +1298,11 @@ unsigned int ionic_tx_cq_service(struct ionic_cq *cq, unsigned int work_to_do) ...@@ -1310,12 +1298,11 @@ unsigned int ionic_tx_cq_service(struct ionic_cq *cq, unsigned int work_to_do)
void ionic_tx_flush(struct ionic_cq *cq) void ionic_tx_flush(struct ionic_cq *cq)
{ {
struct ionic_dev *idev = &cq->lif->ionic->idev;
u32 work_done; u32 work_done;
work_done = ionic_tx_cq_service(cq, cq->num_descs); work_done = ionic_tx_cq_service(cq, cq->num_descs);
if (work_done) if (work_done)
ionic_intr_credits(idev->intr_ctrl, cq->bound_intr->index, ionic_intr_credits(cq->idev->intr_ctrl, cq->bound_intr->index,
work_done, IONIC_INTR_CRED_RESET_COALESCE); work_done, IONIC_INTR_CRED_RESET_COALESCE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment