ionic: carry idev in ionic_cq struct
authorShannon Nelson <shannon.nelson@amd.com>
Wed, 6 Mar 2024 23:29:54 +0000 (15:29 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Mar 2024 11:54:34 +0000 (11:54 +0000)
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: 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>
drivers/net/ethernet/pensando/ionic/ionic_dev.c
drivers/net/ethernet/pensando/ionic/ionic_dev.h
drivers/net/ethernet/pensando/ionic/ionic_txrx.c

index 8c961689b7687d516a6acd101d9d744a5749b8d2..8744993371328684d19b7e930a67fa71eaccb44a 100644 (file)
@@ -629,6 +629,7 @@ int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq,
        cq->desc_size = desc_size;
        cq->tail_idx = 0;
        cq->done_color = 1;
+       cq->idev = &lif->ionic->idev;
 
        return 0;
 }
@@ -673,7 +674,6 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev,
                return -EINVAL;
 
        q->lif = lif;
-       q->idev = idev;
        q->index = index;
        q->num_descs = num_descs;
        q->desc_size = desc_size;
index e76db5647690eb78171b96ab86313a71d389436d..2a386e75571e335d4047be778e0816b567ed28f0 100644 (file)
@@ -240,7 +240,6 @@ struct ionic_queue {
        unsigned int max_sg_elems;
        u64 features;
        u64 drop;
-       struct ionic_dev *idev;
        unsigned int type;
        unsigned int hw_index;
        unsigned int hw_type;
@@ -296,6 +295,7 @@ struct ionic_cq {
        unsigned int desc_size;
        void *base;
        dma_addr_t base_pa;
+       struct ionic_dev *idev;
 } ____cacheline_aligned_in_smp;
 
 struct ionic;
index 269253d84ca7ed8527d804731ffe461021ee585f..af414707d614d8a6a1db4d7712037eb10739bc70 100644 (file)
@@ -948,14 +948,9 @@ int ionic_tx_napi(struct napi_struct *napi, int budget)
 {
        struct ionic_qcq *qcq = napi_to_qcq(napi);
        struct ionic_cq *cq = napi_to_cq(napi);
-       struct ionic_dev *idev;
-       struct ionic_lif *lif;
        u32 work_done = 0;
        u32 flags = 0;
 
-       lif = cq->bound_q->lif;
-       idev = &lif->ionic->idev;
-
        work_done = ionic_tx_cq_service(cq, budget);
 
        if (unlikely(!budget))
@@ -969,7 +964,7 @@ int ionic_tx_napi(struct napi_struct *napi, int budget)
 
        if (work_done || flags) {
                flags |= IONIC_INTR_CRED_RESET_COALESCE;
-               ionic_intr_credits(idev->intr_ctrl,
+               ionic_intr_credits(cq->idev->intr_ctrl,
                                   cq->bound_intr->index,
                                   work_done, flags);
        }
@@ -992,17 +987,12 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
 {
        struct ionic_qcq *qcq = napi_to_qcq(napi);
        struct ionic_cq *cq = napi_to_cq(napi);
-       struct ionic_dev *idev;
-       struct ionic_lif *lif;
        u32 work_done = 0;
        u32 flags = 0;
 
        if (unlikely(!budget))
                return budget;
 
-       lif = cq->bound_q->lif;
-       idev = &lif->ionic->idev;
-
        work_done = ionic_cq_service(cq, budget,
                                     ionic_rx_service, NULL, NULL);
 
@@ -1017,7 +1007,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
 
        if (work_done || flags) {
                flags |= IONIC_INTR_CRED_RESET_COALESCE;
-               ionic_intr_credits(idev->intr_ctrl,
+               ionic_intr_credits(cq->idev->intr_ctrl,
                                   cq->bound_intr->index,
                                   work_done, flags);
        }
@@ -1034,7 +1024,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
        struct ionic_cq *rxcq = napi_to_cq(napi);
        unsigned int qi = rxcq->bound_q->index;
        struct ionic_qcq *txqcq;
-       struct ionic_dev *idev;
        struct ionic_lif *lif;
        struct ionic_cq *txcq;
        bool resched = false;
@@ -1043,7 +1032,6 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
        u32 flags = 0;
 
        lif = rxcq->bound_q->lif;
-       idev = &lif->ionic->idev;
        txqcq = lif->txqcqs[qi];
        txcq = &lif->txqcqs[qi]->cq;
 
@@ -1066,7 +1054,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
 
        if (rx_work_done || flags) {
                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);
        }
 
@@ -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)
 {
-       struct ionic_dev *idev = &cq->lif->ionic->idev;
        u32 work_done;
 
        work_done = ionic_tx_cq_service(cq, cq->num_descs);
        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);
 }