diff options
author | Shannon Nelson <shannon.nelson@amd.com> | 2024-03-06 15:29:51 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-03-08 11:54:34 +0000 |
commit | 4dcd4575bfb17d0f6e3d53e2f217a0414518a20c (patch) | |
tree | 3d8b5153916b47fd81b9ba8b71b665abc027c50d /drivers/net/ethernet/pensando/ionic/ionic_main.c | |
parent | 65e548f6b0ffc4222a99feda8a033a2a9fb9f3e7 (diff) |
ionic: use specialized desc info structs
Make desc_info structure specific to the queue type, which
allows us to cut down the Rx and AdminQ descriptor sizes by
not including all the fields needed for the Tx desriptors.
Before:
struct ionic_desc_info {
/* size: 464, cachelines: 8, members: 6 */
After:
struct ionic_tx_desc_info {
/* size: 464, cachelines: 8, members: 6 */
struct ionic_rx_desc_info {
/* size: 224, cachelines: 4, members: 2 */
struct ionic_admin_desc_info {
/* size: 8, cachelines: 1, members: 1 */
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>
Diffstat (limited to 'drivers/net/ethernet/pensando/ionic/ionic_main.c')
-rw-r--r-- | drivers/net/ethernet/pensando/ionic/ionic_main.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c index 2c092858bc0d..d248f725ef44 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c @@ -190,7 +190,7 @@ static const char *ionic_opcode_to_str(enum ionic_cmd_opcode opcode) static void ionic_adminq_flush(struct ionic_lif *lif) { - struct ionic_desc_info *desc_info; + struct ionic_admin_desc_info *desc_info; struct ionic_admin_cmd *desc; unsigned long irqflags; struct ionic_queue *q; @@ -205,9 +205,9 @@ static void ionic_adminq_flush(struct ionic_lif *lif) while (q->tail_idx != q->head_idx) { desc = &q->adminq[q->tail_idx]; - desc_info = &q->info[q->tail_idx]; + desc_info = &q->admin_info[q->tail_idx]; memset(desc, 0, sizeof(union ionic_adminq_cmd)); - desc_info->arg = NULL; + desc_info->ctx = NULL; q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); } spin_unlock_irqrestore(&lif->adminq_lock, irqflags); @@ -248,10 +248,10 @@ static int ionic_adminq_check_err(struct ionic_lif *lif, } static void ionic_adminq_clean(struct ionic_queue *q, - struct ionic_desc_info *desc_info, + struct ionic_admin_desc_info *desc_info, struct ionic_admin_comp *comp) { - struct ionic_admin_ctx *ctx = desc_info->arg; + struct ionic_admin_ctx *ctx = desc_info->ctx; if (!ctx) return; @@ -277,7 +277,7 @@ bool ionic_notifyq_service(struct ionic_cq *cq) comp = &((union ionic_notifyq_comp *)cq->base)[cq->tail_idx]; q = cq->bound_q; - lif = q->info[0].arg; + lif = q->admin_info[0].ctx; netdev = lif->netdev; eid = le64_to_cpu(comp->event.eid); @@ -320,8 +320,8 @@ bool ionic_notifyq_service(struct ionic_cq *cq) bool ionic_adminq_service(struct ionic_cq *cq) { + struct ionic_admin_desc_info *desc_info; struct ionic_queue *q = cq->bound_q; - struct ionic_desc_info *desc_info; struct ionic_admin_comp *comp; u16 index; @@ -335,12 +335,12 @@ bool ionic_adminq_service(struct ionic_cq *cq) return false; do { - desc_info = &q->info[q->tail_idx]; + desc_info = &q->admin_info[q->tail_idx]; index = q->tail_idx; q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); - if (likely(desc_info->arg)) + if (likely(desc_info->ctx)) ionic_adminq_clean(q, desc_info, comp); - desc_info->arg = NULL; + desc_info->ctx = NULL; } while (index != le16_to_cpu(comp->comp_index)); return true; @@ -377,6 +377,7 @@ bool ionic_adminq_poke_doorbell(struct ionic_queue *q) int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) { + struct ionic_admin_desc_info *desc_info; struct ionic_admin_cmd *desc; unsigned long irqflags; struct ionic_queue *q; @@ -399,6 +400,9 @@ int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) if (err) goto err_out; + desc_info = &q->admin_info[q->head_idx]; + desc_info->ctx = ctx; + desc = &q->adminq[q->head_idx]; memcpy(desc, &ctx->cmd, sizeof(ctx->cmd)); @@ -406,7 +410,7 @@ int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) dynamic_hex_dump("cmd ", DUMP_PREFIX_OFFSET, 16, 1, &ctx->cmd, sizeof(ctx->cmd), true); - ionic_q_post(q, true, ctx); + ionic_q_post(q, true); err_out: spin_unlock_irqrestore(&lif->adminq_lock, irqflags); |