From patchwork Fri Mar 5 13:13:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balazs Nemeth X-Patchwork-Id: 88526 X-Patchwork-Delegate: jerinj@marvell.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 94E7EA0547; Fri, 5 Mar 2021 14:16:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7296522A270; Fri, 5 Mar 2021 14:16:24 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mails.dpdk.org (Postfix) with ESMTP id A223340691 for ; Fri, 5 Mar 2021 14:16:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614950181; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kX01gmTV3Jmf0xPBeIMerrM3moFVpKaxkXOTuMTjb0U=; b=HNEamo6Uj2vW7kisQ4dyQbT+koLjpiQeD4e/9Vg9afYT18l+gQSlrBkcsnPHW1pf2Rl5oc xuGsds62Hyl/ZO5cdqZjL9Ok9ND7rYjcj8vl4rm6rPzdtZphY9sL7yEmg4NDN0YhyIRony ijIkeltY0Q/PUCcSaNfJINpNTNuYgGA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-478-E42AnMtHNheI75uqNMu8bQ-1; Fri, 05 Mar 2021 08:14:22 -0500 X-MC-Unique: E42AnMtHNheI75uqNMu8bQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7AE481019629 for ; Fri, 5 Mar 2021 13:14:21 +0000 (UTC) Received: from bnemeth.users.ipa.redhat.com (ovpn-114-231.ams2.redhat.com [10.36.114.231]) by smtp.corp.redhat.com (Postfix) with ESMTP id B9ACB19D9B; Fri, 5 Mar 2021 13:14:20 +0000 (UTC) From: Balazs Nemeth To: bnemeth@redhat.com, dev@dpdk.org Date: Fri, 5 Mar 2021 14:13:59 +0100 Message-Id: <97ed95ca810e292b923c2494398c3556cba2408c.1614938727.git.bnemeth@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bnemeth@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH 1/8] net/qede: remove flags from qede_tx_entry and simplify to rte_mbuf 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" Each sw_tx_ring entry was of type struct qede_tx_entry: struct qede_tx_entry { struct rte_mbuf *mbuf; uint8_t flags; }; Leaving the unused flags member here has a few performance implications. First, each qede_tx_entry takes up more memory which has caching implications as less entries fit in a cache line while multiple entries are frequently handled in batches. Second, an array of qede_tx_entry entries is incompatible with existing APIs that expect an array of rte_mbuf pointers. Consequently, an extra array need to be allocated before calling such APIs and each entry needs to be copied over. This patch omits the flags field and replaces the qede_tx_entry entry by a simple rte_mbuf pointer. Signed-off-by: Balazs Nemeth --- drivers/net/qede/qede_rxtx.c | 20 ++++++++++---------- drivers/net/qede/qede_rxtx.h | 10 +--------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 75d78cebb..c91c96ece 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -426,8 +426,7 @@ qede_alloc_tx_queue_mem(struct rte_eth_dev *dev, /* Allocate software ring */ txq->sw_tx_ring = rte_zmalloc_socket("txq->sw_tx_ring", - (sizeof(struct qede_tx_entry) * - txq->nb_tx_desc), + (sizeof(txq->sw_tx_ring) * txq->nb_tx_desc), RTE_CACHE_LINE_SIZE, socket_id); if (!txq->sw_tx_ring) { @@ -523,9 +522,9 @@ static void qede_tx_queue_release_mbufs(struct qede_tx_queue *txq) if (txq->sw_tx_ring) { for (i = 0; i < txq->nb_tx_desc; i++) { - if (txq->sw_tx_ring[i].mbuf) { - rte_pktmbuf_free(txq->sw_tx_ring[i].mbuf); - txq->sw_tx_ring[i].mbuf = NULL; + if (txq->sw_tx_ring[i]) { + rte_pktmbuf_free(txq->sw_tx_ring[i]); + txq->sw_tx_ring[i] = NULL; } } } @@ -889,10 +888,11 @@ qede_free_tx_pkt(struct qede_tx_queue *txq) uint16_t idx; idx = TX_CONS(txq); - mbuf = txq->sw_tx_ring[idx].mbuf; + mbuf = txq->sw_tx_ring[idx]; if (mbuf) { nb_segs = mbuf->nb_segs; PMD_TX_LOG(DEBUG, txq, "nb_segs to free %u\n", nb_segs); + while (nb_segs) { /* It's like consuming rxbuf in recv() */ ecore_chain_consume(&txq->tx_pbl); @@ -900,7 +900,7 @@ qede_free_tx_pkt(struct qede_tx_queue *txq) nb_segs--; } rte_pktmbuf_free(mbuf); - txq->sw_tx_ring[idx].mbuf = NULL; + txq->sw_tx_ring[idx] = NULL; txq->sw_tx_cons++; PMD_TX_LOG(DEBUG, txq, "Freed tx packet\n"); } else { @@ -2243,7 +2243,7 @@ qede_xmit_pkts_regular(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) struct eth_tx_3rd_bd *bd3; struct rte_mbuf *m_seg = NULL; struct rte_mbuf *mbuf; - struct qede_tx_entry *sw_tx_ring; + struct rte_mbuf **sw_tx_ring; uint16_t nb_tx_pkts; uint16_t bd_prod; uint16_t idx; @@ -2306,7 +2306,7 @@ qede_xmit_pkts_regular(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) /* Fill the entry in the SW ring and the BDs in the FW ring */ idx = TX_PROD(txq); - sw_tx_ring[idx].mbuf = mbuf; + sw_tx_ring[idx] = mbuf; /* BD1 */ bd1 = (struct eth_tx_1st_bd *)ecore_chain_produce(&txq->tx_pbl); @@ -2612,7 +2612,7 @@ qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) /* Fill the entry in the SW ring and the BDs in the FW ring */ idx = TX_PROD(txq); - txq->sw_tx_ring[idx].mbuf = mbuf; + txq->sw_tx_ring[idx] = mbuf; /* BD1 */ bd1 = (struct eth_tx_1st_bd *)ecore_chain_produce(&txq->tx_pbl); diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h index fcb564a1b..335016847 100644 --- a/drivers/net/qede/qede_rxtx.h +++ b/drivers/net/qede/qede_rxtx.h @@ -203,14 +203,6 @@ struct qede_rx_queue { void *handle; }; -/* - * TX BD descriptor ring - */ -struct qede_tx_entry { - struct rte_mbuf *mbuf; - uint8_t flags; -}; - union db_prod { struct eth_db_data data; uint32_t raw; @@ -220,7 +212,7 @@ struct qede_tx_queue { /* Always keep qdev as first member */ struct qede_dev *qdev; struct ecore_chain tx_pbl; - struct qede_tx_entry *sw_tx_ring; + struct rte_mbuf **sw_tx_ring; uint16_t nb_tx_desc; uint16_t nb_tx_avail; uint16_t tx_free_thresh;