From patchwork Fri Mar 26 11:01:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balazs Nemeth X-Patchwork-Id: 89916 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 14122A0A02; Fri, 26 Mar 2021 12:02:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA97B40685; Fri, 26 Mar 2021 12:02:14 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id D3F7F4067B for ; Fri, 26 Mar 2021 12:02:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616756532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4StZusHLp8WLg21xylBBUdKcMIIqFSDHPkam9QF44kQ=; b=FeM6jUmEP+q0eGCAAhW1T55diQN9RbNZvSK80W+shQpoBkrhxyUokgOAoEgs1Efyb41pIN RRRABkT8rZ7tgh8SmWOI5EvKHof5tl8oDn01Tl+6jB/MNobgz7zaeVuI17f0RHrsWoLp6E J54mIqDSouEEj7SXWzxW0MYtI5FZ2fc= 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-274-p8Fhg7VVNhWc4rUQ1fKo3g-1; Fri, 26 Mar 2021 07:02:10 -0400 X-MC-Unique: p8Fhg7VVNhWc4rUQ1fKo3g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A5BB4501EC; Fri, 26 Mar 2021 11:02:09 +0000 (UTC) Received: from bnemeth.users.ipa.redhat.com (ovpn-114-31.ams2.redhat.com [10.36.114.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F04E369A; Fri, 26 Mar 2021 11:02:07 +0000 (UTC) From: Balazs Nemeth To: bnemeth@redhat.com, dev@dpdk.org Cc: dsinghrawat@marvell.com, rmody@marvell.com, jerinjacobk@gmail.com, irusskikh@marvell.com Date: Fri, 26 Mar 2021 12:01:24 +0100 Message-Id: <30fdd376f6019a8b1115374a23b7bf92e2fc5a2a.1616754844.git.bnemeth@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 v2 1/7] net/qede: remove flags from Tx entry 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 Reviewed-by: Igor Russkikh --- drivers/net/qede/qede_rxtx.c | 22 ++++++++++++---------- drivers/net/qede/qede_rxtx.h | 10 +--------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 87f52d725..d2f77ed2e 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -393,6 +393,7 @@ qede_alloc_tx_queue_mem(struct rte_eth_dev *dev, struct ecore_dev *edev = &qdev->edev; struct qede_tx_queue *txq; int rc; + size_t sw_tx_ring_size; txq = rte_zmalloc_socket("qede_tx_queue", sizeof(struct qede_tx_queue), RTE_CACHE_LINE_SIZE, socket_id); @@ -425,9 +426,9 @@ qede_alloc_tx_queue_mem(struct rte_eth_dev *dev, } /* Allocate software ring */ + sw_tx_ring_size = sizeof(txq->sw_tx_ring) * txq->nb_tx_desc; txq->sw_tx_ring = rte_zmalloc_socket("txq->sw_tx_ring", - (sizeof(struct qede_tx_entry) * - txq->nb_tx_desc), + sw_tx_ring_size, RTE_CACHE_LINE_SIZE, socket_id); if (!txq->sw_tx_ring) { @@ -523,9 +524,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 +890,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 +902,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 +2245,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 +2308,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 +2614,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;