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; }