From patchwork Mon Mar 2 14:32:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184069 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2170848ile; Mon, 2 Mar 2020 01:01:46 -0800 (PST) X-Google-Smtp-Source: ADFU+vvl357DPU/0TzVJJnPI7XAt5UQqNJjOVwx19nfFFi3mbWsuNePVJhEIVPjt0gT9dsDxrDZX X-Received: by 2002:a17:906:118e:: with SMTP id n14mr666510eja.194.1583139706565; Mon, 02 Mar 2020 01:01:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139706; cv=none; d=google.com; s=arc-20160816; b=Rup+B6Hv1q/nzJPDPWUqSAB66Y3ilO7/i6/vGA+85jEbdRx2hPQrwiRoxHRguIYgVo Xp8u1NwEruraE9e6G/P+NCg0Y05X8Vblx5ueSyU5Jl9bk09sj4vhlasy95i5S+EJTQie LFNHtoN+bubKA5cQrq1iNFDvZ+EJFF1r/bcBA2qBuJw9u+Nl0AKQlTpHMQplIUroP8d8 e+p5XLw3wGtNdFhjDs/0ae+4Num1csTA0+9T37MQWK4vQd5hTAmU0wlhJP08GYOB6Sve giMLgxOKQ/fLOgTtOxWC0F62qNB4mIppXU7L+CZx13X71bWl5+MwGcrjnVCMaupFLHlj UK5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=F6MIxAhlTa+5awRnQSGVMvphbfk+CpW7hO/3Sws5bk8=; b=jQzV0cnYzLf/+95WKCmCKVc/+aYELTicHYdTN1vlxorvY21XYckImrMnijK5tm1KdY d1shcl8rNzSUgem30+GiYhXZvbjONuqRNZF7MvcN9V2YpJGMGf0mwwFHTZEyFLpj3si1 vLMkr/KhPoWxARi1trbiaR8RpyocyIzoHEHtylMC4d7Vz5tsdeLF9N68VJugDEdr6udQ OrNEvZWGqtXWFCd/GeDdCl+VOdQ8nCf/2/QAPRaa+XJDgLN8ccsbF/MsbXVRgQe4DeU1 1jBxMUYmAvCu5wVjU0Xr2tzDHKHAAr0O3m8mcqD6d19Q6KKvOxi++FO38IWtyVUUDaBF bhIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id di2si3741267edb.472.2020.03.02.01.01.46; Mon, 02 Mar 2020 01:01:46 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 71FA01C0B0; Mon, 2 Mar 2020 10:00:27 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id C21F01C038 for ; Mon, 2 Mar 2020 10:00:20 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A7FBB1A0FDF; Mon, 2 Mar 2020 10:00:20 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 291391A0FA6; Mon, 2 Mar 2020 10:00:18 +0100 (CET) Received: from bf-netperf1.ap.com (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id DAE5C402ED; Mon, 2 Mar 2020 17:00:14 +0800 (SGT) From: Hemant Agrawal To: ferruh.yigit@intel.com Cc: dev@dpdk.org, g.singh@nxp.com, Alex Marginean Date: Mon, 2 Mar 2020 20:02:07 +0530 Message-Id: <20200302143209.11854-9-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200302143209.11854-1-hemant.agrawal@nxp.com> References: <20200302143209.11854-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 08/10] net/enetc: use bulk free in Tx clean X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: Alex Marginean Use rte_pktmbuf_free_bulk to release all mbufs at once. This is flagged as obsolete/not yet stable in DPDK but seems to be functional. Don't count the released frames, it's no longer needed in the caller. Signed-off-by: Alex Marginean --- drivers/net/enetc/Makefile | 1 + drivers/net/enetc/enetc_rxtx.c | 32 ++++++++++++++++++++++++-------- drivers/net/enetc/meson.build | 1 + 3 files changed, 26 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/net/enetc/Makefile b/drivers/net/enetc/Makefile index 7276026e3..7f7a85f64 100644 --- a/drivers/net/enetc/Makefile +++ b/drivers/net/enetc/Makefile @@ -11,6 +11,7 @@ LIB = librte_pmd_enetc.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) CFLAGS += -I$(RTE_SDK)/drivers/common/dpaax +CFLAGS += -DALLOW_EXPERIMENTAL_API EXPORT_MAP := rte_pmd_enetc_version.map SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_ethdev.c SRCS-$(CONFIG_RTE_LIBRTE_ENETC_PMD) += enetc_rxtx.c diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c index 8b85c5371..1acc43a08 100644 --- a/drivers/net/enetc/enetc_rxtx.c +++ b/drivers/net/enetc/enetc_rxtx.c @@ -20,8 +20,9 @@ static int enetc_clean_tx_ring(struct enetc_bdr *tx_ring) { int tx_frm_cnt = 0; - struct enetc_swbd *tx_swbd; - int i, hwci; + struct enetc_swbd *tx_swbd, *tx_swbd_base; + int i, hwci, bd_count; + struct rte_mbuf *m[ENETC_RXBD_BUNDLE]; /* we don't need barriers here, we just want a relatively current value * from HW. @@ -29,8 +30,10 @@ enetc_clean_tx_ring(struct enetc_bdr *tx_ring) hwci = (int)(rte_read32_relaxed(tx_ring->tcisr) & ENETC_TBCISR_IDX_MASK); + tx_swbd_base = tx_ring->q_swbd; + bd_count = tx_ring->bd_count; i = tx_ring->next_to_clean; - tx_swbd = &tx_ring->q_swbd[i]; + tx_swbd = &tx_swbd_base[i]; /* we're only reading the CI index once here, which means HW may update * it while we're doing clean-up. We could read the register in a loop @@ -42,20 +45,33 @@ enetc_clean_tx_ring(struct enetc_bdr *tx_ring) * meantime. */ while (i != hwci) { - rte_pktmbuf_free(tx_swbd->buffer_addr); + /* It seems calling rte_pktmbuf_free is wasting a lot of cycles, + * make a list and call _free when it's done. + */ + if (tx_frm_cnt == ENETC_RXBD_BUNDLE) { + rte_pktmbuf_free_bulk(m, tx_frm_cnt); + tx_frm_cnt = 0; + } + + m[tx_frm_cnt] = tx_swbd->buffer_addr; tx_swbd->buffer_addr = NULL; - tx_swbd++; + i++; - if (unlikely(i == tx_ring->bd_count)) { + tx_swbd++; + if (unlikely(i == bd_count)) { i = 0; - tx_swbd = &tx_ring->q_swbd[0]; + tx_swbd = tx_swbd_base; } tx_frm_cnt++; } + if (tx_frm_cnt) + rte_pktmbuf_free_bulk(m, tx_frm_cnt); + tx_ring->next_to_clean = i; - return tx_frm_cnt++; + + return 0; } uint16_t diff --git a/drivers/net/enetc/meson.build b/drivers/net/enetc/meson.build index bea54bea8..af11c0960 100644 --- a/drivers/net/enetc/meson.build +++ b/drivers/net/enetc/meson.build @@ -11,3 +11,4 @@ sources = files('enetc_ethdev.c', 'enetc_rxtx.c') includes += include_directories('base') +allow_experimental_apis = true