From patchwork Tue Feb 16 20:35:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87940 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 C4E98A054D; Tue, 16 Feb 2021 21:35:55 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C848B160795; Tue, 16 Feb 2021 21:35:52 +0100 (CET) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id 37161160795 for ; Tue, 16 Feb 2021 21:35:51 +0100 (CET) Received: by mail-pg1-f172.google.com with SMTP id o63so6989836pgo.6 for ; Tue, 16 Feb 2021 12:35:51 -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 :in-reply-to:references; bh=csVYXIbKUE93u08l6RzyXGyxicFBEJweaqPygffB038=; b=vYUqAWSC3DkIVcWOVOmJkTHFej9dncpnH5YiKEVYWrc1HhfI1suPljaG7DVJzHPC1i vVIJisC9gj0PrPwwFSroyvb9v6vu30TQ7GFm85Xxaj6tdaNB4YtS+SDoB+bAIKUojAtT NatXCEzh0tUivjGPHsQebsqvmybzFTDid99W+g8fP3r9t9xyWlyDRznfO77hUt2L5Myc vjE19kxGYeKnFOgeuPRmN8uQAmyxdeM2m/SEQa5qazO5cM3a8HFQ618K1NN3NDg9eODR QAGpj/xjuKVWxvGC56XJn+GZ6wd9lyhP+NykpoZy4EjhM0ZEL8Mt7RgBgzpCL/b2Sx9G sMxQ== 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:in-reply-to:references; bh=csVYXIbKUE93u08l6RzyXGyxicFBEJweaqPygffB038=; b=g1UsA/bQHUTsRMik0rBGvisL2otlWjh12QNYfDuxqHSvQmhoyyZyBaZJIIebRPyK4k g9E22YTbxjOKdlQdRkNQ3DTBoJyWx67krgspk2QzIDpRW6RC0lkxA8TcYvVf7tvSMhIk FHqpS+fLBzt6y9Jyrt1eFhM53frjlVAbPhKSpyWf5EfXmNeo/xtSzL+a9avlaYGXJ0XQ Mn7WjJzC62mLMphKzgaYTpCXAA8MPCdBOzLOpTZ8dLWFWRQfpLnEU0un2odYwJaHFqP9 p6ejU0n7aGMWufS5qQIEE/f/kedUOOJgWgfa81sQtZsi/iQSFWFnEy8WHrNRG6GuvVOL B2jw== X-Gm-Message-State: AOAM533LOPGfyNnU26vGuHliOyQaAc0JZgJUAdkSCFLf5829WNvAeCq/ PnTRVNZCMbLKEmwyohHeM+L/yEM1tbi8iw== X-Google-Smtp-Source: ABdhPJzfoSHcbmZuagGAUXfgC7dW5XPyirNCs4vuoRSODzkoz0/sc+JJSVApFm9DZfdATPPZMsbVpg== X-Received: by 2002:a62:16cb:0:b029:1da:358c:4338 with SMTP id 194-20020a6216cb0000b02901da358c4338mr21030283pfw.36.1613507749998; Tue, 16 Feb 2021 12:35:49 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.35.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:35:49 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:26 -0800 Message-Id: <20210216203540.29290-2-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 01/15] net/ionic: cut down completion queue structure 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" Add Q_NEXT_TO_POST() and Q_NEXT_TO_SRVC() macros. Use a precomputed size mask. This will conserve resources. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.c | 14 +++----------- drivers/net/ionic/ionic_dev.h | 14 +++++++------- drivers/net/ionic/ionic_lif.c | 5 +++-- drivers/net/ionic/ionic_lif.h | 3 ++- drivers/net/ionic/ionic_rxtx.c | 24 ++++++++++++------------ 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index a9f9e2faf9..f837817a0a 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -358,14 +358,8 @@ ionic_dev_cmd_adminq_init(struct ionic_dev *idev, struct ionic_qcq *qcq) } int -ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq, - uint32_t num_descs, size_t desc_size) +ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs) { - if (desc_size == 0) { - IONIC_PRINT(ERR, "Descriptor size is %zu", desc_size); - return -EINVAL; - } - if (!rte_is_power_of_2(num_descs) || num_descs < IONIC_MIN_RING_DESC || num_descs > IONIC_MAX_RING_DESC) { @@ -374,9 +368,8 @@ ionic_cq_init(struct ionic_lif *lif, struct ionic_cq *cq, return -EINVAL; } - cq->lif = lif; cq->num_descs = num_descs; - cq->desc_size = desc_size; + cq->size_mask = num_descs - 1; cq->tail_idx = 0; cq->done_color = 1; @@ -393,7 +386,6 @@ 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) { - cq->bound_q = q; q->bound_cq = cq; } @@ -407,7 +399,7 @@ ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do, return 0; while (cb(cq, cq->tail_idx, cb_arg)) { - cq->tail_idx = (cq->tail_idx + 1) & (cq->num_descs - 1); + cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); if (cq->tail_idx == 0) cq->done_color = !cq->done_color; diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index bacbe3f053..b29bfd13be 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -142,6 +142,9 @@ struct ionic_desc_info { void *cb_arg; }; +#define Q_NEXT_TO_POST(_q, _n) (((_q)->head_idx + (_n)) & ((_q)->size_mask)) +#define Q_NEXT_TO_SRVC(_q, _n) (((_q)->tail_idx + (_n)) & ((_q)->size_mask)) + struct ionic_queue { struct ionic_dev *idev; struct ionic_lif *lif; @@ -174,11 +177,9 @@ struct ionic_intr_info { }; struct ionic_cq { - struct ionic_lif *lif; - struct ionic_queue *bound_q; - uint32_t tail_idx; - uint32_t num_descs; - uint32_t desc_size; + uint16_t tail_idx; + uint16_t num_descs; + uint16_t size_mask; bool done_color; void *base; rte_iova_t base_pa; @@ -240,8 +241,7 @@ 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, - uint32_t num_descs, size_t desc_size); +int ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs); 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 e083f92417..a9fe34c0f2 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -656,7 +656,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, goto err_out_free_info; } - err = ionic_cq_init(lif, &new->cq, num_descs, cq_desc_size); + err = ionic_cq_init(&new->cq, num_descs); if (err) { IONIC_PRINT(ERR, "Completion queue initialization failed"); goto err_out_free_info; @@ -1169,11 +1169,12 @@ ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index, { struct ionic_admin_comp *cq_desc_base = cq->base; struct ionic_admin_comp *cq_desc = &cq_desc_base[cq_desc_index]; + struct ionic_qcq *qcq = IONIC_CQ_TO_QCQ(cq); if (!color_match(cq_desc->color, cq->done_color)) return false; - ionic_q_service(cq->bound_q, cq_desc_index, cq_desc->comp_index, NULL); + ionic_q_service(&qcq->q, cq_desc_index, cq_desc->comp_index, NULL); return true; } diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 8f01aefd60..1a898a0ef9 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -71,7 +71,8 @@ struct ionic_qcq { struct ionic_intr_info intr; }; -#define IONIC_Q_TO_QCQ(q) container_of(q, struct ionic_qcq, q) +#define IONIC_Q_TO_QCQ(_q) container_of(_q, struct ionic_qcq, q) +#define IONIC_CQ_TO_QCQ(_cq) container_of(_cq, struct ionic_qcq, cq) #define IONIC_Q_TO_TX_STATS(q) (&IONIC_Q_TO_QCQ(q)->stats.tx) #define IONIC_Q_TO_RX_STATS(q) (&IONIC_Q_TO_QCQ(q)->stats.rx) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 99920109eb..76de82882d 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -68,9 +68,10 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, } static __rte_always_inline void -ionic_tx_flush(struct ionic_cq *cq) +ionic_tx_flush(struct ionic_qcq *txq) { - struct ionic_queue *q = cq->bound_q; + struct ionic_cq *cq = &txq->cq; + struct ionic_queue *q = &txq->q; struct ionic_desc_info *q_desc_info; struct rte_mbuf *txm, *next; struct ionic_txq_comp *cq_desc_base = cq->base; @@ -79,7 +80,7 @@ ionic_tx_flush(struct ionic_cq *cq) cq_desc = &cq_desc_base[cq->tail_idx]; while (color_match(cq_desc->color, cq->done_color)) { - cq->tail_idx = (cq->tail_idx + 1) & (cq->num_descs - 1); + cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); /* Prefetch the next 4 descriptors (not really useful here) */ if ((cq->tail_idx & 0x3) == 0) @@ -149,7 +150,7 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) ionic_qcq_disable(txq); - ionic_tx_flush(&txq->cq); + ionic_tx_flush(txq); return 0; } @@ -521,7 +522,6 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, { struct ionic_qcq *txq = (struct ionic_qcq *)tx_queue; struct ionic_queue *q = &txq->q; - struct ionic_cq *cq = &txq->cq; struct ionic_tx_stats *stats = IONIC_Q_TO_TX_STATS(q); uint32_t next_q_head_idx; uint32_t bytes_tx = 0; @@ -530,7 +530,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, bool last; /* Cleaning old buffers */ - ionic_tx_flush(cq); + ionic_tx_flush(txq); if (unlikely(ionic_q_space_avail(q) < nb_pkts)) { stats->stop += nb_pkts; @@ -1018,10 +1018,11 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) } static __rte_always_inline void -ionic_rxq_service(struct ionic_cq *cq, uint32_t work_to_do, +ionic_rxq_service(struct ionic_qcq *rxq, uint32_t work_to_do, void *service_cb_arg) { - struct ionic_queue *q = cq->bound_q; + struct ionic_cq *cq = &rxq->cq; + struct ionic_queue *q = &rxq->q; struct ionic_desc_info *q_desc_info; struct ionic_rxq_comp *cq_desc_base = cq->base; struct ionic_rxq_comp *cq_desc; @@ -1035,7 +1036,7 @@ ionic_rxq_service(struct ionic_cq *cq, uint32_t work_to_do, cq_desc = &cq_desc_base[cq->tail_idx]; while (color_match(cq_desc->pkt_type_color, cq->done_color)) { curr_cq_tail_idx = cq->tail_idx; - cq->tail_idx = (cq->tail_idx + 1) & (cq->num_descs - 1); + cq->tail_idx = Q_NEXT_TO_SRVC(cq, 1); if (cq->tail_idx == 0) cq->done_color = !cq->done_color; @@ -1087,7 +1088,7 @@ ionic_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) ionic_qcq_disable(rxq); /* Flush */ - ionic_rxq_service(&rxq->cq, -1, NULL); + ionic_rxq_service(rxq, -1, NULL); return 0; } @@ -1099,14 +1100,13 @@ ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, struct ionic_qcq *rxq = (struct ionic_qcq *)rx_queue; uint32_t frame_size = rxq->lif->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; - struct ionic_cq *cq = &rxq->cq; struct ionic_rx_service service_cb_arg; service_cb_arg.rx_pkts = rx_pkts; service_cb_arg.nb_pkts = nb_pkts; service_cb_arg.nb_rx = 0; - ionic_rxq_service(cq, nb_pkts, &service_cb_arg); + ionic_rxq_service(rxq, nb_pkts, &service_cb_arg); ionic_rx_fill(rxq, frame_size); From patchwork Tue Feb 16 20:35:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87941 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 73C64A054D; Tue, 16 Feb 2021 21:36:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1441D1607A4; Tue, 16 Feb 2021 21:35:54 +0100 (CET) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id D5ED316079A for ; Tue, 16 Feb 2021 21:35:52 +0100 (CET) Received: by mail-pl1-f181.google.com with SMTP id b8so6124305plh.12 for ; Tue, 16 Feb 2021 12:35:52 -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 :in-reply-to:references; bh=E+cOj/WLXVGJVpaV6O6jDb0DVbyAmeOnktQaohKI//c=; b=btOtP4B4nM9pNJF1F/leVN3HOQML0AMsWXJ6kYb09T9Y7Z4Jh62nMPbVSZtyLJ1Um0 n7IojePOcBY9DE/g9qTFIgsQJOFxKkizDkM5uEKjPm2r6caAC0fD+bH4CjbKLyvuegoJ aoItVcKzxW98bICf8XAuIGewMSrTfxUECl+jFcJtz+FhVMXOhRVutQGc43+rHNjVcDZS HW5jo9HCV3gIzJyL8w5XWtR8dPvTyaeaD6xewoJZSn/hMX9cKb2yRmHzLqa9UDfwIE6Q k+xJNkpjSgkF4TcdRzb8BQoU2ddJ4qgUZQVMnqU+OCouAYtuEMye5ZVkPrEno4pUpJcZ c5nA== 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:in-reply-to:references; bh=E+cOj/WLXVGJVpaV6O6jDb0DVbyAmeOnktQaohKI//c=; b=k6pdoyFAXpsSr/IkGe2IvArHM4pRAUuK0Ek0HCE7ir886ydIBpn/vBLsWv2LRvWDdw X51gRgf7DjFz913X/J3ekq8pOCstw8SgGpxQ0in/IL6rsC6Dme+QPq8da8hohDYt6Ter YZkfd2tF6oYWCtRnsvOOPawdGSQNzyn9OR/mtMntdFEyW9prS71Ru02+I80xLzKqahAB Rs5Zyw+m9vrO7UWcbim1+Ywk9VecX3BHy/u8IRWL8ZjBQOmhmiaeEQAFUjpSv1BchepH w71upccooT9c5PpBiqfyFq8kt7zqxjQSJjWtlahfi1aBmuTBS4G3c/Qn05jz7qmTQcdy fkWQ== X-Gm-Message-State: AOAM531FNteni6c5BLL1y3quy4+NWEoRX6e5xFKKVKbktvNCMxmkP/Cg trabbiCMrsjcjvBqyJbvSLi3KDsYY/1rTA== X-Google-Smtp-Source: ABdhPJwhzUfOMrEI2v1ntYJOAlFZhr5Sk7f7ITPsflBRbFqlb56RdxhfW6PZgJx0M+qtF3cITTec1g== X-Received: by 2002:a17:902:b58e:b029:e3:2313:42ab with SMTP id a14-20020a170902b58eb02900e3231342abmr20556919pls.9.1613507751858; Tue, 16 Feb 2021 12:35:51 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.35.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:35:51 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:27 -0800 Message-Id: <20210216203540.29290-3-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 02/15] net/ionic: remove unused filter delete function 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" This function is unused. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.h | 1 - drivers/net/ionic/ionic_rx_filter.c | 14 -------------- drivers/net/ionic/ionic_rx_filter.h | 1 - 3 files changed, 16 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index b29bfd13be..e1b93b1b05 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -90,7 +90,6 @@ static inline void ionic_struct_size_checks(void) RTE_BUILD_BUG_ON(sizeof(struct ionic_rx_mode_set_cmd) != 64); RTE_BUILD_BUG_ON(sizeof(struct ionic_rx_filter_add_cmd) != 64); RTE_BUILD_BUG_ON(sizeof(struct ionic_rx_filter_add_comp) != 16); - RTE_BUILD_BUG_ON(sizeof(struct ionic_rx_filter_del_cmd) != 64); /* RDMA commands */ RTE_BUILD_BUG_ON(sizeof(struct ionic_rdma_reset_cmd) != 64); diff --git a/drivers/net/ionic/ionic_rx_filter.c b/drivers/net/ionic/ionic_rx_filter.c index 320b9019b3..4310c91b94 100644 --- a/drivers/net/ionic/ionic_rx_filter.c +++ b/drivers/net/ionic/ionic_rx_filter.c @@ -18,20 +18,6 @@ ionic_rx_filter_free(struct ionic_rx_filter *f) rte_free(f); } -int -ionic_rx_filter_del(struct ionic_lif *lif, struct ionic_rx_filter *f) -{ - struct ionic_admin_ctx ctx = { - .pending_work = true, - .cmd.rx_filter_del = { - .opcode = IONIC_CMD_RX_FILTER_DEL, - .filter_id = rte_cpu_to_le_32(f->filter_id), - }, - }; - - return ionic_adminq_post(lif, &ctx); -} - int ionic_rx_filters_init(struct ionic_lif *lif) { diff --git a/drivers/net/ionic/ionic_rx_filter.h b/drivers/net/ionic/ionic_rx_filter.h index e1dd5f910c..773042fcb2 100644 --- a/drivers/net/ionic/ionic_rx_filter.h +++ b/drivers/net/ionic/ionic_rx_filter.h @@ -35,7 +35,6 @@ struct ionic_admin_ctx; struct ionic_lif; void ionic_rx_filter_free(struct ionic_rx_filter *f); -int ionic_rx_filter_del(struct ionic_lif *lif, struct ionic_rx_filter *f); int ionic_rx_filters_init(struct ionic_lif *lif); void ionic_rx_filters_deinit(struct ionic_lif *lif); int ionic_rx_filter_save(struct ionic_lif *lif, uint32_t flow_id, From patchwork Tue Feb 16 20:35:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87942 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 44633A054D; Tue, 16 Feb 2021 21:36:10 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B66EE1607B1; Tue, 16 Feb 2021 21:35:57 +0100 (CET) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mails.dpdk.org (Postfix) with ESMTP id BE5201607A8 for ; Tue, 16 Feb 2021 21:35:54 +0100 (CET) Received: by mail-pg1-f177.google.com with SMTP id t25so7010002pga.2 for ; Tue, 16 Feb 2021 12:35:54 -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 :in-reply-to:references; bh=Pe+nbvsCf+CF43E4EPo9MEeeb6ONcSecpuDnF4bcYvw=; b=lSsEjt7SEIZuyKOvdsBxKkuqOThmRgWOTVAL4a/rqUCARn/6GR4tyuDvX3wCMQsFom lqi95G90m1tdJsbIYwE8KM+hBBReN7FobkrAxDA7u7/WFygZoW6/CvND3dQNawWMJq3x zIxZ5kyp0w1SV8mrDO7XlV4cuZSRiUKBYXvjU7bs+xLL+0NljoNbmgtsE3q4X3MLzVu3 pSIvIA91MMiipO3M5Qlj47yXGirn3i/71Ykvwj33Quj2E9bTJ+xO/w4wW+ZChq8u5Lvr 1B25VCM/UYsWI1ogEGy9yWGnMwlu8CW0LbUtY6AqsXK5a7nggsDKV0y26cOVfcQC+9RG DSrw== 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:in-reply-to:references; bh=Pe+nbvsCf+CF43E4EPo9MEeeb6ONcSecpuDnF4bcYvw=; b=B5ICNPONijPlDuIdBD4S7GI68SKFenm8E6+VuysaLc/WQ10BKgJVH1rnSKJdPAq01V 26yeCrzzz6ex95XV9pep68GWnsSvbn4E7tkNICb4DsZw1LuQ9eJl/IHlpsc9VteN5Z94 59XpDqrtLE3sXPaD9bBOWgN22f6HS/i41LvDzOGmODYsluKhfTGYCwoRizPTMGk67C/I 8wzkcvrX2vZrA5mTom0mWbfxRzmRimRT1Q4AMwuoDW90qEGZZVA4okZL1R0sffocDGHW bVec73Jw2FcCzili8iwxT9T6XwG4E5i9ursdOAafMmVO5qM4gD/itECfCHbHHZeBIEtY bKEQ== X-Gm-Message-State: AOAM531YKcNyNI/fP1Gn6iMqUDbAochY1iJcUySXL03m4CM314Tb8Nlx DdhnMF/w/lExK4ceRImsbgcHXP+WVna15A== X-Google-Smtp-Source: ABdhPJxMatxn4bEhWc/5RflkfMbKxF8alFuWJLXznf9crtpe39CgwESgWsrwl0o0V+ESCBx8zDKbNQ== X-Received: by 2002:a62:7a0b:0:b029:1de:7e70:955d with SMTP id v11-20020a627a0b0000b02901de7e70955dmr21454834pfc.49.1613507753637; Tue, 16 Feb 2021 12:35:53 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.35.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:35:53 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:28 -0800 Message-Id: <20210216203540.29290-4-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 03/15] net/ionic: consolidate adminq 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" The adminq is the only caller of ionic_q_service(), so absorb it into ionic_adminq_service(). Move all of the adminq code together into ionic_main.c. Staticize a few things. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic.h | 13 ++++- drivers/net/ionic/ionic_dev.c | 85 ---------------------------- drivers/net/ionic/ionic_dev.h | 15 ----- drivers/net/ionic/ionic_lif.c | 16 ------ drivers/net/ionic/ionic_lif.h | 2 - drivers/net/ionic/ionic_main.c | 87 ++++++++++++++++++++++++++--- drivers/net/ionic/ionic_rx_filter.c | 1 + 7 files changed, 93 insertions(+), 126 deletions(-) diff --git a/drivers/net/ionic/ionic.h b/drivers/net/ionic/ionic.h index 49d1fc003f..49b90d1b7c 100644 --- a/drivers/net/ionic/ionic.h +++ b/drivers/net/ionic/ionic.h @@ -65,8 +65,19 @@ struct ionic_adapter { LIST_ENTRY(ionic_adapter) pci_adapters; }; -int ionic_adminq_check_err(struct ionic_admin_ctx *ctx, bool timeout); +/** ionic_admin_ctx - Admin command context. + * @pending_work: Flag that indicates a completion. + * @cmd: Admin command (64B) to be copied to the queue. + * @comp: Admin completion (16B) copied from the queue. + */ +struct ionic_admin_ctx { + bool pending_work; + union ionic_adminq_cmd cmd; + union ionic_adminq_comp comp; +}; + int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx); + int ionic_dev_cmd_wait_check(struct ionic_dev *idev, unsigned long max_wait); int ionic_setup(struct ionic_adapter *adapter); diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index f837817a0a..0eb9f6f21a 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -465,88 +465,3 @@ ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb, if (ring_doorbell) ionic_q_flush(q); } - -void -ionic_q_service(struct ionic_queue *q, uint32_t cq_desc_index, - uint32_t stop_index, void *service_cb_arg) -{ - struct ionic_desc_info *desc_info; - uint32_t curr_q_tail_idx; - - do { - desc_info = &q->info[q->tail_idx]; - - if (desc_info->cb) - desc_info->cb(q, q->tail_idx, cq_desc_index, - desc_info->cb_arg, service_cb_arg); - - desc_info->cb = NULL; - desc_info->cb_arg = NULL; - - curr_q_tail_idx = q->tail_idx; - q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); - - } while (curr_q_tail_idx != stop_index); -} - -static void -ionic_adminq_cb(struct ionic_queue *q, - uint32_t q_desc_index, uint32_t cq_desc_index, - void *cb_arg, void *service_cb_arg __rte_unused) -{ - struct ionic_admin_ctx *ctx = cb_arg; - struct ionic_admin_comp *cq_desc_base = q->bound_cq->base; - struct ionic_admin_comp *cq_desc = &cq_desc_base[cq_desc_index]; - uint16_t comp_index; - - if (!ctx) - return; - - comp_index = rte_le_to_cpu_16(cq_desc->comp_index); - if (unlikely(comp_index != q_desc_index)) { - IONIC_WARN_ON(comp_index != q_desc_index); - return; - } - - memcpy(&ctx->comp, cq_desc, sizeof(*cq_desc)); - - ctx->pending_work = false; /* done */ -} - -/** ionic_adminq_post - Post an admin command. - * @lif: Handle to lif. - * @cmd_ctx: Api admin command context. - * - * Post the command to an admin queue in the ethernet driver. If this command - * succeeds, then the command has been posted, but that does not indicate a - * completion. If this command returns success, then the completion callback - * will eventually be called. - * - * Return: zero or negative error status. - */ -int -ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) -{ - struct ionic_queue *adminq = &lif->adminqcq->q; - struct ionic_admin_cmd *q_desc_base = adminq->base; - struct ionic_admin_cmd *q_desc; - int err = 0; - - rte_spinlock_lock(&lif->adminq_lock); - - if (ionic_q_space_avail(adminq) < 1) { - err = -ENOSPC; - goto err_out; - } - - q_desc = &q_desc_base[adminq->head_idx]; - - memcpy(q_desc, &ctx->cmd, sizeof(ctx->cmd)); - - ionic_q_post(adminq, true, ionic_adminq_cb, ctx); - -err_out: - rte_spinlock_unlock(&lif->adminq_lock); - - return err; -} diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index e1b93b1b05..5b258a9e65 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -184,17 +184,6 @@ struct ionic_cq { rte_iova_t base_pa; }; -/** ionic_admin_ctx - Admin command context. - * @pending_work: Flag that indicates a completion. - * @cmd: Admin command (64B) to be copied to the queue. - * @comp: Admin completion (16B) copied from the queue. - */ -struct ionic_admin_ctx { - bool pending_work; - union ionic_adminq_cmd cmd; - union ionic_adminq_comp comp; -}; - struct ionic_lif; struct ionic_adapter; struct ionic_qcq; @@ -255,8 +244,6 @@ void ionic_q_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); void ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb, void *cb_arg); -void ionic_q_service(struct ionic_queue *q, uint32_t cq_desc_index, - uint32_t stop_index, void *service_cb_arg); static inline uint32_t ionic_q_space_avail(struct ionic_queue *q) @@ -279,6 +266,4 @@ ionic_q_flush(struct ionic_queue *q) rte_write64(rte_cpu_to_le_64(val), q->db); } -int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx); - #endif /* _IONIC_DEV_H_ */ diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index a9fe34c0f2..52bc0b178d 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1163,22 +1163,6 @@ ionic_lif_notifyq_deinit(struct ionic_lif *lif) nqcq->flags &= ~IONIC_QCQ_F_INITED; } -bool -ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index, - void *cb_arg __rte_unused) -{ - struct ionic_admin_comp *cq_desc_base = cq->base; - struct ionic_admin_comp *cq_desc = &cq_desc_base[cq_desc_index]; - struct ionic_qcq *qcq = IONIC_CQ_TO_QCQ(cq); - - if (!color_match(cq_desc->color, cq->done_color)) - return false; - - ionic_q_service(&qcq->q, cq_desc_index, cq_desc->comp_index, NULL); - - return true; -} - /* This acts like ionic_napi */ int ionic_qcq_service(struct ionic_qcq *qcq, int budget, ionic_cq_cb cb, diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 1a898a0ef9..c4cb7514fb 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -154,8 +154,6 @@ void ionic_lif_reset(struct ionic_lif *lif); int 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); -bool ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index, - void *cb_arg); int ionic_qcq_service(struct ionic_qcq *qcq, int budget, ionic_cq_cb cb, void *cb_arg); diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 3f1a764888..012103921d 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -122,7 +122,7 @@ ionic_opcode_to_str(enum ionic_cmd_opcode opcode) } } -int +static int ionic_adminq_check_err(struct ionic_admin_ctx *ctx, bool timeout) { const char *name; @@ -145,8 +145,81 @@ ionic_adminq_check_err(struct ionic_admin_ctx *ctx, bool timeout) return 0; } +static bool +ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index, + void *cb_arg __rte_unused) +{ + struct ionic_admin_comp *cq_desc_base = cq->base; + struct ionic_admin_comp *cq_desc = &cq_desc_base[cq_desc_index]; + struct ionic_qcq *qcq = IONIC_CQ_TO_QCQ(cq); + struct ionic_queue *q = &qcq->q; + struct ionic_admin_ctx *ctx; + struct ionic_desc_info *desc_info; + uint16_t curr_q_tail_idx; + uint16_t stop_index; + + if (!color_match(cq_desc->color, cq->done_color)) + return false; + + stop_index = rte_le_to_cpu_16(cq_desc->comp_index); + + do { + desc_info = &q->info[q->tail_idx]; + + ctx = desc_info->cb_arg; + if (ctx) { + memcpy(&ctx->comp, cq_desc, sizeof(*cq_desc)); + + ctx->pending_work = false; /* done */ + } + + curr_q_tail_idx = q->tail_idx; + q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); + } while (curr_q_tail_idx != stop_index); + + return true; +} + +/** ionic_adminq_post - Post an admin command. + * @lif: Handle to lif. + * @cmd_ctx: Api admin command context. + * + * Post the command to an admin queue in the ethernet driver. If this command + * succeeds, then the command has been posted, but that does not indicate a + * completion. If this command returns success, then the completion callback + * will eventually be called. + * + * Return: zero or negative error status. + */ +static int +ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) +{ + struct ionic_queue *q = &lif->adminqcq->q; + struct ionic_admin_cmd *q_desc_base = q->base; + struct ionic_admin_cmd *q_desc; + int err = 0; + + rte_spinlock_lock(&lif->adminq_lock); + + if (ionic_q_space_avail(q) < 1) { + err = -ENOSPC; + goto err_out; + } + + q_desc = &q_desc_base[q->head_idx]; + + memcpy(q_desc, &ctx->cmd, sizeof(ctx->cmd)); + + ionic_q_post(q, true, NULL, ctx); + +err_out: + rte_spinlock_unlock(&lif->adminq_lock); + + return err; +} + static int -ionic_wait_ctx_for_completion(struct ionic_lif *lif, struct ionic_qcq *qcq, +ionic_adminq_wait_for_completion(struct ionic_lif *lif, struct ionic_admin_ctx *ctx, unsigned long max_wait) { unsigned long step_usec = IONIC_DEVCMD_CHECK_PERIOD_US; @@ -156,12 +229,13 @@ ionic_wait_ctx_for_completion(struct ionic_lif *lif, struct ionic_qcq *qcq, while (ctx->pending_work && elapsed_usec < max_wait_usec) { /* - * Locking here as adminq is served inline (this could be called - * from multiple places) + * Locking here as adminq is served inline and could be + * called from multiple places */ rte_spinlock_lock(&lif->adminq_service_lock); - ionic_qcq_service(qcq, budget, ionic_adminq_service, NULL); + ionic_qcq_service(lif->adminqcq, budget, + ionic_adminq_service, NULL); rte_spinlock_unlock(&lif->adminq_service_lock); @@ -175,7 +249,6 @@ ionic_wait_ctx_for_completion(struct ionic_lif *lif, struct ionic_qcq *qcq, int ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) { - struct ionic_qcq *qcq = lif->adminqcq; bool done; int err; @@ -189,7 +262,7 @@ ionic_adminq_post_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) return err; } - done = ionic_wait_ctx_for_completion(lif, qcq, ctx, + done = ionic_adminq_wait_for_completion(lif, ctx, IONIC_DEVCMD_TIMEOUT); return ionic_adminq_check_err(ctx, !done /* timed out */); diff --git a/drivers/net/ionic/ionic_rx_filter.c b/drivers/net/ionic/ionic_rx_filter.c index 4310c91b94..bf57a9fa52 100644 --- a/drivers/net/ionic/ionic_rx_filter.c +++ b/drivers/net/ionic/ionic_rx_filter.c @@ -7,6 +7,7 @@ #include +#include "ionic.h" #include "ionic_lif.h" #include "ionic_rx_filter.h" From patchwork Tue Feb 16 20:35:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87943 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 03A19A054D; Tue, 16 Feb 2021 21:36:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0FBC11607B4; Tue, 16 Feb 2021 21:35:59 +0100 (CET) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by mails.dpdk.org (Postfix) with ESMTP id 9273F1607A3 for ; Tue, 16 Feb 2021 21:35:56 +0100 (CET) Received: by mail-pj1-f53.google.com with SMTP id fa16so37005pjb.1 for ; Tue, 16 Feb 2021 12:35:56 -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 :in-reply-to:references; bh=BvkTMoHVzbluS64kHQQWDYffDYAttLzzg3aJlxHuKTM=; b=EwLvPsubssBw7UBnoTpxdZjpAos60MeUQuX1ABKB+ThJYsYpTSSkzlp5jdM+ybinxG NGTs0UKlwsrtjyu3Q83HveASpZoVaLLxBkpJncufahTg0h2ixLD8EVyUlv9zNNJ6UVeV HHqosSVqqpCWbW06nIdiqjKoe2cAPFq/0VrVH2Io9p2rbvOtBAPLYLW/WAke104tSR9x +o95sWFCJNCjIetOqibPnKvua4QLi9wK9zODG9iOTXle8njdTPjCvFw5jQ1XkG4//QxM 6WMCdGgnawNquZ2Do+FJnffrJ1C+olfGyewF5WPj2CnA7uTw9umKkbFFKueAAIB3/hrN LIIw== 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:in-reply-to:references; bh=BvkTMoHVzbluS64kHQQWDYffDYAttLzzg3aJlxHuKTM=; b=e+Q/BeD4v0SEQqZYK/d13CsHc1pkfWHhYmmCFsvNicNQ0a6BtvS2Vj6df1T23s2KuU /xIy9EFDZ45pjMnfLp+/3bI6w38a7Ggz0qB8pbWi9p2blAGLlxPT+2vUDlnGCH+JiPzs 5I6pTw2685Hv0htQUid5P6kC7IkccnRatQStg6SQ41NBStzUiIrsj53jaVknaFf35+VB ofzyb3ZK0p35VQhLOi2UtH7/4mdy3HE15J/VmSvLLADiD+p5L5Uy/R4+HqGlJ/1G+epV DNxISibADXx0fzi0pFOgnMxEBNYUw9oIezGK1P9GP3+tynsquZw5pCQ8Sg4yCuyhTt1b VjCQ== X-Gm-Message-State: AOAM5337p1dky9VyXznNHL1VyqyaGydD1s5UOQCiF45m/rtItVJd6HDV CP3u2PMJNhL0BBMvzbMJr0UQ0PihyDY1sg== X-Google-Smtp-Source: ABdhPJx3jflWChg/PTA94zFTHZIJV7zGsyXRyFWpLzN3rxZ27WKJj/lR0TZqWHfTq4uu/JfL/5Cn4A== X-Received: by 2002:a17:90a:e7cd:: with SMTP id kb13mr5780096pjb.10.1613507755464; Tue, 16 Feb 2021 12:35:55 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.35.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:35:55 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:29 -0800 Message-Id: <20210216203540.29290-5-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 04/15] net/ionic: convert info array to generic pointers 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" Drop the callback part of the object and store only the pointers. This saves a bit of space and simplifies the code. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.c | 8 ++------ drivers/net/ionic/ionic_dev.h | 21 +++++-------------- drivers/net/ionic/ionic_main.c | 8 ++++---- drivers/net/ionic/ionic_rxtx.c | 37 ++++++++++++++++++---------------- 4 files changed, 31 insertions(+), 43 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index 0eb9f6f21a..74ac2e67a5 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -452,13 +452,9 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa) } void -ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb, - void *cb_arg) +ionic_q_post(struct ionic_queue *q, bool ring_doorbell, void *cb_arg) { - struct ionic_desc_info *head = &q->info[q->head_idx]; - - head->cb = cb; - head->cb_arg = cb_arg; + q->info[q->head_idx] = cb_arg; q->head_idx = (q->head_idx + 1) & (q->num_descs - 1); diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 5b258a9e65..c51c2a9ae5 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -128,22 +128,12 @@ struct ionic_dev { uint32_t port_info_sz; }; -struct ionic_queue; -struct ionic_desc_info; - -typedef void (*desc_cb)(struct ionic_queue *q, - uint32_t q_desc_index, - uint32_t cq_desc_index, - void *cb_arg, void *service_cb_arg); - -struct ionic_desc_info { - desc_cb cb; - void *cb_arg; -}; - #define Q_NEXT_TO_POST(_q, _n) (((_q)->head_idx + (_n)) & ((_q)->size_mask)) #define Q_NEXT_TO_SRVC(_q, _n) (((_q)->tail_idx + (_n)) & ((_q)->size_mask)) +#define IONIC_INFO_IDX(_q, _i) (_i) +#define IONIC_INFO_PTR(_q, _i) (&(_q)->info[IONIC_INFO_IDX((_q), _i)]) + struct ionic_queue { struct ionic_dev *idev; struct ionic_lif *lif; @@ -154,9 +144,9 @@ struct ionic_queue { uint32_t hw_type; void *base; void *sg_base; + void **info; rte_iova_t base_pa; rte_iova_t sg_base_pa; - struct ionic_desc_info *info; uint32_t tail_idx; uint32_t head_idx; uint32_t num_descs; @@ -242,8 +232,7 @@ int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev, size_t desc_size, size_t sg_desc_size); void ionic_q_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); void ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); -void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, desc_cb cb, - void *cb_arg); +void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, void *cb_arg); static inline uint32_t ionic_q_space_avail(struct ionic_queue *q) diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 012103921d..12f2b26570 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -154,9 +154,9 @@ ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index, struct ionic_qcq *qcq = IONIC_CQ_TO_QCQ(cq); struct ionic_queue *q = &qcq->q; struct ionic_admin_ctx *ctx; - struct ionic_desc_info *desc_info; uint16_t curr_q_tail_idx; uint16_t stop_index; + void **info; if (!color_match(cq_desc->color, cq->done_color)) return false; @@ -164,9 +164,9 @@ ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index, stop_index = rte_le_to_cpu_16(cq_desc->comp_index); do { - desc_info = &q->info[q->tail_idx]; + info = IONIC_INFO_PTR(q, q->tail_idx); - ctx = desc_info->cb_arg; + ctx = info[0]; if (ctx) { memcpy(&ctx->comp, cq_desc, sizeof(*cq_desc)); @@ -210,7 +210,7 @@ ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) memcpy(q_desc, &ctx->cmd, sizeof(ctx->cmd)); - ionic_q_post(q, true, NULL, ctx); + ionic_q_post(q, true, ctx); err_out: rte_spinlock_unlock(&lif->adminq_lock); diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 76de82882d..d736e24b02 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -72,10 +72,10 @@ ionic_tx_flush(struct ionic_qcq *txq) { struct ionic_cq *cq = &txq->cq; struct ionic_queue *q = &txq->q; - struct ionic_desc_info *q_desc_info; struct rte_mbuf *txm, *next; struct ionic_txq_comp *cq_desc_base = cq->base; struct ionic_txq_comp *cq_desc; + void **info; u_int32_t comp_index = (u_int32_t)-1; cq_desc = &cq_desc_base[cq->tail_idx]; @@ -96,7 +96,7 @@ ionic_tx_flush(struct ionic_qcq *txq) if (comp_index != (u_int32_t)-1) { while (q->tail_idx != comp_index) { - q_desc_info = &q->info[q->tail_idx]; + info = IONIC_INFO_PTR(q, q->tail_idx); q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); @@ -109,7 +109,7 @@ ionic_tx_flush(struct ionic_qcq *txq) * Note: you can just use rte_pktmbuf_free, * but this loop is faster */ - txm = q_desc_info->cb_arg; + txm = info[0]; while (txm != NULL) { next = txm->next; rte_pktmbuf_free_seg(txm); @@ -311,7 +311,7 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc, desc->hdr_len = hdrlen; desc->mss = mss; - ionic_q_post(q, done, NULL, done ? txm : NULL); + ionic_q_post(q, done, done ? txm : NULL); } static struct ionic_txq_desc * @@ -511,7 +511,7 @@ ionic_tx(struct ionic_qcq *txq, struct rte_mbuf *txm, txm_seg = txm_seg->next; } - ionic_q_post(q, not_xmit_more, NULL, txm); + ionic_q_post(q, not_xmit_more, txm); return 0; } @@ -639,12 +639,12 @@ static void __rte_cold ionic_rx_empty(struct ionic_queue *q) { struct ionic_qcq *rxq = IONIC_Q_TO_QCQ(q); - struct ionic_desc_info *cur; struct rte_mbuf *mbuf; + void **info; while (q->tail_idx != q->head_idx) { - cur = &q->info[q->tail_idx]; - mbuf = cur->cb_arg; + info = IONIC_INFO_PTR(q, q->tail_idx); + mbuf = info[0]; rte_mempool_put(rxq->mb_pool, mbuf); q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); @@ -743,12 +743,11 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, static __rte_always_inline void ionic_rx_clean(struct ionic_queue *q, uint32_t q_desc_index, uint32_t cq_desc_index, - void *cb_arg, void *service_cb_arg) + void *service_cb_arg) { struct ionic_rxq_comp *cq_desc_base = q->bound_cq->base; struct ionic_rxq_comp *cq_desc = &cq_desc_base[cq_desc_index]; - struct rte_mbuf *rxm = cb_arg; - struct rte_mbuf *rxm_seg; + struct rte_mbuf *rxm, *rxm_seg; struct ionic_qcq *rxq = IONIC_Q_TO_QCQ(q); uint32_t max_frame_size = rxq->lif->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; @@ -761,6 +760,13 @@ ionic_rx_clean(struct ionic_queue *q, (rte_pktmbuf_data_room_size(rxq->mb_pool) - RTE_PKTMBUF_HEADROOM); uint32_t left; + void **info; + + assert(q_desc_index == cq_desc->comp_index); + + info = IONIC_INFO_PTR(q, cq_desc->comp_index); + + rxm = info[0]; if (!recv_args) { stats->no_cb_arg++; @@ -898,7 +904,7 @@ ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index, new->addr = old->addr; new->len = old->len; - ionic_q_post(q, true, ionic_rx_clean, mbuf); + ionic_q_post(q, true, mbuf); } static __rte_always_inline int @@ -969,7 +975,7 @@ ionic_rx_fill(struct ionic_qcq *rxq, uint32_t len) ring_doorbell = ((q->head_idx + 1) & IONIC_RX_RING_DOORBELL_STRIDE) == 0; - ionic_q_post(q, ring_doorbell, ionic_rx_clean, rxm); + ionic_q_post(q, ring_doorbell, rxm); } return 0; @@ -1023,7 +1029,6 @@ ionic_rxq_service(struct ionic_qcq *rxq, uint32_t work_to_do, { struct ionic_cq *cq = &rxq->cq; struct ionic_queue *q = &rxq->q; - struct ionic_desc_info *q_desc_info; struct ionic_rxq_comp *cq_desc_base = cq->base; struct ionic_rxq_comp *cq_desc; bool more; @@ -1048,8 +1053,6 @@ ionic_rxq_service(struct ionic_qcq *rxq, uint32_t work_to_do, do { more = (q->tail_idx != cq_desc->comp_index); - q_desc_info = &q->info[q->tail_idx]; - curr_q_tail_idx = q->tail_idx; q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); @@ -1059,7 +1062,7 @@ ionic_rxq_service(struct ionic_qcq *rxq, uint32_t work_to_do, rte_prefetch0(&q->info[q->tail_idx]); ionic_rx_clean(q, curr_q_tail_idx, curr_cq_tail_idx, - q_desc_info->cb_arg, service_cb_arg); + service_cb_arg); } while (more); From patchwork Tue Feb 16 20:35:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87944 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 82219A054D; Tue, 16 Feb 2021 21:36:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B0641607BA; Tue, 16 Feb 2021 21:36:01 +0100 (CET) Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) by mails.dpdk.org (Postfix) with ESMTP id 1658F1607AB for ; Tue, 16 Feb 2021 21:35:58 +0100 (CET) Received: by mail-pg1-f172.google.com with SMTP id a4so5408329pgc.11 for ; Tue, 16 Feb 2021 12:35:58 -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 :in-reply-to:references; bh=oWRmMeNVPuwHKhe9WEpsHqNmJ+4OczoIUTuQ3eLv3N4=; b=tkZ35ZEUVo0yPNjnE0YXEGoshghs1qqZ5E69iEGfs7fDyN78QXHM2J/sJMJTqx1+u3 B79r822GQTFlZ6t4PLVZrYdXzUqs7TU2fMTkAyJ91b+440i19mgbI9Axzjs0bif2pYpR BoGO5bxp0TDtIwo3N0bALBilKLPNdXcV97fXWUKbSVgWc3ta10bZUaKZYowHuEn8SBJQ Nd+R7a8kld5RgOIK04BCP6qvCALIiwbY1fE76tbtn+WheC1TbncqvOtaxaNJW0YBrEHf HorQaqqwjNYiATk4Ev5t5dYFUYyi80XfJJpyvJwwDrXofE+UQ4QTecppffdrBE3VhF2G +Mzw== 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:in-reply-to:references; bh=oWRmMeNVPuwHKhe9WEpsHqNmJ+4OczoIUTuQ3eLv3N4=; b=EpyxkrHAIxOeKROnrT1Ru5lPJ2+au8/VtGVjwwSIgfCXnkxieQ3csq8sxYrKvqCBp9 JbkL/97SIP6oBpYuQIj/Hp85ZRDuh3erpkaeRCgK6Oi355u+SHQ9y+YY/VeanSmnhbXf gWgVlsZ5/Gt8OQtNe2mJSixZRSw1eLGQXUcmx8GIvs6NJEs3AlIgkOFwOmHE6icixheF fb45MDmZnpQC+Rt6tEn+ZrbZJOtlLgV8fikSjUr5iHMoA7nZnNum8WO5/NDExBCJfxqt R4t/m03+H9eCaqBd0cLRKvjCt9G41MVm/pR4c2dxrt31UqzlrmXel+TYvldbQDDeI4io lHuQ== X-Gm-Message-State: AOAM5301By4Thw9tM1BGQ8PV7sX4KOhEZBTXCQIjpmCUwpN8ftAN5EMC uSWX8cppskDyCTXPcKHEu8aipDRsDUP5KA== X-Google-Smtp-Source: ABdhPJxpM1/c55ulqEof7IIrgQQq1lpd3JYZhQxiUx65Mvw3xPmOjfeEzE9GGPG2+z6roCu6klSdcA== X-Received: by 2002:a63:2306:: with SMTP id j6mr20764364pgj.187.1613507757140; Tue, 16 Feb 2021 12:35:57 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.35.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:35:56 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:30 -0800 Message-Id: <20210216203540.29290-6-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 05/15] net/ionic: remove unused field from queue structure 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" This will conserve resources. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.c | 6 ------ drivers/net/ionic/ionic_dev.h | 2 -- drivers/net/ionic/ionic_lif.c | 1 - drivers/net/ionic/ionic_rxtx.c | 9 +++++---- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index 74ac2e67a5..97fb8acf9b 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -383,12 +383,6 @@ ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa) cq->base_pa = base_pa; } -void -ionic_cq_bind(struct ionic_cq *cq, struct ionic_queue *q) -{ - q->bound_cq = cq; -} - uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do, ionic_cq_cb cb, void *cb_arg) diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index c51c2a9ae5..a777695d64 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -137,7 +137,6 @@ struct ionic_dev { struct ionic_queue { struct ionic_dev *idev; struct ionic_lif *lif; - struct ionic_cq *bound_cq; uint32_t index; uint32_t type; uint32_t hw_index; @@ -221,7 +220,6 @@ struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif, int ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs); 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, void *cb_arg); uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do, diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 52bc0b178d..1ca6e050ad 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -695,7 +695,6 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, ionic_q_map(&new->q, q_base, q_base_pa); ionic_cq_map(&new->cq, cq_base, cq_base_pa); - ionic_cq_bind(&new->cq, &new->q); *qcq = new; diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index d736e24b02..d615e5c4e1 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -741,14 +741,15 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, } static __rte_always_inline void -ionic_rx_clean(struct ionic_queue *q, +ionic_rx_clean(struct ionic_qcq *rxq, uint32_t q_desc_index, uint32_t cq_desc_index, void *service_cb_arg) { - struct ionic_rxq_comp *cq_desc_base = q->bound_cq->base; + struct ionic_queue *q = &rxq->q; + struct ionic_cq *cq = &rxq->cq; + struct ionic_rxq_comp *cq_desc_base = cq->base; struct ionic_rxq_comp *cq_desc = &cq_desc_base[cq_desc_index]; struct rte_mbuf *rxm, *rxm_seg; - struct ionic_qcq *rxq = IONIC_Q_TO_QCQ(q); uint32_t max_frame_size = rxq->lif->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; uint64_t pkt_flags = 0; @@ -1061,7 +1062,7 @@ ionic_rxq_service(struct ionic_qcq *rxq, uint32_t work_to_do, /* q desc info */ rte_prefetch0(&q->info[q->tail_idx]); - ionic_rx_clean(q, curr_q_tail_idx, curr_cq_tail_idx, + ionic_rx_clean(rxq, curr_q_tail_idx, curr_cq_tail_idx, service_cb_arg); } while (more); From patchwork Tue Feb 16 20:35:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87945 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 317F2A054D; Tue, 16 Feb 2021 21:36:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E5DDD1607C7; Tue, 16 Feb 2021 21:36:02 +0100 (CET) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by mails.dpdk.org (Postfix) with ESMTP id B80451607B8 for ; Tue, 16 Feb 2021 21:35:59 +0100 (CET) Received: by mail-pf1-f175.google.com with SMTP id z6so6920307pfq.0 for ; Tue, 16 Feb 2021 12:35:59 -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 :in-reply-to:references; bh=SCPKMQXYIlMchcolIA8CDN9Nqy1QDzBYx7dQUxAWZx4=; b=2VS1P4FOIV7a4QQY+k/R/1iLoUSZcwPn/iZusvW5nv224C2xFMNLjDOPNfp5qDy73Q euMF8YtqjS6Nb51tE7UM6jP7vocU+gv8k07Cyq7m73yR6nHxmwAvZdJXRy8dZnL6nqCK Z4P+Yxo8edTUvkUN2v0cw2Nnp67JIkbQlIafDHeEBe8NQGdTJMTILT8Vajc5IMipiur9 AigWWHUUnl+/6Lk7Tp9dbFxYwSlH4/no//tE3GwIopEaxifE5gKlpIaBIcIbUEPHiIpN SYpP+Qx1YBcPlfsZFVh4FDT7F7p0HC8NuexGtVrVfrR0LVE/VLmFOo70jNQSh/80+719 HIEQ== 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:in-reply-to:references; bh=SCPKMQXYIlMchcolIA8CDN9Nqy1QDzBYx7dQUxAWZx4=; b=Xc8ouipMAsJAOS3H0IUHQYE7vGJFtL58ykjqH0y9d5fzjpMjPXjCQ9z8tj6k7MmNpE MgCh69dmVtgHAbhMBY6dojys9K5QEXAYCv06AeEU/1dwlQq9dq+tSg1SWFN5X8Cn5dcE 4Le1G3MZYAWSG5vGuRDp020LPMlekiJfZdDYKzXy28jx7bCPFalr0KuicyK/9l+6m35b npAqabJxC0GLlb1CdFbuA6jPki24wyMEdX+J+qk4BrsBQP+7+AN9KjOe6uK7yCAJwqtH q8iqTeR7ZuBZjnK7TNuUcLHQNDosyncdYseHJGhWkcPpTRN0DZfm862sCfLDiIMLtsJA byAw== X-Gm-Message-State: AOAM533sQs5yLK8tfgk+XXGkxeYz/h63rhVM7fAI5jGnsSJ8hmqsXUw6 i89ktL5xCzmmk7IVatNe/OEgjl7d6RpdbA== X-Google-Smtp-Source: ABdhPJxNWKAZ4n0YM1Zuf+kFt4LOmVpCN/cpVc5EssKgu/lfYRxenX3ttvUkj80r5heaHHSLW8CqPw== X-Received: by 2002:a65:615a:: with SMTP id o26mr5000886pgv.315.1613507758755; Tue, 16 Feb 2021 12:35:58 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.35.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:35:58 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:31 -0800 Message-Id: <20210216203540.29290-7-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 06/15] net/ionic: remove unused interrupt free function 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" This will conserve resources. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 7 ------- drivers/net/ionic/ionic_lif.h | 1 - 2 files changed, 8 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 1ca6e050ad..462a526935 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -584,13 +584,6 @@ ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr) return 0; } -void -ionic_intr_free(struct ionic_lif *lif, struct ionic_intr_info *intr) -{ - if (intr->index != IONIC_INTR_NONE) - lif->adapter->intrs[intr->index] = false; -} - static int ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, uint32_t index, diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index c4cb7514fb..c850a9c08d 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -152,7 +152,6 @@ void ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask); void ionic_lif_reset(struct ionic_lif *lif); int 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); int ionic_qcq_service(struct ionic_qcq *qcq, int budget, ionic_cq_cb cb, void *cb_arg); From patchwork Tue Feb 16 20:35:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87946 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 7DBC5A054D; Tue, 16 Feb 2021 21:36:38 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 085211607CD; Tue, 16 Feb 2021 21:36:05 +0100 (CET) Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by mails.dpdk.org (Postfix) with ESMTP id BC9351607C2 for ; Tue, 16 Feb 2021 21:36:01 +0100 (CET) Received: by mail-pf1-f176.google.com with SMTP id m6so6918520pfk.1 for ; Tue, 16 Feb 2021 12:36:01 -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 :in-reply-to:references; bh=yXxLEiUiUYGS6f88OsxvOUORiURwXc7iMfT7uirt6+8=; b=YoHWendjY8DMIttQdQQDbZ0mLCkEeQrSVuBW4LJFgo/H+pY1en9tStJpMhpMcRkw6N 0pCrpCTdoF6Ty2aZPZhgiu0v8xIuxIWdHKRLb56tL+pJS6qPXURyK2l6geFrr/Vbi5fM kdaT5hHi2hEbwPZcs2OZxelu7QyIVsffakAEqTBQqfWN7EB0H/wQXQOGwlBhhUr1D+ef BCeS5P1WE9KoZKp9hE6QMRgRjJZQVDQ1D1mxSMqT7XVVXhIh6JPfyCXYMLpE0VP/m12b cArP7hMh+vtt7uGv5oLiKO+U4UJhKzGpWISlBD2BN0Ye613qhb9LfJ1G7BXb3oVtc31M 1fEQ== 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:in-reply-to:references; bh=yXxLEiUiUYGS6f88OsxvOUORiURwXc7iMfT7uirt6+8=; b=SLUZuR7OqQyPKOO64m5Qplvhowp8oK4Fmqh27DVXLAl7HRS9PQfG4vtYPCH5GQSfQZ vH+TCMsKxPEqpdGKmFDnbLYkopRgWcS2gSo/c/2QQcsEa4pRikn0KQUmr/d445nQxrDU 13uAa71ihQ8SrECVMqiso9kEGw3suLDmF+As5JufdjcaizKQy8q6VaJE2bXog5EReFbQ 7bVV1T5QJ3IF+qzip37hNDFYVTm/vaHj1lxAgft5bpIXM6WFP8PBpH7IWVV87H6apXpT LTXqpBOsyiAZnRoFE2bl1TJGF3NtxWgJk/dyXjrbH0IyrXddk8+YK76mNJawKplE7aTs acLg== X-Gm-Message-State: AOAM533aFFMso1j6eDvhCAGFQM7Gmt4iIRVbuGvXcNI/k9pLsTPAEQ4G ELOq2ZUdUTm7cjKe45ziZTeWUrngMo6UHg== X-Google-Smtp-Source: ABdhPJwBn/mrcf/wu1skYGOVRn7BwKtV3ekQ2ainrG90d87hIfYKwqNaARqnlX28Que+v+1FixM6Tg== X-Received: by 2002:a62:75d0:0:b029:1e7:9729:f312 with SMTP id q199-20020a6275d00000b02901e79729f312mr21083852pfc.49.1613507760604; Tue, 16 Feb 2021 12:36:00 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:36:00 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:32 -0800 Message-Id: <20210216203540.29290-8-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 07/15] net/ionic: cut down queue structure 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" This will conserve resources. Rename ionic_qcq_alloc() arg from 'base' to 'type_name' for clarity. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.c | 14 +++------- drivers/net/ionic/ionic_dev.h | 34 ++++++++++------------- drivers/net/ionic/ionic_lif.c | 49 ++++++++++++++++++++++------------ drivers/net/ionic/ionic_main.c | 4 +-- drivers/net/ionic/ionic_rxtx.c | 8 +++--- 5 files changed, 56 insertions(+), 53 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index 97fb8acf9b..cfaf4abc23 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -405,26 +405,20 @@ ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do, } int -ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev, - struct ionic_queue *q, uint32_t index, uint32_t num_descs, - size_t desc_size, size_t sg_desc_size) +ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs) { uint32_t ring_size; - if (desc_size == 0 || !rte_is_power_of_2(num_descs)) + if (!rte_is_power_of_2(num_descs)) return -EINVAL; ring_size = rte_log2_u32(num_descs); - if (ring_size < 2 || ring_size > 16) return -EINVAL; - q->lif = lif; - q->idev = idev; q->index = index; q->num_descs = num_descs; - q->desc_size = desc_size; - q->sg_desc_size = sg_desc_size; + q->size_mask = num_descs - 1; q->head_idx = 0; q->tail_idx = 0; @@ -450,7 +444,7 @@ ionic_q_post(struct ionic_queue *q, bool ring_doorbell, void *cb_arg) { q->info[q->head_idx] = cb_arg; - q->head_idx = (q->head_idx + 1) & (q->num_descs - 1); + q->head_idx = Q_NEXT_TO_POST(q, 1); if (ring_doorbell) ionic_q_flush(q); diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index a777695d64..2f27e63646 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -135,25 +135,21 @@ struct ionic_dev { #define IONIC_INFO_PTR(_q, _i) (&(_q)->info[IONIC_INFO_IDX((_q), _i)]) struct ionic_queue { - struct ionic_dev *idev; - struct ionic_lif *lif; - uint32_t index; - uint32_t type; - uint32_t hw_index; - uint32_t hw_type; + uint16_t num_descs; + uint16_t head_idx; + uint16_t tail_idx; + uint16_t size_mask; + uint8_t type; + uint8_t hw_type; void *base; void *sg_base; + struct ionic_doorbell __iomem *db; void **info; + + uint32_t index; + uint32_t hw_index; rte_iova_t base_pa; rte_iova_t sg_base_pa; - uint32_t tail_idx; - uint32_t head_idx; - uint32_t num_descs; - uint32_t desc_size; - uint32_t sg_desc_size; - uint32_t qid; - uint32_t qtype; - struct ionic_doorbell __iomem *db; }; #define IONIC_INTR_NONE (-1) @@ -220,22 +216,20 @@ struct ionic_doorbell __iomem *ionic_db_map(struct ionic_lif *lif, int ionic_cq_init(struct ionic_cq *cq, uint16_t num_descs); void ionic_cq_map(struct ionic_cq *cq, void *base, rte_iova_t base_pa); -typedef bool (*ionic_cq_cb)(struct ionic_cq *cq, uint32_t cq_desc_index, +typedef bool (*ionic_cq_cb)(struct ionic_cq *cq, uint16_t cq_desc_index, void *cb_arg); uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do, ionic_cq_cb cb, void *cb_arg); -int ionic_q_init(struct ionic_lif *lif, struct ionic_dev *idev, - struct ionic_queue *q, uint32_t index, uint32_t num_descs, - size_t desc_size, size_t sg_desc_size); +int ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs); void ionic_q_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); void ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, void *cb_arg); -static inline uint32_t +static inline uint16_t ionic_q_space_avail(struct ionic_queue *q) { - uint32_t avail = q->tail_idx; + uint16_t avail = q->tail_idx; if (q->head_idx >= avail) avail += q->num_descs - q->head_idx - 1; diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 462a526935..fcd6fca9a3 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -34,7 +34,7 @@ int ionic_qcq_enable(struct ionic_qcq *qcq) { struct ionic_queue *q = &qcq->q; - struct ionic_lif *lif = q->lif; + struct ionic_lif *lif = qcq->lif; struct ionic_admin_ctx ctx = { .pending_work = true, .cmd.q_control = { @@ -52,7 +52,7 @@ int ionic_qcq_disable(struct ionic_qcq *qcq) { struct ionic_queue *q = &qcq->q; - struct ionic_lif *lif = q->lif; + struct ionic_lif *lif = qcq->lif; struct ionic_admin_ctx ctx = { .pending_work = true, .cmd.q_control = { @@ -585,16 +585,17 @@ ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr) } static int -ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, +ionic_qcq_alloc(struct ionic_lif *lif, + uint8_t type, uint32_t index, - const char *base, uint32_t flags, - uint32_t num_descs, - uint32_t desc_size, - uint32_t cq_desc_size, - uint32_t sg_desc_size, + const char *type_name, + uint16_t flags, + uint16_t num_descs, + uint16_t desc_size, + uint16_t cq_desc_size, + uint16_t sg_desc_size, struct ionic_qcq **qcq) { - struct ionic_dev *idev = &lif->adapter->idev; struct ionic_qcq *new; uint32_t q_size, cq_size, sg_size, total_size; void *q_base, *cq_base, *sg_base; @@ -642,8 +643,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, new->q.type = type; - err = ionic_q_init(lif, idev, &new->q, index, num_descs, - desc_size, sg_desc_size); + err = ionic_q_init(&new->q, index, num_descs); if (err) { IONIC_PRINT(ERR, "Queue initialization failed"); goto err_out_free_info; @@ -656,7 +656,7 @@ ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, } new->base_z = rte_eth_dma_zone_reserve(lif->eth_dev, - base /* name */, index /* queue_idx */, + type_name, index /* queue_idx */, total_size, IONIC_ALIGN, socket_id); if (!new->base_z) { @@ -727,7 +727,11 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t index, uint16_t nrxq_descs, int err = -ENOMEM; flags = IONIC_QCQ_F_SG; - err = ionic_qcq_alloc(lif, IONIC_QTYPE_RXQ, index, "rx", flags, + err = ionic_qcq_alloc(lif, + IONIC_QTYPE_RXQ, + index, + "rx", + flags, nrxq_descs, sizeof(struct ionic_rxq_desc), sizeof(struct ionic_rxq_comp), @@ -749,7 +753,11 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, uint16_t ntxq_descs, int err = -ENOMEM; flags = IONIC_QCQ_F_SG; - err = ionic_qcq_alloc(lif, IONIC_QTYPE_TXQ, index, "tx", flags, + err = ionic_qcq_alloc(lif, + IONIC_QTYPE_TXQ, + index, + "tx", + flags, ntxq_descs, sizeof(struct ionic_txq_desc), sizeof(struct ionic_txq_comp), @@ -770,7 +778,11 @@ ionic_admin_qcq_alloc(struct ionic_lif *lif) int err = -ENOMEM; flags = 0; - err = ionic_qcq_alloc(lif, IONIC_QTYPE_ADMINQ, 0, "admin", flags, + err = ionic_qcq_alloc(lif, + IONIC_QTYPE_ADMINQ, + 0, + "admin", + flags, IONIC_ADMINQ_LENGTH, sizeof(struct ionic_admin_cmd), sizeof(struct ionic_admin_comp), @@ -790,7 +802,10 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif) uint32_t flags = 0; int err = -ENOMEM; - err = ionic_qcq_alloc(lif, IONIC_QTYPE_NOTIFYQ, 0, "notify", + err = ionic_qcq_alloc(lif, + IONIC_QTYPE_NOTIFYQ, + 0, + "notify", flags, IONIC_NOTIFYQ_LENGTH, sizeof(struct ionic_notifyq_cmd), @@ -1216,7 +1231,7 @@ ionic_lif_handle_fw_down(struct ionic_lif *lif) } static bool -ionic_notifyq_cb(struct ionic_cq *cq, uint32_t cq_desc_index, void *cb_arg) +ionic_notifyq_cb(struct ionic_cq *cq, uint16_t cq_desc_index, void *cb_arg) { union ionic_notifyq_comp *cq_desc_base = cq->base; union ionic_notifyq_comp *cq_desc = &cq_desc_base[cq_desc_index]; diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 12f2b26570..167a97dcf4 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -146,7 +146,7 @@ ionic_adminq_check_err(struct ionic_admin_ctx *ctx, bool timeout) } static bool -ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index, +ionic_adminq_service(struct ionic_cq *cq, uint16_t cq_desc_index, void *cb_arg __rte_unused) { struct ionic_admin_comp *cq_desc_base = cq->base; @@ -174,7 +174,7 @@ ionic_adminq_service(struct ionic_cq *cq, uint32_t cq_desc_index, } curr_q_tail_idx = q->tail_idx; - q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); } while (curr_q_tail_idx != stop_index); return true; diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index d615e5c4e1..6ecb500b9e 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -98,7 +98,7 @@ ionic_tx_flush(struct ionic_qcq *txq) while (q->tail_idx != comp_index) { info = IONIC_INFO_PTR(q, q->tail_idx); - q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); /* Prefetch the next 4 descriptors */ if ((q->tail_idx & 0x3) == 0) @@ -540,7 +540,7 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, while (nb_tx < nb_pkts) { last = (nb_tx == (nb_pkts - 1)); - next_q_head_idx = (q->head_idx + 1) & (q->num_descs - 1); + next_q_head_idx = Q_NEXT_TO_POST(q, 1); if ((next_q_head_idx & 0x3) == 0) { struct ionic_txq_desc *desc_base = q->base; rte_prefetch0(&desc_base[next_q_head_idx]); @@ -647,7 +647,7 @@ ionic_rx_empty(struct ionic_queue *q) mbuf = info[0]; rte_mempool_put(rxq->mb_pool, mbuf); - q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); } } @@ -1055,7 +1055,7 @@ ionic_rxq_service(struct ionic_qcq *rxq, uint32_t work_to_do, more = (q->tail_idx != cq_desc->comp_index); curr_q_tail_idx = q->tail_idx; - q->tail_idx = (q->tail_idx + 1) & (q->num_descs - 1); + q->tail_idx = Q_NEXT_TO_SRVC(q, 1); /* Prefetch the next 4 descriptors */ if ((q->tail_idx & 0x3) == 0) From patchwork Tue Feb 16 20:35:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87947 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 A6F55A054D; Tue, 16 Feb 2021 21:36:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CF741607D5; Tue, 16 Feb 2021 21:36:06 +0100 (CET) Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by mails.dpdk.org (Postfix) with ESMTP id C77ED1607BC for ; Tue, 16 Feb 2021 21:36:03 +0100 (CET) Received: by mail-pg1-f180.google.com with SMTP id o38so6978113pgm.9 for ; Tue, 16 Feb 2021 12:36:03 -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 :in-reply-to:references; bh=tv6zyfcbJqpRPJlBeZ3EEh+5KBi78P1MCzGOnxxVhTM=; b=rm8iafnt9hpae6WRTN059w7Kr79eS0uWpmY+2BXCHH2ceWYe/Q4S8h8pQWRY3N2UE7 6SQ78/uAt4s5uO7AtfwPpIQRUCWxLwOSUEV89cFpGD/1gj3BZHCzQag5jAdw1A2Uf9Hk xVWImmB86hzkz/UEHqUVAnPfjgVAA5D4qM5LUEkMRFYTDKsK3AEC7v1CVs3jhm06H9PU qWtHPySrMkFmzPyvpumENhHzSZPCRY3SPZfx/KsjIdExojvZBZARLH4RsmZvMre2swBd 1+DdsaJVx73RP5BIpJSHKx/bsAPou8Q378GstqZJId2gFxatm2Jq4blvJ9rcQXr+ecSU 9s5g== 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:in-reply-to:references; bh=tv6zyfcbJqpRPJlBeZ3EEh+5KBi78P1MCzGOnxxVhTM=; b=Hjl5SsjY7Oqss+dQ28zb3JdoNqwEACpkoo/RQz9MOev0/baMtk4V5VVxm+C4zeXmNL zJ4c9MzMsOkbgL9UfuCYLf1dH+1mZ8VTUd4SQhgppO6Xsz2cIpCmThkZJ3rNj3P8pZoB 4xbiIPc6MiQrpTr4dkYbtb9aqiyrkSTwVAk81wPx6CVoaZmSfKlhezOYHMAv86NzrFXW OE5Cod5wR3jHrCPsdSOTaica8RncNHdR7iRGm2E1FSjSGiF3Adsfp1liVkMV+/S2Kl4y LfsID15st+tZ1Q0oc55aBU8HhZiZXHdm2l2UP1GL0y3TlRgNetGmjGZntV1udWQ5ka8d ohaQ== X-Gm-Message-State: AOAM532tI+IT5n0RtURsNj4zkS0yalb/Qj3Rw83//bvMIJuwzgMDo7p6 mX1foYPYu6lvgBygfrTAXe2MOYtiCPAKww== X-Google-Smtp-Source: ABdhPJz+MnnM6aKSncToEZFqpdSSTJIa8ImNXzjqUTQNKAtEUJ41rsyQNoRPgq1izKG6fxjXk+gXhA== X-Received: by 2002:a63:1157:: with SMTP id 23mr21074091pgr.418.1613507762336; Tue, 16 Feb 2021 12:36:02 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.36.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:36:01 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:33 -0800 Message-Id: <20210216203540.29290-9-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 08/15] net/ionic: split up queue-completion queue structure 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" Create a unique Q-CQ struct for adminq, notifyq, rxq, and txq to reduce the size of each object. Minimize the size of each field to squeeze into as few cachelines as possible. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 153 ++++++++++++++++++--------------- drivers/net/ionic/ionic_lif.h | 62 +++++++++---- drivers/net/ionic/ionic_main.c | 4 +- drivers/net/ionic/ionic_rxtx.c | 129 +++++++++++++-------------- 4 files changed, 195 insertions(+), 153 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index fcd6fca9a3..87579a09e5 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -76,13 +76,13 @@ ionic_lif_stop(struct ionic_lif *lif) lif->state &= ~IONIC_LIF_F_UP; for (i = 0; i < lif->nrxqcqs; i++) { - struct ionic_qcq *rxq = lif->rxqcqs[i]; + struct ionic_rx_qcq *rxq = lif->rxqcqs[i]; if (rxq->flags & IONIC_QCQ_F_INITED) (void)ionic_dev_rx_queue_stop(lif->eth_dev, i); } for (i = 0; i < lif->ntxqcqs; i++) { - struct ionic_qcq *txq = lif->txqcqs[i]; + struct ionic_tx_qcq *txq = lif->txqcqs[i]; if (txq->flags & IONIC_QCQ_F_INITED) (void)ionic_dev_tx_queue_stop(lif->eth_dev, i); } @@ -131,7 +131,7 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats ls->rx_bcast_bytes; for (i = 0; i < lif->nrxqcqs; i++) { - struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats.rx; + struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats; stats->imissed += rx_stats->no_cb_arg + rx_stats->bad_cq_status + @@ -152,7 +152,7 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats ls->rx_desc_data_error; for (i = 0; i < num_rx_q_counters; i++) { - struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats.rx; + struct ionic_rx_stats *rx_stats = &lif->rxqcqs[i]->stats; stats->q_ipackets[i] = rx_stats->packets; stats->q_ibytes[i] = rx_stats->bytes; stats->q_errors[i] = @@ -173,7 +173,7 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats ls->tx_bcast_bytes; for (i = 0; i < lif->ntxqcqs; i++) { - struct ionic_tx_stats *tx_stats = &lif->txqcqs[i]->stats.tx; + struct ionic_tx_stats *tx_stats = &lif->txqcqs[i]->stats; stats->oerrors += tx_stats->drop; } @@ -189,7 +189,7 @@ ionic_lif_get_abs_stats(const struct ionic_lif *lif, struct rte_eth_stats *stats ls->tx_desc_data_error; for (i = 0; i < num_tx_q_counters; i++) { - struct ionic_tx_stats *tx_stats = &lif->txqcqs[i]->stats.tx; + struct ionic_tx_stats *tx_stats = &lif->txqcqs[i]->stats; stats->q_opackets[i] = tx_stats->packets; stats->q_obytes[i] = tx_stats->bytes; } @@ -217,9 +217,9 @@ ionic_lif_reset_stats(struct ionic_lif *lif) uint32_t i; for (i = 0; i < lif->nrxqcqs; i++) { - memset(&lif->rxqcqs[i]->stats.rx, 0, + memset(&lif->rxqcqs[i]->stats, 0, sizeof(struct ionic_rx_stats)); - memset(&lif->txqcqs[i]->stats.tx, 0, + memset(&lif->txqcqs[i]->stats, 0, sizeof(struct ionic_tx_stats)); } @@ -587,6 +587,7 @@ ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr) static int ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, + size_t struct_size, uint32_t index, const char *type_name, uint16_t flags, @@ -625,16 +626,17 @@ ionic_qcq_alloc(struct ionic_lif *lif, total_size += PAGE_SIZE; } - new = rte_zmalloc("ionic", sizeof(*new), 0); + new = rte_zmalloc("ionic", struct_size, 0); if (!new) { IONIC_PRINT(ERR, "Cannot allocate queue structure"); return -ENOMEM; } new->lif = lif; - new->flags = flags; - new->q.info = rte_zmalloc("ionic", sizeof(*new->q.info) * num_descs, 0); + new->q.info = rte_calloc_socket("ionic", + num_descs, sizeof(void *), + PAGE_SIZE, socket_id); if (!new->q.info) { IONIC_PRINT(ERR, "Cannot allocate queue info"); err = -ENOMEM; @@ -667,7 +669,6 @@ ionic_qcq_alloc(struct ionic_lif *lif, new->base = new->base_z->addr; new->base_pa = new->base_z->iova; - new->total_size = total_size; q_base = new->base; q_base_pa = new->base_pa; @@ -720,15 +721,17 @@ ionic_qcq_free(struct ionic_qcq *qcq) } int -ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t index, uint16_t nrxq_descs, - struct ionic_qcq **qcq) +ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t index, + uint16_t nrxq_descs, struct ionic_rx_qcq **rxq_out) { - uint32_t flags; - int err = -ENOMEM; + struct ionic_rx_qcq *rxq; + uint16_t flags; + int err; flags = IONIC_QCQ_F_SG; err = ionic_qcq_alloc(lif, IONIC_QTYPE_RXQ, + sizeof(struct ionic_rx_qcq), index, "rx", flags, @@ -736,25 +739,30 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t index, uint16_t nrxq_descs, sizeof(struct ionic_rxq_desc), sizeof(struct ionic_rxq_comp), sizeof(struct ionic_rxq_sg_desc), - &lif->rxqcqs[index]); + (struct ionic_qcq **)&rxq); if (err) return err; - *qcq = lif->rxqcqs[index]; + rxq->flags = flags; + + lif->rxqcqs[index] = rxq; + *rxq_out = rxq; return 0; } int -ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, uint16_t ntxq_descs, - struct ionic_qcq **qcq) +ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, + uint16_t ntxq_descs, struct ionic_tx_qcq **txq_out) { - uint32_t flags; - int err = -ENOMEM; + struct ionic_tx_qcq *txq; + uint16_t flags; + int err; flags = IONIC_QCQ_F_SG; err = ionic_qcq_alloc(lif, IONIC_QTYPE_TXQ, + sizeof(struct ionic_tx_qcq), index, "tx", flags, @@ -762,11 +770,14 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, uint16_t ntxq_descs, sizeof(struct ionic_txq_desc), sizeof(struct ionic_txq_comp), sizeof(struct ionic_txq_sg_desc_v1), - &lif->txqcqs[index]); + (struct ionic_qcq **)&txq); if (err) return err; - *qcq = lif->txqcqs[index]; + txq->flags = flags; + + lif->txqcqs[index] = txq; + *txq_out = txq; return 0; } @@ -774,12 +785,12 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, uint16_t ntxq_descs, static int ionic_admin_qcq_alloc(struct ionic_lif *lif) { - uint32_t flags; - int err = -ENOMEM; + uint16_t flags = 0; + int err; - flags = 0; err = ionic_qcq_alloc(lif, IONIC_QTYPE_ADMINQ, + sizeof(struct ionic_admin_qcq), 0, "admin", flags, @@ -787,7 +798,7 @@ ionic_admin_qcq_alloc(struct ionic_lif *lif) sizeof(struct ionic_admin_cmd), sizeof(struct ionic_admin_comp), 0, - &lif->adminqcq); + (struct ionic_qcq **)&lif->adminqcq); if (err) return err; @@ -797,13 +808,14 @@ ionic_admin_qcq_alloc(struct ionic_lif *lif) static int ionic_notify_qcq_alloc(struct ionic_lif *lif) { - struct ionic_qcq *nqcq; + struct ionic_notify_qcq *nqcq; struct ionic_dev *idev = &lif->adapter->idev; - uint32_t flags = 0; - int err = -ENOMEM; + uint16_t flags = 0; + int err; err = ionic_qcq_alloc(lif, IONIC_QTYPE_NOTIFYQ, + sizeof(struct ionic_notify_qcq), 0, "notify", flags, @@ -811,13 +823,13 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif) sizeof(struct ionic_notifyq_cmd), sizeof(union ionic_notifyq_comp), 0, - &nqcq); + (struct ionic_qcq **)&nqcq); if (err) return err; err = ionic_intr_alloc(lif, &nqcq->intr); if (err) { - ionic_qcq_free(nqcq); + ionic_qcq_free(&nqcq->qcq); return err; } @@ -1002,12 +1014,12 @@ void ionic_lif_free(struct ionic_lif *lif) { if (lif->notifyqcq) { - ionic_qcq_free(lif->notifyqcq); + ionic_qcq_free(&lif->notifyqcq->qcq); lif->notifyqcq = NULL; } if (lif->adminqcq) { - ionic_qcq_free(lif->adminqcq); + ionic_qcq_free(&lif->adminqcq->qcq); lif->adminqcq = NULL; } @@ -1137,28 +1149,28 @@ ionic_lif_rss_teardown(struct ionic_lif *lif) } } -static void -ionic_lif_qcq_deinit(struct ionic_qcq *qcq) +void +ionic_lif_txq_deinit(struct ionic_tx_qcq *txq) { - qcq->flags &= ~IONIC_QCQ_F_INITED; + txq->flags &= ~IONIC_QCQ_F_INITED; } void -ionic_lif_txq_deinit(struct ionic_qcq *qcq) +ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq) { - ionic_lif_qcq_deinit(qcq); + rxq->flags &= ~IONIC_QCQ_F_INITED; } -void -ionic_lif_rxq_deinit(struct ionic_qcq *qcq) +static void +ionic_lif_adminq_deinit(struct ionic_lif *lif) { - ionic_lif_qcq_deinit(qcq); + lif->adminqcq->flags &= ~IONIC_QCQ_F_INITED; } static void ionic_lif_notifyq_deinit(struct ionic_lif *lif) { - struct ionic_qcq *nqcq = lif->notifyqcq; + struct ionic_notify_qcq *nqcq = lif->notifyqcq; struct ionic_dev *idev = &lif->adapter->idev; if (!(nqcq->flags & IONIC_QCQ_F_INITED)) @@ -1283,26 +1295,27 @@ int ionic_notifyq_handler(struct ionic_lif *lif, int budget) { struct ionic_dev *idev = &lif->adapter->idev; - struct ionic_qcq *qcq = lif->notifyqcq; + struct ionic_notify_qcq *nqcq = lif->notifyqcq; uint32_t work_done; - if (!(qcq->flags & IONIC_QCQ_F_INITED)) { + if (!(nqcq->flags & IONIC_QCQ_F_INITED)) { IONIC_PRINT(DEBUG, "Notifyq not yet initialized"); return -1; } - ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, + ionic_intr_mask(idev->intr_ctrl, nqcq->intr.index, IONIC_INTR_MASK_SET); - work_done = ionic_qcq_service(qcq, budget, ionic_notifyq_cb, lif); + work_done = ionic_qcq_service(&nqcq->qcq, budget, + ionic_notifyq_cb, lif); if (lif->state & IONIC_LIF_F_LINK_CHECK_NEEDED) ionic_link_status_check(lif); - ionic_intr_credits(idev->intr_ctrl, qcq->intr.index, + ionic_intr_credits(idev->intr_ctrl, nqcq->intr.index, work_done, IONIC_INTR_CRED_RESET_COALESCE); - ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, + ionic_intr_mask(idev->intr_ctrl, nqcq->intr.index, IONIC_INTR_MASK_CLEAR); return 0; @@ -1312,12 +1325,12 @@ static int ionic_lif_adminq_init(struct ionic_lif *lif) { struct ionic_dev *idev = &lif->adapter->idev; - struct ionic_qcq *qcq = lif->adminqcq; - struct ionic_queue *q = &qcq->q; + struct ionic_admin_qcq *aqcq = lif->adminqcq; + struct ionic_queue *q = &aqcq->qcq.q; struct ionic_q_init_comp comp; int err; - ionic_dev_cmd_adminq_init(idev, qcq); + ionic_dev_cmd_adminq_init(idev, &aqcq->qcq); err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); if (err) return err; @@ -1332,7 +1345,7 @@ 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); - qcq->flags |= IONIC_QCQ_F_INITED; + aqcq->flags |= IONIC_QCQ_F_INITED; return 0; } @@ -1341,8 +1354,8 @@ static int ionic_lif_notifyq_init(struct ionic_lif *lif) { struct ionic_dev *idev = &lif->adapter->idev; - struct ionic_qcq *qcq = lif->notifyqcq; - struct ionic_queue *q = &qcq->q; + struct ionic_notify_qcq *nqcq = lif->notifyqcq; + struct ionic_queue *q = &nqcq->qcq.q; int err; struct ionic_admin_ctx ctx = { @@ -1352,7 +1365,7 @@ ionic_lif_notifyq_init(struct ionic_lif *lif) .type = q->type, .ver = lif->qtype_info[q->type].version, .index = rte_cpu_to_le_32(q->index), - .intr_index = rte_cpu_to_le_16(qcq->intr.index), + .intr_index = rte_cpu_to_le_16(nqcq->intr.index), .flags = rte_cpu_to_le_16(IONIC_QINIT_F_IRQ | IONIC_QINIT_F_ENA), .ring_size = rte_log2_u32(q->num_descs), @@ -1378,10 +1391,10 @@ 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); - ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, + ionic_intr_mask(idev->intr_ctrl, nqcq->intr.index, IONIC_INTR_MASK_CLEAR); - qcq->flags |= IONIC_QCQ_F_INITED; + nqcq->flags |= IONIC_QCQ_F_INITED; return 0; } @@ -1445,8 +1458,9 @@ ionic_lif_set_features(struct ionic_lif *lif) } int -ionic_lif_txq_init(struct ionic_qcq *qcq) +ionic_lif_txq_init(struct ionic_tx_qcq *txq) { + struct ionic_qcq *qcq = &txq->qcq; struct ionic_queue *q = &qcq->q; struct ionic_lif *lif = qcq->lif; struct ionic_cq *cq = &qcq->cq; @@ -1474,7 +1488,7 @@ ionic_lif_txq_init(struct ionic_qcq *qcq) ctx.cmd.q_init.ring_size); IONIC_PRINT(DEBUG, "txq_init.ver %u", ctx.cmd.q_init.ver); - err = ionic_adminq_post_wait(qcq->lif, &ctx); + err = ionic_adminq_post_wait(lif, &ctx); if (err) return err; @@ -1486,14 +1500,15 @@ ionic_lif_txq_init(struct ionic_qcq *qcq) IONIC_PRINT(DEBUG, "txq->hw_index %d", q->hw_index); IONIC_PRINT(DEBUG, "txq->db %p", q->db); - qcq->flags |= IONIC_QCQ_F_INITED; + txq->flags |= IONIC_QCQ_F_INITED; return 0; } int -ionic_lif_rxq_init(struct ionic_qcq *qcq) +ionic_lif_rxq_init(struct ionic_rx_qcq *rxq) { + struct ionic_qcq *qcq = &rxq->qcq; struct ionic_queue *q = &qcq->q; struct ionic_lif *lif = qcq->lif; struct ionic_cq *cq = &qcq->cq; @@ -1521,7 +1536,7 @@ ionic_lif_rxq_init(struct ionic_qcq *qcq) ctx.cmd.q_init.ring_size); IONIC_PRINT(DEBUG, "rxq_init.ver %u", ctx.cmd.q_init.ver); - err = ionic_adminq_post_wait(qcq->lif, &ctx); + err = ionic_adminq_post_wait(lif, &ctx); if (err) return err; @@ -1529,7 +1544,7 @@ ionic_lif_rxq_init(struct ionic_qcq *qcq) q->hw_index = rte_le_to_cpu_32(ctx.comp.q_init.hw_index); q->db = ionic_db_map(lif, q); - qcq->flags |= IONIC_QCQ_F_INITED; + rxq->flags |= IONIC_QCQ_F_INITED; IONIC_PRINT(DEBUG, "rxq->hw_type %d", q->hw_type); IONIC_PRINT(DEBUG, "rxq->hw_index %d", q->hw_index); @@ -1634,7 +1649,7 @@ ionic_lif_init(struct ionic_lif *lif) ionic_lif_notifyq_deinit(lif); err_out_adminq_deinit: - ionic_lif_qcq_deinit(lif->adminqcq); + ionic_lif_adminq_deinit(lif); return err; } @@ -1648,7 +1663,7 @@ ionic_lif_deinit(struct ionic_lif *lif) ionic_rx_filters_deinit(lif); ionic_lif_rss_teardown(lif); ionic_lif_notifyq_deinit(lif); - ionic_lif_qcq_deinit(lif->adminqcq); + ionic_lif_adminq_deinit(lif); lif->state &= ~IONIC_LIF_F_INITED; } @@ -1788,7 +1803,7 @@ ionic_lif_start(struct ionic_lif *lif) lif->nrxqcqs, lif->ntxqcqs, lif->port_id); for (i = 0; i < lif->nrxqcqs; i++) { - struct ionic_qcq *rxq = lif->rxqcqs[i]; + struct ionic_rx_qcq *rxq = lif->rxqcqs[i]; if (!(rxq->flags & IONIC_QCQ_F_DEFERRED)) { err = ionic_dev_rx_queue_start(lif->eth_dev, i); @@ -1798,7 +1813,7 @@ ionic_lif_start(struct ionic_lif *lif) } for (i = 0; i < lif->ntxqcqs; i++) { - struct ionic_qcq *txq = lif->txqcqs[i]; + struct ionic_tx_qcq *txq = lif->txqcqs[i]; if (!(txq->flags & IONIC_QCQ_F_DEFERRED)) { err = ionic_dev_tx_queue_start(lif->eth_dev, i); diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index c850a9c08d..a8243ebf21 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -58,23 +58,47 @@ struct ionic_qcq { struct ionic_queue q; /**< Queue */ struct ionic_cq cq; /**< Completion Queue */ struct ionic_lif *lif; /**< LIF */ - struct rte_mempool *mb_pool; /**< mbuf pool to populate the RX ring */ - union { - struct ionic_tx_stats tx; - struct ionic_rx_stats rx; - } stats; const struct rte_memzone *base_z; void *base; rte_iova_t base_pa; - uint32_t total_size; - uint32_t flags; +}; + +struct ionic_admin_qcq { + struct ionic_qcq qcq; + uint16_t flags; +}; + +struct ionic_notify_qcq { + struct ionic_qcq qcq; + uint16_t flags; + struct ionic_intr_info intr; }; +struct ionic_rx_qcq { + /* cacheline0, cacheline1 */ + struct ionic_qcq qcq; + + /* cacheline2 */ + struct rte_mempool *mb_pool; + uint16_t flags; + + /* cacheline3 (inside stats) */ + struct ionic_rx_stats stats; +}; + +struct ionic_tx_qcq { + /* cacheline0, cacheline1 */ + struct ionic_qcq qcq; + + /* cacheline2 */ + uint16_t flags; + + struct ionic_tx_stats stats; +}; + #define IONIC_Q_TO_QCQ(_q) container_of(_q, struct ionic_qcq, q) #define IONIC_CQ_TO_QCQ(_cq) container_of(_cq, struct ionic_qcq, cq) -#define IONIC_Q_TO_TX_STATS(q) (&IONIC_Q_TO_QCQ(q)->stats.tx) -#define IONIC_Q_TO_RX_STATS(q) (&IONIC_Q_TO_QCQ(q)->stats.rx) struct ionic_qtype_info { uint8_t version; @@ -104,10 +128,10 @@ struct ionic_lif { uint32_t nrxqcqs; rte_spinlock_t adminq_lock; rte_spinlock_t adminq_service_lock; - struct ionic_qcq *adminqcq; - struct ionic_qcq *notifyqcq; - struct ionic_qcq **txqcqs; - struct ionic_qcq **rxqcqs; + struct ionic_admin_qcq *adminqcq; + struct ionic_notify_qcq *notifyqcq; + struct ionic_tx_qcq **txqcqs; + struct ionic_rx_qcq **rxqcqs; struct ionic_rx_filters rx_filters; struct ionic_doorbell __iomem *kern_dbpage; uint64_t last_eid; @@ -173,19 +197,19 @@ int ionic_dev_allmulticast_enable(struct rte_eth_dev *dev); int ionic_dev_allmulticast_disable(struct rte_eth_dev *dev); int ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t index, - uint16_t nrxq_descs, struct ionic_qcq **qcq); + uint16_t nrxq_descs, struct ionic_rx_qcq **qcq_out); int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, - uint16_t ntxq_descs, struct ionic_qcq **qcq); + uint16_t ntxq_descs, struct ionic_tx_qcq **qcq_out); void ionic_qcq_free(struct ionic_qcq *qcq); int ionic_qcq_enable(struct ionic_qcq *qcq); int ionic_qcq_disable(struct ionic_qcq *qcq); -int ionic_lif_rxq_init(struct ionic_qcq *qcq); -void ionic_lif_rxq_deinit(struct ionic_qcq *qcq); +int ionic_lif_rxq_init(struct ionic_rx_qcq *rxq); +void ionic_lif_rxq_deinit(struct ionic_rx_qcq *rxq); -int ionic_lif_txq_init(struct ionic_qcq *qcq); -void ionic_lif_txq_deinit(struct ionic_qcq *qcq); +int ionic_lif_txq_init(struct ionic_tx_qcq *txq); +void ionic_lif_txq_deinit(struct ionic_tx_qcq *txq); int ionic_lif_rss_config(struct ionic_lif *lif, const uint16_t types, const uint8_t *key, const uint32_t *indir); diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 167a97dcf4..0d2e02fdd0 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -194,7 +194,7 @@ ionic_adminq_service(struct ionic_cq *cq, uint16_t cq_desc_index, static int ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) { - struct ionic_queue *q = &lif->adminqcq->q; + struct ionic_queue *q = &lif->adminqcq->qcq.q; struct ionic_admin_cmd *q_desc_base = q->base; struct ionic_admin_cmd *q_desc; int err = 0; @@ -234,7 +234,7 @@ ionic_adminq_wait_for_completion(struct ionic_lif *lif, */ rte_spinlock_lock(&lif->adminq_service_lock); - ionic_qcq_service(lif->adminqcq, budget, + ionic_qcq_service(&lif->adminqcq->qcq, budget, ionic_adminq_service, NULL); rte_spinlock_unlock(&lif->adminq_service_lock); diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 6ecb500b9e..5f836f0134 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -59,8 +59,8 @@ void ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo) { - struct ionic_qcq *txq = dev->data->tx_queues[queue_id]; - struct ionic_queue *q = &txq->q; + struct ionic_tx_qcq *txq = dev->data->tx_queues[queue_id]; + struct ionic_queue *q = &txq->qcq.q; qinfo->nb_desc = q->num_descs; qinfo->conf.offloads = dev->data->dev_conf.txmode.offloads; @@ -68,10 +68,10 @@ ionic_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, } static __rte_always_inline void -ionic_tx_flush(struct ionic_qcq *txq) +ionic_tx_flush(struct ionic_tx_qcq *txq) { - struct ionic_cq *cq = &txq->cq; - struct ionic_queue *q = &txq->q; + struct ionic_cq *cq = &txq->qcq.cq; + struct ionic_queue *q = &txq->qcq.q; struct rte_mbuf *txm, *next; struct ionic_txq_comp *cq_desc_base = cq->base; struct ionic_txq_comp *cq_desc; @@ -122,19 +122,19 @@ ionic_tx_flush(struct ionic_qcq *txq) void __rte_cold ionic_dev_tx_queue_release(void *tx_queue) { - struct ionic_qcq *txq = (struct ionic_qcq *)tx_queue; + struct ionic_tx_qcq *txq = tx_queue; IONIC_PRINT_CALL(); ionic_lif_txq_deinit(txq); - ionic_qcq_free(txq); + ionic_qcq_free(&txq->qcq); } int __rte_cold ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) { - struct ionic_qcq *txq; + struct ionic_tx_qcq *txq; IONIC_PRINT(DEBUG, "Stopping TX queue %u", tx_queue_id); @@ -148,7 +148,7 @@ ionic_dev_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) * before disabling Tx queue */ - ionic_qcq_disable(txq); + ionic_qcq_disable(&txq->qcq); ionic_tx_flush(txq); @@ -161,7 +161,7 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, const struct rte_eth_txconf *tx_conf) { struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); - struct ionic_qcq *txq; + struct ionic_tx_qcq *txq; uint64_t offloads; int err; @@ -221,7 +221,7 @@ int __rte_cold ionic_dev_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) { uint8_t *tx_queue_state = eth_dev->data->tx_queue_state; - struct ionic_qcq *txq; + struct ionic_tx_qcq *txq; int err; if (tx_queue_state[tx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) { @@ -233,14 +233,14 @@ ionic_dev_tx_queue_start(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id) txq = eth_dev->data->tx_queues[tx_queue_id]; IONIC_PRINT(DEBUG, "Starting TX queue %u, %u descs", - tx_queue_id, txq->q.num_descs); + tx_queue_id, txq->qcq.q.num_descs); if (!(txq->flags & IONIC_QCQ_F_INITED)) { err = ionic_lif_txq_init(txq); if (err) return err; } else { - ionic_qcq_enable(txq); + ionic_qcq_enable(&txq->qcq); } tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; @@ -315,8 +315,9 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc, } static struct ionic_txq_desc * -ionic_tx_tso_next(struct ionic_queue *q, struct ionic_txq_sg_elem **elem) +ionic_tx_tso_next(struct ionic_tx_qcq *txq, struct ionic_txq_sg_elem **elem) { + struct ionic_queue *q = &txq->qcq.q; struct ionic_txq_desc *desc_base = q->base; struct ionic_txq_sg_desc_v1 *sg_desc_base = q->sg_base; struct ionic_txq_desc *desc = &desc_base[q->head_idx]; @@ -327,11 +328,11 @@ ionic_tx_tso_next(struct ionic_queue *q, struct ionic_txq_sg_elem **elem) } static int -ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm, +ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, bool not_xmit_more) { - struct ionic_queue *q = &txq->q; - struct ionic_tx_stats *stats = IONIC_Q_TO_TX_STATS(q); + struct ionic_queue *q = &txq->qcq.q; + struct ionic_tx_stats *stats = &txq->stats; struct ionic_txq_desc *desc; struct ionic_txq_sg_elem *elem; struct rte_mbuf *txm_seg; @@ -375,7 +376,7 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm, left = txm->data_len; data_iova = rte_mbuf_data_iova(txm); - desc = ionic_tx_tso_next(q, &elem); + desc = ionic_tx_tso_next(txq, &elem); start = true; /* Chop data up into desc segments */ @@ -397,7 +398,7 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm, encap, vlan_tci, has_vlan, start, done && not_xmit_more); - desc = ionic_tx_tso_next(q, &elem); + desc = ionic_tx_tso_next(txq, &elem); start = false; seglen = mss; } @@ -439,7 +440,7 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm, encap, vlan_tci, has_vlan, start, done && not_xmit_more); - desc = ionic_tx_tso_next(q, &elem); + desc = ionic_tx_tso_next(txq, &elem); start = false; } @@ -452,16 +453,14 @@ ionic_tx_tso(struct ionic_qcq *txq, struct rte_mbuf *txm, } static __rte_always_inline int -ionic_tx(struct ionic_qcq *txq, struct rte_mbuf *txm, +ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, bool not_xmit_more) { - struct ionic_queue *q = &txq->q; - struct ionic_txq_desc *desc_base = q->base; + struct ionic_queue *q = &txq->qcq.q; + struct ionic_txq_desc *desc, *desc_base = q->base; struct ionic_txq_sg_desc_v1 *sg_desc_base = q->sg_base; - struct ionic_txq_desc *desc = &desc_base[q->head_idx]; - struct ionic_txq_sg_desc_v1 *sg_desc = &sg_desc_base[q->head_idx]; - struct ionic_txq_sg_elem *elem = sg_desc->elems; - struct ionic_tx_stats *stats = IONIC_Q_TO_TX_STATS(q); + struct ionic_txq_sg_elem *elem; + struct ionic_tx_stats *stats = &txq->stats; struct rte_mbuf *txm_seg; bool encap; bool has_vlan; @@ -470,6 +469,8 @@ ionic_tx(struct ionic_qcq *txq, struct rte_mbuf *txm, uint8_t opcode = IONIC_TXQ_DESC_OPCODE_CSUM_NONE; uint8_t flags = 0; + desc = &desc_base[q->head_idx]; + if ((ol_flags & PKT_TX_IP_CKSUM) && (txq->flags & IONIC_QCQ_F_CSUM_L3)) { opcode = IONIC_TXQ_DESC_OPCODE_CSUM_HW; @@ -502,6 +503,7 @@ ionic_tx(struct ionic_qcq *txq, struct rte_mbuf *txm, desc->len = txm->data_len; desc->vlan_tci = txm->vlan_tci; + elem = sg_desc_base[q->head_idx].elems; txm_seg = txm->next; while (txm_seg != NULL) { elem->len = txm_seg->data_len; @@ -520,9 +522,9 @@ uint16_t ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { - struct ionic_qcq *txq = (struct ionic_qcq *)tx_queue; - struct ionic_queue *q = &txq->q; - struct ionic_tx_stats *stats = IONIC_Q_TO_TX_STATS(q); + struct ionic_tx_qcq *txq = tx_queue; + struct ionic_queue *q = &txq->qcq.q; + struct ionic_tx_stats *stats = &txq->stats; uint32_t next_q_head_idx; uint32_t bytes_tx = 0; uint16_t nb_tx = 0; @@ -625,8 +627,8 @@ void ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo) { - struct ionic_qcq *rxq = dev->data->rx_queues[queue_id]; - struct ionic_queue *q = &rxq->q; + struct ionic_rx_qcq *rxq = dev->data->rx_queues[queue_id]; + struct ionic_queue *q = &rxq->qcq.q; qinfo->mp = rxq->mb_pool; qinfo->scattered_rx = dev->data->scattered_rx; @@ -636,9 +638,9 @@ ionic_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, } static void __rte_cold -ionic_rx_empty(struct ionic_queue *q) +ionic_rx_empty(struct ionic_rx_qcq *rxq) { - struct ionic_qcq *rxq = IONIC_Q_TO_QCQ(q); + struct ionic_queue *q = &rxq->qcq.q; struct rte_mbuf *mbuf; void **info; @@ -654,15 +656,18 @@ ionic_rx_empty(struct ionic_queue *q) void __rte_cold ionic_dev_rx_queue_release(void *rx_queue) { - struct ionic_qcq *rxq = (struct ionic_qcq *)rx_queue; + struct ionic_rx_qcq *rxq = rx_queue; + + if (!rxq) + return; IONIC_PRINT_CALL(); - ionic_rx_empty(&rxq->q); + ionic_rx_empty(rxq); ionic_lif_rxq_deinit(rxq); - ionic_qcq_free(rxq); + ionic_qcq_free(&rxq->qcq); } int __rte_cold @@ -674,7 +679,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, struct rte_mempool *mp) { struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev); - struct ionic_qcq *rxq; + struct ionic_rx_qcq *rxq; uint64_t offloads; int err; @@ -713,7 +718,8 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; - err = ionic_rx_qcq_alloc(lif, rx_queue_id, nb_desc, &rxq); + err = ionic_rx_qcq_alloc(lif, rx_queue_id, nb_desc, + &rxq); if (err) { IONIC_PRINT(ERR, "Queue %d allocation failure", rx_queue_id); return -EINVAL; @@ -741,20 +747,20 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, } static __rte_always_inline void -ionic_rx_clean(struct ionic_qcq *rxq, +ionic_rx_clean(struct ionic_rx_qcq *rxq, uint32_t q_desc_index, uint32_t cq_desc_index, void *service_cb_arg) { - struct ionic_queue *q = &rxq->q; - struct ionic_cq *cq = &rxq->cq; + struct ionic_queue *q = &rxq->qcq.q; + struct ionic_cq *cq = &rxq->qcq.cq; struct ionic_rxq_comp *cq_desc_base = cq->base; struct ionic_rxq_comp *cq_desc = &cq_desc_base[cq_desc_index]; struct rte_mbuf *rxm, *rxm_seg; uint32_t max_frame_size = - rxq->lif->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; + rxq->qcq.lif->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; uint64_t pkt_flags = 0; uint32_t pkt_type; - struct ionic_rx_stats *stats = IONIC_Q_TO_RX_STATS(q); + struct ionic_rx_stats *stats = &rxq->stats; struct ionic_rx_service *recv_args = (struct ionic_rx_service *) service_cb_arg; uint32_t buf_size = (uint16_t) @@ -803,7 +809,7 @@ ionic_rx_clean(struct ionic_qcq *rxq, rte_prefetch1((char *)rxm->buf_addr + rxm->data_off); rxm->nb_segs = 1; /* cq_desc->num_sg_elems */ rxm->pkt_len = cq_desc->len; - rxm->port = rxq->lif->port_id; + rxm->port = rxq->qcq.lif->port_id; left = cq_desc->len; @@ -909,13 +915,11 @@ ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index, } static __rte_always_inline int -ionic_rx_fill(struct ionic_qcq *rxq, uint32_t len) +ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) { - struct ionic_queue *q = &rxq->q; - struct ionic_rxq_desc *desc_base = q->base; - struct ionic_rxq_sg_desc *sg_desc_base = q->sg_base; - struct ionic_rxq_desc *desc; - struct ionic_rxq_sg_desc *sg_desc; + struct ionic_queue *q = &rxq->qcq.q; + struct ionic_rxq_desc *desc, *desc_base = q->base; + struct ionic_rxq_sg_desc *sg_desc, *sg_desc_base = q->sg_base; struct ionic_rxq_sg_elem *elem; rte_iova_t dma_addr; uint32_t i, j, nsegs, buf_size, size; @@ -990,7 +994,7 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { uint32_t frame_size = eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; uint8_t *rx_queue_state = eth_dev->data->rx_queue_state; - struct ionic_qcq *rxq; + struct ionic_rx_qcq *rxq; int err; if (rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) { @@ -1002,14 +1006,14 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) rxq = eth_dev->data->rx_queues[rx_queue_id]; IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs (size: %u)", - rx_queue_id, rxq->q.num_descs, frame_size); + rx_queue_id, rxq->qcq.q.num_descs, frame_size); if (!(rxq->flags & IONIC_QCQ_F_INITED)) { err = ionic_lif_rxq_init(rxq); if (err) return err; } else { - ionic_qcq_enable(rxq); + ionic_qcq_enable(&rxq->qcq); } /* Allocate buffers for descriptor rings */ @@ -1025,13 +1029,12 @@ ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) } static __rte_always_inline void -ionic_rxq_service(struct ionic_qcq *rxq, uint32_t work_to_do, +ionic_rxq_service(struct ionic_rx_qcq *rxq, uint32_t work_to_do, void *service_cb_arg) { - struct ionic_cq *cq = &rxq->cq; - struct ionic_queue *q = &rxq->q; - struct ionic_rxq_comp *cq_desc_base = cq->base; - struct ionic_rxq_comp *cq_desc; + struct ionic_cq *cq = &rxq->qcq.cq; + struct ionic_queue *q = &rxq->qcq.q; + struct ionic_rxq_comp *cq_desc, *cq_desc_base = cq->base; bool more; uint32_t curr_q_tail_idx, curr_cq_tail_idx; uint32_t work_done = 0; @@ -1080,7 +1083,7 @@ ionic_rxq_service(struct ionic_qcq *rxq, uint32_t work_to_do, int __rte_cold ionic_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { - struct ionic_qcq *rxq; + struct ionic_rx_qcq *rxq; IONIC_PRINT(DEBUG, "Stopping RX queue %u", rx_queue_id); @@ -1089,7 +1092,7 @@ ionic_dev_rx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) eth_dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; - ionic_qcq_disable(rxq); + ionic_qcq_disable(&rxq->qcq); /* Flush */ ionic_rxq_service(rxq, -1, NULL); @@ -1101,9 +1104,9 @@ uint16_t ionic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { - struct ionic_qcq *rxq = (struct ionic_qcq *)rx_queue; + struct ionic_rx_qcq *rxq = rx_queue; uint32_t frame_size = - rxq->lif->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; + rxq->qcq.lif->eth_dev->data->dev_conf.rxmode.max_rx_pkt_len; struct ionic_rx_service service_cb_arg; service_cb_arg.rx_pkts = rx_pkts; From patchwork Tue Feb 16 20:35:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87948 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 71B31A054D; Tue, 16 Feb 2021 21:36:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E2C91607DA; Tue, 16 Feb 2021 21:36:07 +0100 (CET) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mails.dpdk.org (Postfix) with ESMTP id 18F421607CE for ; Tue, 16 Feb 2021 21:36:05 +0100 (CET) Received: by mail-pg1-f169.google.com with SMTP id t25so7010237pga.2 for ; Tue, 16 Feb 2021 12:36:05 -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 :in-reply-to:references; bh=Zx5nf/o/QNdSjhOnE6vy6OwkPcI4SAI+T0NsQnhkBxg=; b=adoJL5dkikH1+IwFrfH/vkakpu306LOB5O2Pm22AvJZJZghGaqlhu/+sEqHb4SMKkZ u7bSfCrnqe5HZRRo3ThCxB4DWq9q4FWseGyiHfqTyBfaZdg6OkM98UmAmPBN5nJ+HMGp njIsHloR2xkeWMBhP3xIAJQV2qUF3stNzV4lte1NaxHRr1/UVZO4B9hLuV0rIcCFcEni geATNA3GHksP2DrUNPruPQfil+lD5Kr1Dsr+w5c8L8Jud/Q8LSQTfd+Lebbm+Hqevn30 SOvdATNCHAGwoJN96jqB+a1z00NEWNNKEK5Zz28OkQxnakf8ljXwRLHWQojlZfhytrjP lyJQ== 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:in-reply-to:references; bh=Zx5nf/o/QNdSjhOnE6vy6OwkPcI4SAI+T0NsQnhkBxg=; b=XoTuPSYMZE+f5GyXQPEgezRO8aN3AqustBVPkIE7/mxpKIgms0rXc0a5Ct6TMVj42R BrXX9NLSGz+WzdCO20RW2LUsM+ZVwxDUlkYF6Tgn6CWl7CQLLTP0emukH6ucn3zQmywu q8gn8tRXLwNwjRM7lBGNE74K6oU6Dd6xjkjm9BsmPIqrhg6BLm2Qu8EXkXWZoh+PiaRF vkZ0sfocyDKwK5sarMiR9vUT1IhnZExmFPPbRTmF4ygBkEHIu9/0w7XNqmTCyR9bmmg7 louAIEeT9A4OzgXQItQrZocg8AD1zIqarGW2TYMFSGPK984rLi3lVNS7y7bSFZ6D9IYU v+mQ== X-Gm-Message-State: AOAM531I/RZc+l1hYmn0qR33JxbDSPXMHLd8Iukubc2emPABtS3+F/1E Ep08E4XVUeF2nIT9+jjCqfw3bq8PE4MtJQ== X-Google-Smtp-Source: ABdhPJy6RmA7UORZQrk/8OCo2q8Hj4TiOavKXWS1tQ9RMaWFay9gbZjN4JOq7eCyNXxkH8QkGsZTGw== X-Received: by 2002:a63:1e07:: with SMTP id e7mr9360625pge.376.1613507763998; Tue, 16 Feb 2021 12:36:03 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.36.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:36:03 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:34 -0800 Message-Id: <20210216203540.29290-10-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 09/15] net/ionic: use the socket id passed in for Rx and Tx queues 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" Pipe the value from the queue setup routines through to ionic_qcq_alloc(). Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 10 +++++++--- drivers/net/ionic/ionic_lif.h | 10 ++++++---- drivers/net/ionic/ionic_rxtx.c | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index 87579a09e5..dd79068948 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -588,6 +588,7 @@ static int ionic_qcq_alloc(struct ionic_lif *lif, uint8_t type, size_t struct_size, + uint32_t socket_id, uint32_t index, const char *type_name, uint16_t flags, @@ -603,7 +604,6 @@ ionic_qcq_alloc(struct ionic_lif *lif, rte_iova_t q_base_pa = 0; rte_iova_t cq_base_pa = 0; rte_iova_t sg_base_pa = 0; - uint32_t socket_id = rte_socket_id(); int err; *qcq = NULL; @@ -721,7 +721,7 @@ ionic_qcq_free(struct ionic_qcq *qcq) } int -ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t index, +ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, uint16_t nrxq_descs, struct ionic_rx_qcq **rxq_out) { struct ionic_rx_qcq *rxq; @@ -732,6 +732,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t index, err = ionic_qcq_alloc(lif, IONIC_QTYPE_RXQ, sizeof(struct ionic_rx_qcq), + socket_id, index, "rx", flags, @@ -752,7 +753,7 @@ ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t index, } int -ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, +ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, uint16_t ntxq_descs, struct ionic_tx_qcq **txq_out) { struct ionic_tx_qcq *txq; @@ -763,6 +764,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, err = ionic_qcq_alloc(lif, IONIC_QTYPE_TXQ, sizeof(struct ionic_tx_qcq), + socket_id, index, "tx", flags, @@ -791,6 +793,7 @@ ionic_admin_qcq_alloc(struct ionic_lif *lif) err = ionic_qcq_alloc(lif, IONIC_QTYPE_ADMINQ, sizeof(struct ionic_admin_qcq), + rte_socket_id(), 0, "admin", flags, @@ -816,6 +819,7 @@ ionic_notify_qcq_alloc(struct ionic_lif *lif) err = ionic_qcq_alloc(lif, IONIC_QTYPE_NOTIFYQ, sizeof(struct ionic_notify_qcq), + rte_socket_id(), 0, "notify", flags, diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index a8243ebf21..ba1471b6e9 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -196,10 +196,12 @@ int ionic_dev_promiscuous_disable(struct rte_eth_dev *dev); int ionic_dev_allmulticast_enable(struct rte_eth_dev *dev); int ionic_dev_allmulticast_disable(struct rte_eth_dev *dev); -int ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t index, - uint16_t nrxq_descs, struct ionic_rx_qcq **qcq_out); -int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t index, - uint16_t ntxq_descs, struct ionic_tx_qcq **qcq_out); +int ionic_rx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, + uint32_t index, uint16_t nrxq_descs, + struct ionic_rx_qcq **qcq_out); +int ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, + uint32_t index, uint16_t ntxq_descs, + struct ionic_tx_qcq **qcq_out); void ionic_qcq_free(struct ionic_qcq *qcq); int ionic_qcq_enable(struct ionic_qcq *qcq); diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 5f836f0134..89b37733b6 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -191,7 +191,7 @@ ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id, eth_dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; - err = ionic_tx_qcq_alloc(lif, tx_queue_id, nb_desc, &txq); + err = ionic_tx_qcq_alloc(lif, socket_id, tx_queue_id, nb_desc, &txq); if (err) { IONIC_PRINT(DEBUG, "Queue allocation failure"); return -EINVAL; @@ -718,7 +718,7 @@ ionic_dev_rx_queue_setup(struct rte_eth_dev *eth_dev, eth_dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; - err = ionic_rx_qcq_alloc(lif, rx_queue_id, nb_desc, + err = ionic_rx_qcq_alloc(lif, socket_id, rx_queue_id, nb_desc, &rxq); if (err) { IONIC_PRINT(ERR, "Queue %d allocation failure", rx_queue_id); From patchwork Tue Feb 16 20:35:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87949 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 06A63A054D; Tue, 16 Feb 2021 21:36:59 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1171F1607E5; Tue, 16 Feb 2021 21:36:10 +0100 (CET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mails.dpdk.org (Postfix) with ESMTP id 0A8C41607D1 for ; Tue, 16 Feb 2021 21:36:07 +0100 (CET) Received: by mail-pl1-f178.google.com with SMTP id u11so6115797plg.13 for ; Tue, 16 Feb 2021 12:36:06 -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 :in-reply-to:references; bh=3Wo47tI1VUFWCXaudhypvJgBtWXPyxvPP/YWpBZyf0o=; b=Lkxm24yGPFvIs9WCAfeE+rT2hZCKJECIqu8uqcI9pEQsqy3D1RCsujdpohkK4aZFHE XC5A0gLsagrPbVAFKM7HPJlJ9Wm2chpdN6Rp1kimbUu73i3r6MfDsOP7dpCCKRDlDm7Y i6sWGC1KAmsDthVPQJkUBvOUd6Rs9U+QUV/Y/O8IHC1gNSbdLh/oaz//M6VH40kk4JlX MscSDIXV+5p9O2S6+sjlw7F4q2wzciku2e1Qnx6kdHBb4R6YNzvTgG2G3IQddEmBYg1l HJSCd/bVPb83aerDbzxxoXf1fQiKuKCfxOyxtRF6sUC/fqLkhh8T6qtui+abJ2hq8OIB C+Iw== 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:in-reply-to:references; bh=3Wo47tI1VUFWCXaudhypvJgBtWXPyxvPP/YWpBZyf0o=; b=NPwC+yInjy2iNWQgZajMYIY8PI2zIgCvuilGfQDQnqUf02uj0BCBq+AFSvPGC4Mq8n /TF8MFFTQwnEi6FALVJcc41FkB9RwYymAyxLzeKpYzc9B3ts8Fae6TwYHt420U+HlUWc 4TrLqs9x+Oh4NCkrNCOL2onvVfRYahIUj4iuw0/pyiQ27cf/CVB7CIjUUHM+ijPx97+R broZQ1dgA0gwstrYWg1JcshYLV9+EkQUDOGCiz/8fZsEBSJQPOWZhThrXVV3M+c6AqYl PT08zPLPhLeerlrsuK8ytyEvSN1L/2BZp4xheawxyvab/s5oEArEbFoEKavKJY9Ii7+0 laVQ== X-Gm-Message-State: AOAM5309ZVsvGB/eA0NaCyaVZgq4T6tNTYnoI7ItSw8/O3QSWKU4aJM0 TUj8UdlWgUpmYDAcdj3iRYzB0o40Z+004w== X-Google-Smtp-Source: ABdhPJwCfb/O1H7RaXl/Dnxt9GjsP+X0blFvvBiUri4BGBLJFvRl5nZfGkAEyxcBGdWN/wS5HX04Ow== X-Received: by 2002:a17:90a:517:: with SMTP id h23mr5900394pjh.108.1613507766071; Tue, 16 Feb 2021 12:36:06 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.36.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:36:05 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:35 -0800 Message-Id: <20210216203540.29290-11-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 10/15] net/ionic: log queue counters when tearing down 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" This improves debuggability. To see the logs, use EAL arg: --log-level=pmd.net.ionic,debug While here, stop counting fragments, but start counting mtods. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.h | 2 +- drivers/net/ionic/ionic_rxtx.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index ba1471b6e9..5885aa1546 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -34,7 +34,6 @@ struct ionic_tx_stats { uint64_t stop; uint64_t no_csum; uint64_t tso; - uint64_t frags; }; struct ionic_rx_stats { @@ -44,6 +43,7 @@ struct ionic_rx_stats { uint64_t bad_cq_status; uint64_t no_room; uint64_t bad_len; + uint64_t mtods; }; #define IONIC_QCQ_F_INITED BIT(0) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 89b37733b6..fa92fca2f5 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -123,9 +123,13 @@ void __rte_cold ionic_dev_tx_queue_release(void *tx_queue) { struct ionic_tx_qcq *txq = tx_queue; + struct ionic_tx_stats *stats = &txq->stats; IONIC_PRINT_CALL(); + IONIC_PRINT(DEBUG, "TX queue %u pkts %ju tso %ju", + txq->qcq.q.index, stats->packets, stats->tso); + ionic_lif_txq_deinit(txq); ionic_qcq_free(&txq->qcq); @@ -410,7 +414,6 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, offset = 0; data_iova = rte_mbuf_data_iova(txm_seg); left = txm_seg->data_len; - stats->frags++; while (left > 0) { next_addr = rte_cpu_to_le_64(data_iova + offset); @@ -508,7 +511,6 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, while (txm_seg != NULL) { elem->len = txm_seg->data_len; elem->addr = rte_cpu_to_le_64(rte_mbuf_data_iova(txm_seg)); - stats->frags++; elem++; txm_seg = txm_seg->next; } @@ -657,12 +659,18 @@ void __rte_cold ionic_dev_rx_queue_release(void *rx_queue) { struct ionic_rx_qcq *rxq = rx_queue; + struct ionic_rx_stats *stats; if (!rxq) return; IONIC_PRINT_CALL(); + stats = &rxq->stats; + + IONIC_PRINT(DEBUG, "RX queue %u pkts %ju mtod %ju", + rxq->qcq.q.index, stats->packets, stats->mtods); + ionic_rx_empty(rxq); ionic_lif_rxq_deinit(rxq); @@ -887,6 +895,7 @@ ionic_rx_clean(struct ionic_rx_qcq *rxq, pkt_type = RTE_PTYPE_L2_ETHER_ARP; else pkt_type = RTE_PTYPE_UNKNOWN; + stats->mtods++; break; } } From patchwork Tue Feb 16 20:35:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87950 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 EADACA054D; Tue, 16 Feb 2021 21:37:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3491B1607DE; Tue, 16 Feb 2021 21:36:11 +0100 (CET) Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id C17A01607C6 for ; Tue, 16 Feb 2021 21:36:08 +0100 (CET) Received: by mail-pj1-f50.google.com with SMTP id fa16so37264pjb.1 for ; Tue, 16 Feb 2021 12:36:08 -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 :in-reply-to:references; bh=KKN4Gzac2io1vU2X4tQonAjdQkOnSdKegj/5IEvDNUA=; b=r3o9epFFvWRgzyVD+EkrOAgeEuogM6TDNbAwdrUmnL9K4r3MF9kbUHYu9vqkEls2cW fB9IEmEAHGUNfsv4SnXD7KaZbpAKqYw8pELo187K33C9zhquxrqnfBml1ehiKYxPwNs/ AQ+PEweTSYCPmgyOzqpH4Z3qJm5KkbIZiCdbQyhb2mYBXWfD3gxp9VUMJLaaB9RLtDI1 ESUU5eIo+Yvr982Y6ZA4ZFf3K/jbkNcSbwOfTTA7WaCYdfUTnp3kLRebRx2/1Mkjhenf gxaMMXq8EGBO9r8VnVRTpyMuufkRspS2ZmQYjRW/uscrsdEn4IopSkW2kNAbJru/49B9 UtFQ== 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:in-reply-to:references; bh=KKN4Gzac2io1vU2X4tQonAjdQkOnSdKegj/5IEvDNUA=; b=HetIoezVt2Rv3aaCPg+qNKuWYgZhUd2xk3DPSzUmA24mCAfPoyn8n7DkXKKoabGhHg NfmRA31WPqh6WdOr/znsEGqzFbvoty7jvU69Eo0BrYjKURLggsYmldVyQ+KSUNrjclXR fNevBPK8En74+m3K2lbzU4jzlFPhdvNfweSbKUYypAu+SOz576XnUqyZdYtsLQ1a+0nX P23zLwwDOkchkUxYBxtbGXVe/xdKaPmP/WzQlqmtEU8sqkSniHWSEzslHa+WwvcCVdA1 gvlU+1c1J0uvZKNAUgnqG7RbF4FxoJmNSD3knzKybP95DGAO76AgmG9FcJKB/HJbamWo lufw== X-Gm-Message-State: AOAM530L2PUvHSwREAqwcPZ7ekHz5Q0AwIIXgHyH73stFViw2YOCgoA1 UJwFWNG/9x6b/kd3oH8RS5kuND6X9JMVcg== X-Google-Smtp-Source: ABdhPJw5iWb7MYx+1Ay7v6ZVRvexVjMRdomjlEZc0WT6s900+oQkoAdU+/vd7be32Qtv/p+4s8VQkw== X-Received: by 2002:a17:90a:4287:: with SMTP id p7mr5915638pjg.226.1613507767719; Tue, 16 Feb 2021 12:36:07 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.36.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:36:07 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:36 -0800 Message-Id: <20210216203540.29290-12-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 11/15] net/ionic: break up queue post function 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" Break it up rather than inlining it, so that we can remove branches from the hot path. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_dev.c | 11 ---------- drivers/net/ionic/ionic_dev.h | 1 - drivers/net/ionic/ionic_main.c | 10 ++++++++- drivers/net/ionic/ionic_rxtx.c | 37 ++++++++++++++++++++++++++++++---- 4 files changed, 42 insertions(+), 17 deletions(-) diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c index cfaf4abc23..43e9ca3de3 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -438,14 +438,3 @@ ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa) q->sg_base = base; q->sg_base_pa = base_pa; } - -void -ionic_q_post(struct ionic_queue *q, bool ring_doorbell, void *cb_arg) -{ - q->info[q->head_idx] = cb_arg; - - q->head_idx = Q_NEXT_TO_POST(q, 1); - - if (ring_doorbell) - ionic_q_flush(q); -} diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h index 2f27e63646..38c078efdf 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -224,7 +224,6 @@ uint32_t ionic_cq_service(struct ionic_cq *cq, uint32_t work_to_do, int ionic_q_init(struct ionic_queue *q, uint32_t index, uint16_t num_descs); void ionic_q_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); void ionic_q_sg_map(struct ionic_queue *q, void *base, rte_iova_t base_pa); -void ionic_q_post(struct ionic_queue *q, bool ring_doorbell, void *cb_arg); static inline uint16_t ionic_q_space_avail(struct ionic_queue *q) diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c index 0d2e02fdd0..9aa7b2e96c 100644 --- a/drivers/net/ionic/ionic_main.c +++ b/drivers/net/ionic/ionic_main.c @@ -197,6 +197,7 @@ ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) struct ionic_queue *q = &lif->adminqcq->qcq.q; struct ionic_admin_cmd *q_desc_base = q->base; struct ionic_admin_cmd *q_desc; + void **info; int err = 0; rte_spinlock_lock(&lif->adminq_lock); @@ -210,7 +211,14 @@ ionic_adminq_post(struct ionic_lif *lif, struct ionic_admin_ctx *ctx) memcpy(q_desc, &ctx->cmd, sizeof(ctx->cmd)); - ionic_q_post(q, true, ctx); + info = IONIC_INFO_PTR(q, q->head_idx); + info[0] = ctx; + + q->head_idx = Q_NEXT_TO_POST(q, 1); + + /* Ring doorbell */ + rte_wmb(); + ionic_q_flush(q); err_out: rte_spinlock_unlock(&lif->adminq_lock); diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index fa92fca2f5..5236cae211 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -302,6 +302,7 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc, uint16_t vlan_tci, bool has_vlan, bool start, bool done) { + void **info; uint8_t flags = 0; flags |= has_vlan ? IONIC_TXQ_DESC_FLAG_VLAN : 0; flags |= encap ? IONIC_TXQ_DESC_FLAG_ENCAP : 0; @@ -315,7 +316,15 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc, desc->hdr_len = hdrlen; desc->mss = mss; - ionic_q_post(q, done, done ? txm : NULL); + if (done) { + info = IONIC_INFO_PTR(q, q->head_idx); + info[0] = txm; + } + + q->head_idx = Q_NEXT_TO_POST(q, 1); + + if (done) + ionic_q_flush(q); } static struct ionic_txq_desc * @@ -465,6 +474,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, struct ionic_txq_sg_elem *elem; struct ionic_tx_stats *stats = &txq->stats; struct rte_mbuf *txm_seg; + void **info; bool encap; bool has_vlan; uint64_t ol_flags = txm->ol_flags; @@ -473,6 +483,7 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, uint8_t flags = 0; desc = &desc_base[q->head_idx]; + info = IONIC_INFO_PTR(q, q->head_idx); if ((ol_flags & PKT_TX_IP_CKSUM) && (txq->flags & IONIC_QCQ_F_CSUM_L3)) { @@ -506,7 +517,10 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, desc->len = txm->data_len; desc->vlan_tci = txm->vlan_tci; + info[0] = txm; + elem = sg_desc_base[q->head_idx].elems; + txm_seg = txm->next; while (txm_seg != NULL) { elem->len = txm_seg->data_len; @@ -515,7 +529,10 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, txm_seg = txm_seg->next; } - ionic_q_post(q, not_xmit_more, txm); + q->head_idx = Q_NEXT_TO_POST(q, 1); + + if (not_xmit_more) + ionic_q_flush(q); return 0; } @@ -920,7 +937,11 @@ ionic_rx_recycle(struct ionic_queue *q, uint32_t q_desc_index, new->addr = old->addr; new->len = old->len; - ionic_q_post(q, true, mbuf); + q->info[q->head_idx] = mbuf; + + q->head_idx = Q_NEXT_TO_POST(q, 1); + + ionic_q_flush(q); } static __rte_always_inline int @@ -930,6 +951,7 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) struct ionic_rxq_desc *desc, *desc_base = q->base; struct ionic_rxq_sg_desc *sg_desc, *sg_desc_base = q->sg_base; struct ionic_rxq_sg_elem *elem; + void **info; rte_iova_t dma_addr; uint32_t i, j, nsegs, buf_size, size; bool ring_doorbell; @@ -947,6 +969,8 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) return -ENOMEM; } + info = IONIC_INFO_PTR(q, q->head_idx); + nsegs = (len + buf_size - 1) / buf_size; desc = &desc_base[q->head_idx]; @@ -989,7 +1013,12 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) ring_doorbell = ((q->head_idx + 1) & IONIC_RX_RING_DOORBELL_STRIDE) == 0; - ionic_q_post(q, ring_doorbell, rxm); + info[0] = rxm; + + q->head_idx = Q_NEXT_TO_POST(q, 1); + + if (ring_doorbell) + ionic_q_flush(q); } return 0; From patchwork Tue Feb 16 20:35:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87951 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 9A550A054D; Tue, 16 Feb 2021 21:37:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8A5D11607EE; Tue, 16 Feb 2021 21:36:12 +0100 (CET) Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mails.dpdk.org (Postfix) with ESMTP id 5D8641607E8 for ; Tue, 16 Feb 2021 21:36:10 +0100 (CET) Received: by mail-pl1-f174.google.com with SMTP id f8so4549113plg.5 for ; Tue, 16 Feb 2021 12:36:10 -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 :in-reply-to:references; bh=851oKJmjSXniXofQ9MSMPw9GaZX8bwo64uNU2j2R6v4=; b=qnK/6nm5wr5l47x5NYn6AYHNM7zMCC7Avh6CGwTkhFS16I3fcTiOHJ4gL7uNzh/POB DwAJz7FMdz2Tn0p5UbsJfQqfmFDyUJA5UXKgZkt0DuGwW6jvxd5G6OmeLyZW3PGFYseh NJ7DKr8jrkbJKz5hj1y81kg3j/FmF/QyCvWZf8SEeGe3DtENLniQGMUeenCrHLrKMprY 8+9z7pKFxHFbx0EJpmVI7zChyP3OIE0Ei5DhGSI/H5vEtbte0ffV/PVXGwxbPYqZkrJH 92xq+4owgDvGskLPeHZx/B3jGKWiECIFbQT0KpAd+hN1WQHd9IFAnyJCLAd3Z8lw9sxQ 2S3A== 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:in-reply-to:references; bh=851oKJmjSXniXofQ9MSMPw9GaZX8bwo64uNU2j2R6v4=; b=JYe0ODo+grKf0hdWlxdNxBvHqHN5PBQVKcUwg62Px8ZJqszMoN4vck3AxuVLzEiw5w t2AFiJBpA0phQF6iDLA8Xc1RUZuqZY2/WZF4BNst7AP24SsyvBX99gnv3vt3H7rOxhsj UVE+P5rNsaLvXnIjzDr+dUT3vU2Y0NjQmoo5ZkMnDlpfB3pix5fp0BN16i2U6QIl2Pvh hM8+YLiysAH/Hl/fREVoxdqcPSLr+P/hIMAk20jxkH+n/VVSDJuE7re532GBE2lrUZYC LScQ5v6lTImNRXqerY6A3BAVNDOOz/dkbceIqUUSm0IYZ6eVFN1FnmPeYGdXeMBjpfM+ Twcw== X-Gm-Message-State: AOAM531nmTWsQzn2BXvvhtpCC9chqCrqcCiaXU5KAKv7xO9dB2fyKef+ J5uL8BjcdambMrPtD4Jelpc/HFPpRtf8Sg== X-Google-Smtp-Source: ABdhPJxfLuOE6jeWSKVvQch6Cjnrfw4BLzNmfC0EGl9MPhF6oaVNQkoSK5SMbr4/ab+l9lCrM31CLQ== X-Received: by 2002:a17:90a:d682:: with SMTP id x2mr6120294pju.139.1613507769370; Tue, 16 Feb 2021 12:36:09 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:36:09 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:37 -0800 Message-Id: <20210216203540.29290-13-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 12/15] net/ionic: ring doorbell once at the end of each burst 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" This improves performance. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_rxtx.c | 41 +++++++++++----------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index 5236cae211..bb67c497a1 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -47,8 +47,6 @@ #include "ionic_lif.h" #include "ionic_rxtx.h" -#define IONIC_RX_RING_DOORBELL_STRIDE (32 - 1) - /********************************************************************* * * TX functions @@ -322,9 +320,6 @@ ionic_tx_tso_post(struct ionic_queue *q, struct ionic_txq_desc *desc, } q->head_idx = Q_NEXT_TO_POST(q, 1); - - if (done) - ionic_q_flush(q); } static struct ionic_txq_desc * @@ -341,8 +336,7 @@ ionic_tx_tso_next(struct ionic_tx_qcq *txq, struct ionic_txq_sg_elem **elem) } static int -ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, - bool not_xmit_more) +ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) { struct ionic_queue *q = &txq->qcq.q; struct ionic_tx_stats *stats = &txq->stats; @@ -410,7 +404,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, hdrlen, mss, encap, vlan_tci, has_vlan, - start, done && not_xmit_more); + start, done); desc = ionic_tx_tso_next(txq, &elem); start = false; seglen = mss; @@ -451,7 +445,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, hdrlen, mss, encap, vlan_tci, has_vlan, - start, done && not_xmit_more); + start, done); desc = ionic_tx_tso_next(txq, &elem); start = false; } @@ -465,8 +459,7 @@ ionic_tx_tso(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, } static __rte_always_inline int -ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, - bool not_xmit_more) +ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm) { struct ionic_queue *q = &txq->qcq.q; struct ionic_txq_desc *desc, *desc_base = q->base; @@ -531,9 +524,6 @@ ionic_tx(struct ionic_tx_qcq *txq, struct rte_mbuf *txm, q->head_idx = Q_NEXT_TO_POST(q, 1); - if (not_xmit_more) - ionic_q_flush(q); - return 0; } @@ -548,7 +538,6 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint32_t bytes_tx = 0; uint16_t nb_tx = 0; int err; - bool last; /* Cleaning old buffers */ ionic_tx_flush(txq); @@ -559,8 +548,6 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, } while (nb_tx < nb_pkts) { - last = (nb_tx == (nb_pkts - 1)); - next_q_head_idx = Q_NEXT_TO_POST(q, 1); if ((next_q_head_idx & 0x3) == 0) { struct ionic_txq_desc *desc_base = q->base; @@ -569,13 +556,11 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, } if (tx_pkts[nb_tx]->ol_flags & PKT_TX_TCP_SEG) - err = ionic_tx_tso(txq, tx_pkts[nb_tx], last); + err = ionic_tx_tso(txq, tx_pkts[nb_tx]); else - err = ionic_tx(txq, tx_pkts[nb_tx], last); + err = ionic_tx(txq, tx_pkts[nb_tx]); if (err) { stats->drop += nb_pkts - nb_tx; - if (nb_tx > 0) - ionic_q_flush(q); break; } @@ -583,6 +568,11 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, nb_tx++; } + if (nb_tx > 0) { + rte_wmb(); + ionic_q_flush(q); + } + stats->packets += nb_tx; stats->bytes += bytes_tx; @@ -954,7 +944,6 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) void **info; rte_iova_t dma_addr; uint32_t i, j, nsegs, buf_size, size; - bool ring_doorbell; buf_size = (uint16_t)(rte_pktmbuf_data_room_size(rxq->mb_pool) - RTE_PKTMBUF_HEADROOM); @@ -1010,17 +999,13 @@ ionic_rx_fill(struct ionic_rx_qcq *rxq, uint32_t len) IONIC_PRINT(ERR, "Rx SG size is not sufficient (%d < %d)", size, len); - ring_doorbell = ((q->head_idx + 1) & - IONIC_RX_RING_DOORBELL_STRIDE) == 0; - info[0] = rxm; q->head_idx = Q_NEXT_TO_POST(q, 1); - - if (ring_doorbell) - ionic_q_flush(q); } + ionic_q_flush(q); + return 0; } From patchwork Tue Feb 16 20:35:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87952 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 87ACAA054D; Tue, 16 Feb 2021 21:37:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6EE41607F8; Tue, 16 Feb 2021 21:36:15 +0100 (CET) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by mails.dpdk.org (Postfix) with ESMTP id 037A31607E9 for ; Tue, 16 Feb 2021 21:36:12 +0100 (CET) Received: by mail-pj1-f51.google.com with SMTP id lw17so343818pjb.0 for ; Tue, 16 Feb 2021 12:36:11 -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 :in-reply-to:references; bh=V9VjYlSVf32bhSmUdw4SxVRm/unR0FmVoWPnEw8Hl0k=; b=ibVbvuK33GUiwP+hoDrNVHxo1SJLaA2N0QL7tkEVoZ+3UDg1+Ufr99cG57I4Az2btZ EQuv1YSEcg/vdEY8WJQCV8Fm5wK3goY11ciPRI1kzjwVUCfPG6agVD+zknmRDbr7LUC4 M1Q0sgvAg7/F9JVC3/naSTwbFDp2Pj9Ie/oRyw1Ksbprag5D0Hnbc3ds2ZYTTr+b1lm3 XEjnQc/AKGwnVAP5k2RvttadvDMOTiuWbQPZzT9tFin0zbss7dX+WKu7A4uHlmeRLYqL ukK+1XH+i+WFHaee/O0+34vKSpzectmcxtBil3XgddACPL8LwqxbEdDmyLlHKc89K27V 4djQ== 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:in-reply-to:references; bh=V9VjYlSVf32bhSmUdw4SxVRm/unR0FmVoWPnEw8Hl0k=; b=hiXM+a+ZxaggW6sh24NeHeyfk8j2oMa+u6h72d51tH2Zgh0ND/mM5H3E4MUUIsfrjZ y0tEzUkutHHk/EfQbJjeYN1ZAQnCieDwZzQNdtdIfjNBj0u3C+Z3XDux1ySD8jHXzMf/ n8XE0Q+aVd7vMM6Q5Iqi382T7X8a+lB5nM19/PgFVVB6vru9zD54jxaa/WBuZJchTgI1 yLGI70jMbn8f3xlQKVAv8D1/PXvWAZkGZQYRdFeXj5R7G2aYkRxCsOL4SOimhXXCO0mX j0xR5uEWrQkxFubfYF5MQ5Ffhmtjj79ujJV4EuFNUoh/++5XZWYF0WXD9mVaBw1dGL0P JbTg== X-Gm-Message-State: AOAM533Zg2LokyT/O8lxgfvwOLRNiwWV6gx/QTRcjzUJ20VnVgIcnTwY cvfvrhEcSl4x/ogZr7WYULrNYafI9JXQdw== X-Google-Smtp-Source: ABdhPJzDuR/Be4v8Bpb7Egyo9mIDfggJixurKII3F8tb/i/R9VtelcAo4FqVwVNL3nZj4QQD99BIFQ== X-Received: by 2002:a17:90a:eb02:: with SMTP id j2mr4517547pjz.226.1613507771056; Tue, 16 Feb 2021 12:36:11 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.36.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:36:10 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer , Vishwas Danivas Date: Tue, 16 Feb 2021 12:35:38 -0800 Message-Id: <20210216203540.29290-14-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 13/15] net/ionic: send as many packets as possible 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" Rather than dropping the whole burst if some don't fit. This improves performance. Signed-off-by: Andrew Boyer Signed-off-by: Vishwas Danivas --- drivers/net/ionic/ionic_rxtx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index bb67c497a1..b4bdeabad1 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -536,15 +536,16 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, struct ionic_tx_stats *stats = &txq->stats; uint32_t next_q_head_idx; uint32_t bytes_tx = 0; - uint16_t nb_tx = 0; + uint16_t nb_avail, nb_tx = 0; int err; /* Cleaning old buffers */ ionic_tx_flush(txq); - if (unlikely(ionic_q_space_avail(q) < nb_pkts)) { - stats->stop += nb_pkts; - return 0; + nb_avail = ionic_q_space_avail(q); + if (unlikely(nb_avail < nb_pkts)) { + stats->stop += nb_pkts - nb_avail; + nb_pkts = nb_avail; } while (nb_tx < nb_pkts) { From patchwork Tue Feb 16 20:35:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87953 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 8D516A054D; Tue, 16 Feb 2021 21:37:23 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E9A4160800; Tue, 16 Feb 2021 21:36:17 +0100 (CET) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by mails.dpdk.org (Postfix) with ESMTP id BB2441607C4 for ; Tue, 16 Feb 2021 21:36:13 +0100 (CET) Received: by mail-pj1-f51.google.com with SMTP id l18so33984pji.3 for ; Tue, 16 Feb 2021 12:36:13 -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 :in-reply-to:references; bh=QeNNymWUPKDtzMw83UcjDh/XmwFbM156RAu7l4XrryE=; b=BhYE/3VdbuUEvs2WDe3PCx/E4TaNHmaG/5c4xfRBYeHgqRFPFK5YW3AESgH5WdOYOg GeJmXEdeOnnY+Bv1V1q4hn9QTHjRfZzBfoBIaOt5Cyz5DsfVIEd2Cd0+ZGeTXCi9Wnag AR4cEnC3lk1pRlkxUW3oH0W0m845q8Jyu3LLfwM/3gadfdEY3HT0UnCxiPASp8Iozs7S mXFgpYeB4dHZUE1HgqQwK7NoHzT0fq83/K7FG1otnYxTDoQ/zaA70eV7fsz6iCmRM+Fn LG86btgsZIcOf+VRcew9dUzkCnSVG5INo8lU+Qq04kdil1sQRu7Gw3saFzLpw3S0Kg9+ p47Q== 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:in-reply-to:references; bh=QeNNymWUPKDtzMw83UcjDh/XmwFbM156RAu7l4XrryE=; b=KZ0dd5nbnIQIkqOQHe86zTf9ZdYSPoZHNvN9eOQwZSU3LkM0pLq/JFFFw7tzjdFpY6 7n1Mttl1vTzeHPlCy7bqD3dHLnYwUU821TB62Oxta9PgMpPLLbrwmyGr4xWUTPhCwo4z +wHSV9tPSrgBMC8Dp8GwafZEkkyac4L96Gbj5IyL8m3Pe8Hyh5feEpv0H3IdIjtFVYk/ o65PAiUhJPkEu1VyfO7Z/2DNTtzV3M4RVfqiIWuLyG5B6oxbbDivvQ6HCrHyeaItC5fp ZyADssh6SiX4YkqwjMwodn+97fnYZxA8VAmS0AgWtFslZWDi4koGn3jOrvVgqu4CINCu ZSGg== X-Gm-Message-State: AOAM533hko2IbP670PQ9LzFyeW5fRO696aL308++ZT0qZ8I3mj1YUG0m qQUnJqrPPHXOS7tMLatNaT6OqYsFoAwVqw== X-Google-Smtp-Source: ABdhPJz2VPDm2scQcwEUy+RbQ09pi2shh1BVsYDj20kTgtr0dMYo9Cn7hZPe1SdpvE2sr4Le7L+z9Q== X-Received: by 2002:a17:90b:198c:: with SMTP id mv12mr5812411pjb.25.1613507772801; Tue, 16 Feb 2021 12:36:12 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.36.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:36:12 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer Date: Tue, 16 Feb 2021 12:35:39 -0800 Message-Id: <20210216203540.29290-15-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 14/15] net/ionic: store Tx fragment limit in queue 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" A future patch will allow Tx scatter/gather to be disabled. Store the value in the queue so it can be changed at runtime based on the configuration. Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 6 +++++- drivers/net/ionic/ionic_lif.h | 1 + drivers/net/ionic/ionic_rxtx.c | 6 +++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index dd79068948..b8023e0632 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -757,10 +757,13 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, uint16_t ntxq_descs, struct ionic_tx_qcq **txq_out) { struct ionic_tx_qcq *txq; - uint16_t flags; + uint16_t flags, num_segs_fw; int err; flags = IONIC_QCQ_F_SG; + + num_segs_fw = IONIC_TX_MAX_SG_ELEMS_V1 + 1; + err = ionic_qcq_alloc(lif, IONIC_QTYPE_TXQ, sizeof(struct ionic_tx_qcq), @@ -777,6 +780,7 @@ ionic_tx_qcq_alloc(struct ionic_lif *lif, uint32_t socket_id, uint32_t index, return err; txq->flags = flags; + txq->num_segs_fw = num_segs_fw; lif->txqcqs[index] = txq; *txq_out = txq; diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h index 5885aa1546..9f00ba2973 100644 --- a/drivers/net/ionic/ionic_lif.h +++ b/drivers/net/ionic/ionic_lif.h @@ -92,6 +92,7 @@ struct ionic_tx_qcq { struct ionic_qcq qcq; /* cacheline2 */ + uint16_t num_segs_fw; /* # segs supported by current FW */ uint16_t flags; struct ionic_tx_stats stats; diff --git a/drivers/net/ionic/ionic_rxtx.c b/drivers/net/ionic/ionic_rxtx.c index b4bdeabad1..b83ea1bcaa 100644 --- a/drivers/net/ionic/ionic_rxtx.c +++ b/drivers/net/ionic/ionic_rxtx.c @@ -598,9 +598,9 @@ ionic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, (PKT_TX_OFFLOAD_MASK ^ IONIC_TX_OFFLOAD_MASK) uint16_t -ionic_prep_pkts(void *tx_queue __rte_unused, struct rte_mbuf **tx_pkts, - uint16_t nb_pkts) +ionic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) { + struct ionic_tx_qcq *txq = tx_queue; struct rte_mbuf *txm; uint64_t offloads; int i = 0; @@ -608,7 +608,7 @@ ionic_prep_pkts(void *tx_queue __rte_unused, struct rte_mbuf **tx_pkts, for (i = 0; i < nb_pkts; i++) { txm = tx_pkts[i]; - if (txm->nb_segs > IONIC_TX_MAX_SG_ELEMS_V1 + 1) { + if (txm->nb_segs > txq->num_segs_fw) { rte_errno = -EINVAL; break; } From patchwork Tue Feb 16 20:35:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Boyer X-Patchwork-Id: 87954 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 6EF5BA054D; Tue, 16 Feb 2021 21:37:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16A0E160815; Tue, 16 Feb 2021 21:36:19 +0100 (CET) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by mails.dpdk.org (Postfix) with ESMTP id E4EA71607F9 for ; Tue, 16 Feb 2021 21:36:15 +0100 (CET) Received: by mail-pj1-f52.google.com with SMTP id c19so31868pjq.3 for ; Tue, 16 Feb 2021 12:36:15 -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 :in-reply-to:references; bh=DvgvfWSZ5T++gECStxr6V74FNWCdtej6oqiRpIiOyxI=; b=aE3oMumXyHy7qszISNuL/ClRMoCBEI2R+95HVZJmlqDuOznyaaTKX2oK33qnd6mFxJ XZ3RJny7M2QGPr1VFDwI6LglfPJA4K+831QP+2l6mD7ZG1bMsvPWLAXWEI/Bj5gLoPXb FVSGKLvbVrLJZHnC0XhcFzTlsTWnl7gL90xkC/tGDTkvD5hn2pG6p9zLQH0EiLOtJ6vY fmghj6nUTkQNlydVgFcwx3NARohf0/A3h6TfJkKmK8LdoNcmpY7QKqqqswdWGX29Tqjd lCoX7JTn9MQg6aaB1Sp+NKZ3a55rquZ+i7hfUSa+DL3epP/puG0hXQ7buocHs4z11pbo rpCw== 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:in-reply-to:references; bh=DvgvfWSZ5T++gECStxr6V74FNWCdtej6oqiRpIiOyxI=; b=uC3g9Krns2OmkSajqu2s3aKjOdCKeQFdLNTC6OsiP0Ctmz/AGwQateF3hzCnKRPzrl 2wM0KCE3Nh2WOTrTE39vi864EbWgSLJ4QhPMyh1QS0UbcKSfCpcIgsa/Wy0xp4CD+qh1 u/PtRwWbEE0iUX26GZynkq53a9cGl411xdzg7h+8D9c9WpMZIoKgyetJJgVerOsBudXI hR8w7o+z/o3iQ1ZbZu1lq3RSh0sYXBtKQDAJoWhOSP//AHCIOFuHneU1wBH91Ic9MRLv yt2wRGGmKg50dZBSSCXhX8InolwrwB2NK04j2+cN9vWbdxCZaO2By/psegkfY+ia8phL Ctrg== X-Gm-Message-State: AOAM531BR6eHMWpsZRraej/TEIt11n87SQkpF6RufzWcGGYX1AvIsc5I zXo4P1iMTaT7IQZsQCZ2GEtNavboRZ0xhg== X-Google-Smtp-Source: ABdhPJwWDxRlrsW0HwdWPFMgDDeMb6KpgEJdhiXUJ7C/QZdKT7meUQegX8zBYBw1Xy3n3pwJCnanNA== X-Received: by 2002:a17:90a:c684:: with SMTP id n4mr5993244pjt.13.1613507775006; Tue, 16 Feb 2021 12:36:15 -0800 (PST) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id u17sm11371pgh.72.2021.02.16.12.36.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Feb 2021 12:36:14 -0800 (PST) From: Andrew Boyer To: dev@dpdk.org Cc: Alfredo Cardigliano , Andrew Boyer , stable@dpdk.org Date: Tue, 16 Feb 2021 12:35:40 -0800 Message-Id: <20210216203540.29290-16-aboyer@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216203540.29290-1-aboyer@pensando.io> References: <20210216203540.29290-1-aboyer@pensando.io> In-Reply-To: <20210204195853.13411-1-aboyer@pensando.io> References: <20210204195853.13411-1-aboyer@pensando.io> Subject: [dpdk-dev] [PATCH v2 15/15] net/ionic: fix code around lif init devcmd 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" The completion type was wrong. Don't check the completion if the wait timed out. Fixes: 669c8de67c88 ("net/ionic: support basic LIF") Cc: cardigliano@ntop.org Cc: stable@dpdk.org Signed-off-by: Andrew Boyer --- drivers/net/ionic/ionic_lif.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c index b8023e0632..cd220abee2 100644 --- a/drivers/net/ionic/ionic_lif.c +++ b/drivers/net/ionic/ionic_lif.c @@ -1605,17 +1605,18 @@ int ionic_lif_init(struct ionic_lif *lif) { struct ionic_dev *idev = &lif->adapter->idev; - struct ionic_q_init_comp comp; + struct ionic_lif_init_comp comp; int err; memset(&lif->stats_base, 0, sizeof(lif->stats_base)); ionic_dev_cmd_lif_init(idev, lif->info_pa); err = ionic_dev_cmd_wait_check(idev, IONIC_DEVCMD_TIMEOUT); - ionic_dev_cmd_comp(idev, &comp); if (err) return err; + ionic_dev_cmd_comp(idev, &comp); + lif->hw_index = rte_cpu_to_le_16(comp.hw_index); err = ionic_lif_adminq_init(lif);