From patchwork Mon Jan 18 20:34:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 86821 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 98992A0A03; Mon, 18 Jan 2021 21:35:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 83DE3140E2A; Mon, 18 Jan 2021 21:35:38 +0100 (CET) Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by mails.dpdk.org (Postfix) with ESMTP id 65A6C140E25 for ; Mon, 18 Jan 2021 21:35:35 +0100 (CET) Received: by mail-pj1-f41.google.com with SMTP id g15so6312069pjd.2 for ; Mon, 18 Jan 2021 12:35:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B4UI11kE2DNoQedH08fP0vqG/hiVRwSZOAYmeDV4EOk=; b=ZNY31uba3qlHeZWIrRTjitJjW7r2Ys5rfBCTaYJLE6vhUyjPsuG+xu+SDwdcYf3ERL 54MwYRxYd3lG3LOdRHxFs6wN4q+nq+Ln2DdctCI8pzfPe6WmOtQIVkCZtqhtkKvbYabz IbKVfc/SCDnRuxavn74diKSg16NQl0lRoh4Pi8zJ/bdDJrspxghnxuiw0mtvxG5K/3LH UUp1y/eebLX7Jp76Qf7ALPsV8tDjJE4LRKHZi10uRYzKaKQDSVtha1yd1NHhoCVHRP+v iczmblbf18OIKIVPHVEGi4i+VcWs+WzKUzaVNX0Hi6z4IPI85mIy9eLFIusqXpZpljiw 6taQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B4UI11kE2DNoQedH08fP0vqG/hiVRwSZOAYmeDV4EOk=; b=ALNQ2/R4+WdY8idpOZecbL9u3Ft935HlaxRQJ0a/OFjKim3XnQgBwrPlKhx8qwNjKh D485uWwVJU0KnEm9/8SP1PpFkrfsBG4WVFghl+kASnWpjTpyU1YU/uyWT/0YCS5ez98Z oNWzhkIFbX0kYJWNQtqLNwjZMrUZbsi/6jNVcfOJ0/LWtjvjyjUQdXOb89UuIzql61Bt wpfAToY4GAyH8zrqYVZWaZD9JWY/q3s/Qc9R85ZcRMK0qUMPCRpwkHYbzuaVGhNLkVSY SoxJ9XUX7FJqwDWVHapH9trdlo1WRJxWW76Cbx7B4VgOXO5OJ5+CR7eheSW2RZLHQ8cg CM2w== X-Gm-Message-State: AOAM533mksP3j3rJB1Gk9KXgFObgozMy/WECdE2hqAlFu0GCH/alDKjf OOeGFIpNvbbNzdPfvuhBi0LuSUbSvutl4A== X-Google-Smtp-Source: ABdhPJwhAGKdSHASgbNTy2w5x8yHRbIQzxxnkf9lMMN5zn8HXnokS+y2adH5FdAmP8weCasjPlcUQg== X-Received: by 2002:a17:90a:9603:: with SMTP id v3mr1172794pjo.128.1611002134253; Mon, 18 Jan 2021 12:35:34 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id g201sm795160pfb.81.2021.01.18.12.35.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jan 2021 12:35:33 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Mon, 18 Jan 2021 12:34:56 -0800 Message-Id: <20210118203508.1332-2-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210118203508.1332-1-aboyer@pensando.io> References: <20210118203508.1332-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH 01/13] net/ionic: strip out unneeded interrupt code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Only the NotifyQ uses an interrupt, so simplify the other queues. Simplify ionic_dev_cmd_adminq_init() and ionic_cq_init(). Move ionic_intr_alloc() into ionic_notify_qcq_alloc(). Create ionic_lif_notifyq_deinit(). Simplify ionic_lif_qcq_deinit(). Remove unneeded flags and defines. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.c | 8 +-- drivers/net/ionic/ionic_dev.h | 12 ++-- drivers/net/ionic/ionic_lif.c | 116 ++++++++++++++++------------------ drivers/net/ionic/ionic_lif.h | 2 - 4 files changed, 59 insertions(+), 79 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index 4b5e24f98c..3507d4166f 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -323,9 +323,7 @@ ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr, } void -ionic_dev_cmd_adminq_init(struct ionic_dev *idev, - struct ionic_qcq *qcq, - uint16_t intr_index) +ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq) { struct ionic_queue *q = &qcq->q; struct ionic_cq *cq = &qcq->cq; @@ -335,7 +333,7 @@ ionic_dev_cmd_adminq_init(struct ionic_dev *idev, .q_init.type = q->type, .q_init.index = q->index, .q_init.flags = IONIC_QINIT_F_ENA, - .q_init.intr_index = intr_index, + .q_init.intr_index = IONIC_INTR_NONE, .q_init.ring_size = rte_log2_u32(q->num_descs), .q_init.ring_base = q->base_pa, .q_init.cq_ring_base = cq->base_pa, @@ -348,7 +346,6 @@ ionic_dev_cmd_adminq_init(struct ionic_dev *idev, int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq, - struct ionic_intr_info *intr, uint32_t num_descs, size_t desc_size) { if (desc_size == 0) { @@ -365,7 +362,6 @@ ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq, } cq->lif = lif; - cq->bound_intr = intr; cq->num_descs = num_descs; cq->desc_size = desc_size; cq->tail_idx = 0; diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 6588a373fc..6ee2918959 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -165,11 +165,9 @@ struct ionic_queue { struct ionic_doorbell __iomem *db; }; -#define IONIC_INTR_INDEX_NOT_ASSIGNED (-1) -#define IONIC_INTR_NAME_MAX_SZ (32) +#define IONIC_INTR_NONE (-1) struct ionic_intr_info { - char name[IONIC_INTR_NAME_MAX_SZ]; int index; uint32_t vector; struct ionic_intr __iomem *ctrl; @@ -184,7 +182,6 @@ struct ionic_cq { bool done_color; void *base; rte_iova_t base_pa; - struct ionic_intr_info *bound_intr; }; /** ionic_admin_ctx - Admin command context. @@ -234,15 +231,14 @@ void ionic_dev_cmd_lif_identify(struct ionic_dev *idev, uint8_t type, uint8_t ver); void ionic_dev_cmd_lif_init(struct ionic_dev *idev, rte_iova_t addr); void ionic_dev_cmd_lif_reset(struct ionic_dev *idev); -void ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq, - uint16_t intr_index); + +void ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq); struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif, struct ionic_queue *q); int ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq, - struct ionic_intr_info *intr, uint32_t num_descs, - size_t desc_size); + uint32_t num_descs, size_t desc_size); void ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa); void ionic_cq_bind(struct ionic_cq *cq, struct ionic_queue *q); typedef bool (*ionic_cq_cb)(struct ionic_cq *cq, uint32_t cq_desc_index, diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index f39b54e8ef..856e977186 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -20,7 +20,6 @@ ionic_qcq_enable(struct ionic_qcq *qcq) { struct ionic_queue *q = &qcq->q; struct ionic_lif *lif = q->lif; - struct ionic_dev *idev = &lif->adapter->idev; struct ionic_admin_ctx ctx = { .pending_work = true, .cmd.q_control = { @@ -31,11 +30,6 @@ ionic_qcq_enable(struct ionic_qcq *qcq) }, }; - if (qcq->flags & IONIC_QCQ_F_INTR) { - ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, - IONIC_INTR_MASK_CLEAR); - } - return ionic_adminq_post_wait(lif, &ctx); } @@ -44,7 +38,6 @@ ionic_qcq_disable(struct ionic_qcq *qcq) { struct ionic_queue *q = &qcq->q; struct ionic_lif *lif = q->lif; - struct ionic_dev *idev = &lif->adapter->idev; struct ionic_admin_ctx ctx = { .pending_work = true, .cmd.q_control = { @@ -55,11 +48,6 @@ ionic_qcq_disable(struct ionic_qcq *qcq) }, }; - if (qcq->flags & IONIC_QCQ_F_INTR) { - ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, - IONIC_INTR_MASK_SET); - } - return ionic_adminq_post_wait(lif, &ctx); } @@ -584,7 +572,7 @@ ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr) void ionic_intr_free(struct ionic_lif *lif, struct ionic_intr_info *intr) { - if (intr->index != IONIC_INTR_INDEX_NOT_ASSIGNED) + if (intr->index != IONIC_INTR_NONE) lif->adapter->intrs[intr->index] = false; } @@ -640,7 +628,8 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, new->q.info = rte_zmalloc("ionic", sizeof(*new->q.info) * num_descs, 0); if (!new->q.info) { IONIC_PRINT(ERR, "Cannot allocate queue info"); - return -ENOMEM; + err = -ENOMEM; + goto err_out_free_qcq; } new->q.type = type; @@ -649,25 +638,13 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, desc_size, sg_desc_size); if (err) { IONIC_PRINT(ERR, "Queue initialization failed"); - return err; + goto err_out_free_info; } - if (flags & IONIC_QCQ_F_INTR) { - err = ionic_intr_alloc(lif, &new->intr); - if (err) - return err; - - ionic_intr_mask_assert(idev->intr_ctrl, new->intr.index, - IONIC_INTR_MASK_SET); - } else { - new->intr.index = IONIC_INTR_INDEX_NOT_ASSIGNED; - } - - err = ionic_cq_init(lif, &new->cq, &new->intr, - num_descs, cq_desc_size); + err = ionic_cq_init(lif, &new->cq, num_descs, cq_desc_size); if (err) { IONIC_PRINT(ERR, "Completion queue initialization failed"); - goto err_out_free_intr; + goto err_out_free_info; } new->base_z = rte_eth_dma_zone_reserve(lif->eth_dev, @@ -677,7 +654,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, if (!new->base_z) { IONIC_PRINT(ERR, "Cannot reserve queue DMA memory"); err = -ENOMEM; - goto err_out_free_intr; + goto err_out_free_info; } new->base = new->base_z->addr; @@ -709,9 +686,10 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, return 0; -err_out_free_intr: - if (flags & IONIC_QCQ_F_INTR) - ionic_intr_free(lif, &new->intr); +err_out_free_info: + rte_free(new->q.info); +err_out_free_qcq: + rte_free(new); return err; } @@ -800,21 +778,32 @@ ionic_admin_qcq_alloc(struct ionic_lif *lif) static int ionic_notify_qcq_alloc(struct ionic_lif *lif) { - uint32_t flags; + struct ionic_qcq *nqcq; + struct ionic_dev *idev = &lif->adapter->idev; + uint32_t flags = 0; int err = -ENOMEM; - flags = IONIC_QCQ_F_NOTIFYQ | IONIC_QCQ_F_INTR; - err = ionic_qcq_alloc(lif, IONIC_QTYPE_NOTIFYQ, 0, "notify", flags, IONIC_NOTIFYQ_LENGTH, sizeof(struct ionic_notifyq_cmd), sizeof(union ionic_notifyq_comp), 0, - &lif->notifyqcq); + &nqcq); if (err) return err; + err = ionic_intr_alloc(lif, &nqcq->intr); + if (err) { + ionic_qcq_free(nqcq); + return err; + } + + ionic_intr_mask_assert(idev->intr_ctrl, nqcq->intr.index, + IONIC_INTR_MASK_SET); + + lif->notifyqcq = nqcq; + return 0; } @@ -1040,30 +1029,36 @@ ionic_lif_rss_teardown(struct ionic_lif *lif) } static void -ionic_lif_qcq_deinit(struct ionic_lif *lif, struct ionic_qcq *qcq) +ionic_lif_qcq_deinit(struct ionic_qcq *qcq) { - struct ionic_dev *idev = &lif->adapter->idev; - - if (!(qcq->flags & IONIC_QCQ_F_INITED)) - return; - - if (qcq->flags & IONIC_QCQ_F_INTR) - ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, - IONIC_INTR_MASK_SET); - qcq->flags &= ~IONIC_QCQ_F_INITED; } void ionic_lif_txq_deinit(struct ionic_qcq *qcq) { - ionic_lif_qcq_deinit(qcq->lif, qcq); + ionic_lif_qcq_deinit(qcq); } void ionic_lif_rxq_deinit(struct ionic_qcq *qcq) { - ionic_lif_qcq_deinit(qcq->lif, qcq); + ionic_lif_qcq_deinit(qcq); +} + +static void +ionic_lif_notifyq_deinit(struct ionic_lif *lif) +{ + struct ionic_qcq *nqcq = lif->notifyqcq; + struct ionic_dev *idev = &lif->adapter->idev; + + if (!(nqcq->flags & IONIC_QCQ_F_INITED)) + return; + + ionic_intr_mask(idev->intr_ctrl, nqcq->intr.index, + IONIC_INTR_MASK_SET); + + nqcq->flags &= ~IONIC_QCQ_F_INITED; } bool @@ -1227,7 +1222,7 @@ ionic_lif_adminq_init(struct ionic_lif *lif) struct ionic_q_init_comp comp; int err; - ionic_dev_cmd_adminq_init(idev, qcq, qcq->intr.index); + ionic_dev_cmd_adminq_init(idev, qcq); err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); if (err) return err; @@ -1242,10 +1237,6 @@ ionic_lif_adminq_init(struct ionic_lif *lif) IONIC_PRINT(DEBUG, "adminq->hw_index %d", q->hw_index); IONIC_PRINT(DEBUG, "adminq->db %p", q->db); - if (qcq->flags & IONIC_QCQ_F_INTR) - ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, - IONIC_INTR_MASK_CLEAR); - qcq->flags |= IONIC_QCQ_F_INITED; return 0; @@ -1292,9 +1283,8 @@ ionic_lif_notifyq_init(struct ionic_lif *lif) IONIC_PRINT(DEBUG, "notifyq->hw_index %d", q->hw_index); IONIC_PRINT(DEBUG, "notifyq->db %p", q->db); - if (qcq->flags & IONIC_QCQ_F_INTR) - ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, - IONIC_INTR_MASK_CLEAR); + ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, + IONIC_INTR_MASK_CLEAR); qcq->flags |= IONIC_QCQ_F_INITED; @@ -1372,7 +1362,7 @@ ionic_lif_txq_init(struct ionic_qcq *qcq) .type = q->type, .index = q->index, .flags = IONIC_QINIT_F_SG | IONIC_QINIT_F_ENA, - .intr_index = cq->bound_intr->index, + .intr_index = IONIC_INTR_NONE, .ring_size = rte_log2_u32(q->num_descs), .ring_base = q->base_pa, .cq_ring_base = cq->base_pa, @@ -1418,7 +1408,7 @@ ionic_lif_rxq_init(struct ionic_qcq *qcq) .type = q->type, .index = q->index, .flags = IONIC_QINIT_F_SG | IONIC_QINIT_F_ENA, - .intr_index = cq->bound_intr->index, + .intr_index = IONIC_INTR_NONE, .ring_size = rte_log2_u32(q->num_descs), .ring_base = q->base_pa, .cq_ring_base = cq->base_pa, @@ -1544,10 +1534,10 @@ ionic_lif_init(struct ionic_lif *lif) ionic_rx_filters_deinit(lif); err_out_notifyq_deinit: - ionic_lif_qcq_deinit(lif, lif->notifyqcq); + ionic_lif_notifyq_deinit(lif); err_out_adminq_deinit: - ionic_lif_qcq_deinit(lif, lif->adminqcq); + ionic_lif_qcq_deinit(lif->adminqcq); return err; } @@ -1560,8 +1550,8 @@ ionic_lif_deinit(struct ionic_lif *lif) ionic_rx_filters_deinit(lif); ionic_lif_rss_teardown(lif); - ionic_lif_qcq_deinit(lif, lif->notifyqcq); - ionic_lif_qcq_deinit(lif, lif->adminqcq); + ionic_lif_notifyq_deinit(lif); + ionic_lif_qcq_deinit(lif->adminqcq); lif->state &= ~IONIC_LIF_F_INITED; } diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 4f48845eb9..d245c6da01 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -48,8 +48,6 @@ struct ionic_rx_stats { #define IONIC_QCQ_F_INITED BIT(0) #define IONIC_QCQ_F_SG BIT(1) -#define IONIC_QCQ_F_INTR BIT(2) -#define IONIC_QCQ_F_NOTIFYQ BIT(3) #define IONIC_QCQ_F_DEFERRED BIT(4) /* Queue / Completion Queue */