From patchwork Mon Mar 2 14:32:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184062 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2169385ile; Mon, 2 Mar 2020 01:00:25 -0800 (PST) X-Google-Smtp-Source: APXvYqyXpa/AryZ4RkdyOG6FVu17RP2MIhNQskAUkyMhaDEt/y+ByaQVpJVm5MGALN0SG8blxuzE X-Received: by 2002:a17:906:d8cf:: with SMTP id re15mr12858142ejb.175.1583139625274; Mon, 02 Mar 2020 01:00:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139625; cv=none; d=google.com; s=arc-20160816; b=GqmrRvp7KP8c4j6WYGFtJ0URQPzNpvgYvEckDgRsf1eFj9N9lYssVCOEqLPLim3AZz X7u3AcKk3/ItYu8lHrsjIlgHXJZN5YpTXADc+sxt4WWT0AvCvS33oa9NkEx5v7xbjx58 05B6tl5MZ/yJcm6o+r/ZxyVFfKbkbDY2Xdmt+xd3GfXnf5Fw6JjdTkAAGPCOX1iz3kTz QCg7bglj4inC19qdCjrELlixGqdBW6kDpua3yNUK445x2ZTyAJ/r1iCRUTqfS4KcvPcA AIEDBKxxL8/jrpBpNe/FwYkNq/Pa6ZHtUrGa29NuO3RCOXdIj58lnuLfguzggZTy4F8t 9SPw== 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=/08LBtgr13gVxLDmpKSFjiTodOl4/rdZ5w70B9ea9lg=; b=cT5XBSW2M2FBPz7YY6G0ZH4jepONCyydmtSj2rfB78EF+w5SUk+71c6R2+py4nnHeu h2CNgV8GEBK1nUAIBpRfsrdv4xbpc/P0fqR+mJePsBK02OulAdjOIgJr77oOco+GZLON mg3SVcoH4rERo5sHzKDPutnfcI0Nu4d2Ptdv18QrIuQ7jo8FLwtdSQsu3vabUAEC+0Qx mUSOuuISL7ppqF8af3SEUrBRfDLadHdAb1aGh57DDIp6wiko5XnHvQkj/7wQIPh4lxQG RttFhoyBEQL9A63/yBDM3NGBD9eE6LIcqpqVAh258NRasVKP2p5x9ZOHNdWX5+je1wmb 2MqQ== 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 nv5si5942701ejb.452.2020.03.02.01.00.25; Mon, 02 Mar 2020 01:00:25 -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 7D10D1C011; Mon, 2 Mar 2020 10:00:17 +0100 (CET) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 389081C00D for ; Mon, 2 Mar 2020 10:00:16 +0100 (CET) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C95C720017C; Mon, 2 Mar 2020 10:00:15 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 49C09200F6F; Mon, 2 Mar 2020 10:00:13 +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 F326540320; Mon, 2 Mar 2020 17:00:08 +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:00 +0530 Message-Id: <20200302143209.11854-2-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 01/10] net/enetc: do not stall in clean Tx ring 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 Don't read the hardware CI register in a loop, read it once, clean up and exit. The issue with reading the register in a loop is that we're stalling here trying to catch up with hardware which keeps sending traffic as long as it has traffic to send, so in effect we could be waiting here for the Tx ring to be drained by hardware, instead of us doing Rx in that meantime. At the time we return the function there may be new BDs in the ring that could be cleaned, we're just leaving those there for the next time. Signed-off-by: Alex Marginean --- drivers/net/enetc/enetc_rxtx.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c index 81b0ef3b1..b7ecb75ec 100644 --- a/drivers/net/enetc/enetc_rxtx.c +++ b/drivers/net/enetc/enetc_rxtx.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2019 NXP + * Copyright 2018-2020 NXP */ #include @@ -21,12 +21,24 @@ enetc_clean_tx_ring(struct enetc_bdr *tx_ring) { int tx_frm_cnt = 0; struct enetc_swbd *tx_swbd; - int i; + int i, hwci; i = tx_ring->next_to_clean; tx_swbd = &tx_ring->q_swbd[i]; - while ((int)(enetc_rd_reg(tx_ring->tcisr) & - ENETC_TBCISR_IDX_MASK) != i) { + + hwci = (int)(enetc_rd_reg(tx_ring->tcisr) & + ENETC_TBCISR_IDX_MASK); + + /* 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 + * but for now I assume it's OK to leave a few Tx frames for next call. + * The issue with reading the register in a loop is that we're stalling + * here trying to catch up with HW which keeps sending traffic as long + * as it has traffic to send, so in effect we could be waiting here for + * the Tx ring to be drained by HW, instead of us doing Rx in that + * meantime. + */ + while (i != hwci) { rte_pktmbuf_free(tx_swbd->buffer_addr); tx_swbd->buffer_addr = NULL; tx_swbd++; From patchwork Mon Mar 2 14:32:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184063 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2169548ile; Mon, 2 Mar 2020 01:00:35 -0800 (PST) X-Google-Smtp-Source: APXvYqyfSoKMBfUxkqaM19/BmPETnLyAG60QXAi6d0p4SBbAQuX3vNZwPLnX2NDz33A8GPieNf2s X-Received: by 2002:a17:906:9615:: with SMTP id s21mr14232230ejx.20.1583139635536; Mon, 02 Mar 2020 01:00:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139635; cv=none; d=google.com; s=arc-20160816; b=gTmKeRwdgcQu4bkQOIdrABqQ7o3RPTeP0+5FWRG42LpYj6IpTOjJibcii4bgLCEmEp a4tI+lvFQ1YXF6vszFSnFmywAV9jHi/586dbiL+uERk0uNHhLd4bEfQyMnI8kGQ4BI4b v5WetiHlVTnVrxJp4UVQy+mAoJOBAUJLYlDOE0gt2Yp//viykhNtVW8NZTEdkf8c2+TB gdaFmMEOR02M4FrsBBGIPXYZFgR0hVxJPrsEUtynazc9R4FUdcef1cXX43oAMXzVS+vD rjkUSjIP4yXPhrf8A8d3E5wkJv4X7cWSiChdzbhRBmKN/t5L0ROQ/1nfxgYcKOiREtEv mdvg== 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=Yr5e17qwDOy2jvlMd8OGbFgqMvmOzo5gLHyoeAOcRFo=; b=uMC+l7IHaQo4BNIUzSWMkBRnqBOcQSCSoET/Y7sx8jl3iQRbnk0kaBVXFokzhtG48G 2n4S/PxKrzc0gQlWnoaMNgl5NMP+7HaBsO6T9OiDz2SClU2gjZCdnIOkquf1X5mMPZgF vQOHJak+vNwwwtjKVXXl2TOl4spUC0tP95Ayuh0CV4ViCmIt6FFFkNZFow6t7ZwbdonY TWZl+6v4TJe4Ta7ovMbVi2jGIpDlmP6bItpL9kmPiclEF172atFLbsLDHhEQOcctubDt 2benWA6RruvulpFPwF7AGDYKEPKf+bq05hsa0sTNu8DQb37Bd+3+F//TgByirfiBSZq/ pQxA== 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 i6si1720988ejy.300.2020.03.02.01.00.35; Mon, 02 Mar 2020 01:00:35 -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 03F151C028; Mon, 2 Mar 2020 10:00:19 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 34C691C001 for ; Mon, 2 Mar 2020 10:00:16 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E3FE01A0FB0; Mon, 2 Mar 2020 10:00:15 +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 64F111A1005; Mon, 2 Mar 2020 10:00:13 +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 B8C6540323; Mon, 2 Mar 2020 17:00:09 +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:01 +0530 Message-Id: <20200302143209.11854-3-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 02/10] net/enetc: use relaxed read for Tx CI in clean Tx 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 We don't need barriers here since this read doesn't have to be strictly serialized in relation to other surrounding memory/register accesses. We only want a reasonably recent value out of hardware so we know how much we can clean. Signed-off-by: Alex Marginean --- drivers/net/enetc/enetc_rxtx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c index b7ecb75ec..395f5ecf4 100644 --- a/drivers/net/enetc/enetc_rxtx.c +++ b/drivers/net/enetc/enetc_rxtx.c @@ -23,12 +23,15 @@ enetc_clean_tx_ring(struct enetc_bdr *tx_ring) struct enetc_swbd *tx_swbd; int i, hwci; + /* we don't need barriers here, we just want a relatively current value + * from HW. + */ + hwci = (int)(rte_read32_relaxed(tx_ring->tcisr) & + ENETC_TBCISR_IDX_MASK); + i = tx_ring->next_to_clean; tx_swbd = &tx_ring->q_swbd[i]; - hwci = (int)(enetc_rd_reg(tx_ring->tcisr) & - ENETC_TBCISR_IDX_MASK); - /* 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 * but for now I assume it's OK to leave a few Tx frames for next call. From patchwork Mon Mar 2 14:32:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184064 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2169754ile; Mon, 2 Mar 2020 01:00:47 -0800 (PST) X-Google-Smtp-Source: APXvYqy9GoF4s3m03lpMswMGZvnMBsFJ++p3Fi/ow0x6Pa8+JOLi1WWbIulPYt7gPs1qiylPxvXi X-Received: by 2002:a17:906:2498:: with SMTP id e24mr13905117ejb.223.1583139647782; Mon, 02 Mar 2020 01:00:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139647; cv=none; d=google.com; s=arc-20160816; b=LQqk/SLc/GowK3AR4wxnlSMd5VefG3kuO9liaN3hAhPVk8p3OC6SpSGNulBrrFWrpr 3/Zjbse0yGHxwZUJK7muW4dF3jXgtzy48yGqQIuFBaw9FMxCuMhA9Yz0PlSHEUbMZZ7u ifNw5w4DBVeuuWaMYRpDmEamz6NJoGSZkMGEl+O7yukyPJg7x2f9Z4XJcWdORowiC4Pw ulh0F+XudVyPrnsUFcesIeN97be62hIPvR72blUMFlYPnd4XR34a8LszPKKbSjlkMxlC BBmx8r0d0jRP3fwPWGR+G7kOa7FqC02oNSM3cypGQou4VwyHH2KAKAnRrSIqkHLIA2vA ZJig== 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=3Jz631ZnVJ48KhwvuOF4lDGfMxw45dPZSOfqwcszhT8=; b=CnyKUUokO6T2uXVah21Tm9LwXtkt25JfHKEVJ0Ldx82GPqF9sGZoCFsEAB7Fwi1qHm TZDSwWr2OUFdEHS2ouUn0qUU8uQTFhWwFfqmIYMiGotgs31Sg7QOp0xKwr+m2dSmxTpP CaKq8J9TYKmrCLJfGEhLEMwe+w4zYRuYTJqDB7v9xkcL7gTgOQKCIUQv+MNmk+tsu0aD JOXA2O8JuO8n/vOV1jxYQfz/OGcBJkY52/dF+/cC0SM85SNUTozk+lm3Ps1gL3+u1eRy UDP3PyaYL2PWmG275vsOruguCsUq3dBhcGGvg5MjAK9d5Qu0InKMT76qBrjtM0fIAq0m 4wxw== 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 v9si6298963ejw.11.2020.03.02.01.00.47; Mon, 02 Mar 2020 01:00:47 -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 7867B1C030; Mon, 2 Mar 2020 10:00:20 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id BB3191C00D for ; Mon, 2 Mar 2020 10:00:16 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 79B3C1A0FC5; Mon, 2 Mar 2020 10:00:16 +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 EF5DC1A0FE2; Mon, 2 Mar 2020 10:00:13 +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 8B08D4029E; Mon, 2 Mar 2020 17:00:10 +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:02 +0530 Message-Id: <20200302143209.11854-4-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 03/10] net/enetc: batch process enetc clean Tx ring calls 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 Each call to enetc_clean_tx_ring will cost at least 150-200 CPU cycles even if no clean-up is done, due to the CI register read. We're only calling it once at the end of the function, on the assumption that software is slower than hardware and hardware completed sending older frames out by now. We're also cleaning up the ring before kicking off Tx for the new batch to minimize chances of contention on the Tx ring. Signed-off-by: Alex Marginean --- drivers/net/enetc/enetc_rxtx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c index 395f5ecf4..958e3a21d 100644 --- a/drivers/net/enetc/enetc_rxtx.c +++ b/drivers/net/enetc/enetc_rxtx.c @@ -76,7 +76,6 @@ enetc_xmit_pkts(void *tx_queue, start = 0; while (nb_pkts--) { - enetc_clean_tx_ring(tx_ring); tx_ring->q_swbd[i].buffer_addr = tx_pkts[start]; txbd = ENETC_TXBD(*tx_ring, i); tx_swbd = &tx_ring->q_swbd[i]; @@ -92,6 +91,14 @@ enetc_xmit_pkts(void *tx_queue, i = 0; } + /* we're only cleaning up the Tx ring here, on the assumption that + * software is slower than hardware and hardware completed sending + * older frames out by now. + * We're also cleaning up the ring before kicking off Tx for the new + * batch to minimize chances of contention on the Tx ring + */ + enetc_clean_tx_ring(tx_ring); + tx_ring->next_to_use = i; enetc_wr_reg(tx_ring->tcir, i); return start; From patchwork Mon Mar 2 14:32:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184065 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2169994ile; Mon, 2 Mar 2020 01:01:01 -0800 (PST) X-Google-Smtp-Source: APXvYqzbUChmQEtKEN5fuLvmO0/v0mwKhUuc2wCsbmSzP4EJ1x+T5UKQvjx/R68HVhnV88QgQoRE X-Received: by 2002:a50:ed12:: with SMTP id j18mr15538199eds.337.1583139661534; Mon, 02 Mar 2020 01:01:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139661; cv=none; d=google.com; s=arc-20160816; b=Mb/9hsCymefei5Mxc4R9z1MOAnEUFTUtNmhYFBtYhT3GGEv7eswIJ9ihreDgKozvIf BfEnbS00hQg3XrhZEHN5h793Len1jILU4umVBPY4MY5a73EL8Kuyi+Z9AIq0pRV6ZNnn TRutmO0VvmAsQNzmMD3yuOvWXqP5k/SUqiZgzcKQh4nQ3IbGNBSEyK24Hc3i3Ia6XVpi cQjBOknesJ0aBGtEqa4AvGB9qvS0qhCp1TGpGPrdrlIhoQXdI+hG4nqoI2KqeQ/U8q2C vWrxKBZcgZmuYvFG10NREi6EaYZfU2WAH56NBijSsnHfXu6xFPNYd/3mUvsof/IgfAHH WUaw== 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=/jKQuQxA8iGMpVbmNTbTfkr1HF2d47x4rhivHWKoPOk=; b=SoCkmbWdZcoXz3+tnQOBCm0bziM5Zrt2phdsgubmOHwZXqRXMirqiDnnP3HBxERM8n YGk9iURa4dJdJLSP+/NcbrFpLPWNV0XopNimo4TJknodPHcc0xaU4RGtAPvJRWCukbed +H79OV1rQLcgxfARWyiN+Yn2OWt6dR6xjmne3uNQusIDt0+BucphddkfZ733usBp17wX HcP8Meca49HFWepUNBYoRiX0kAW7laOIjdYRTR4eU7Nmzx8OWtpXmNATGoumRzrDmhdW P2Q0GV2jtD+iDFEcAYoRxmSGVIderM2OSTgAG0INNkZBRpl1YzUog46ibykxiy+bzxOZ k34w== 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 si2si6005092ejb.69.2020.03.02.01.01.01; Mon, 02 Mar 2020 01:01:01 -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 4C24C1C067; Mon, 2 Mar 2020 10:00:22 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id BA3431C01B for ; Mon, 2 Mar 2020 10:00:17 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 9EFED1A0FBA; Mon, 2 Mar 2020 10:00:17 +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 1F4311A0FC1; Mon, 2 Mar 2020 10:00:15 +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 6C60D402F3; Mon, 2 Mar 2020 17:00:11 +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:03 +0530 Message-Id: <20200302143209.11854-5-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 04/10] net/enetc: erratum wa for Rx lock-up issue 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 The default value in hardware for the Rx MAC FIFO (@) is higher than it should be and can lead to Rx lock-up under traffic. Set it to the value recommended by hardware team, 1. Signed-off-by: Alex Marginean Signed-off-by: Gagandeep Singh --- drivers/net/enetc/base/enetc_hw.h | 3 ++- drivers/net/enetc/enetc_ethdev.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h index 2fe7ccb5b..00813284e 100644 --- a/drivers/net/enetc/base/enetc_hw.h +++ b/drivers/net/enetc/base/enetc_hw.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2019 NXP + * Copyright 2018-2020 NXP */ #ifndef _ENETC_HW_H_ @@ -86,6 +86,7 @@ enum enetc_bdr_type {TX, RX}; #define ENETC_PSIPMAR1(n) (0x00104 + (n) * 0x20) #define ENETC_PCAPR0 0x00900 #define ENETC_PCAPR1 0x00904 +#define ENETC_PM0_RX_FIFO 0x801C #define ENETC_PM0_IF_MODE 0x8300 #define ENETC_PM1_IF_MODE 0x9300 #define ENETC_PMO_IFM_RG BIT(2) diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index 20b77c006..eb637d030 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018-2019 NXP + * Copyright 2018-2020 NXP */ #include @@ -147,6 +147,9 @@ enetc_hardware_init(struct enetc_eth_hw *hw) hw->hw.port = (void *)((size_t)hw->hw.reg + ENETC_PORT_BASE); hw->hw.global = (void *)((size_t)hw->hw.reg + ENETC_GLOBAL_BASE); + /* WA for Rx lock-up HW erratum */ + enetc_port_wr(enetc_hw, ENETC_PM0_RX_FIFO, 1); + /* Enabling Station Interface */ enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN); From patchwork Mon Mar 2 14:32:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184066 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2170232ile; Mon, 2 Mar 2020 01:01:13 -0800 (PST) X-Google-Smtp-Source: APXvYqwBP7UkmmpRKU3DtqrLXFu09l0rpBYzGQj/HUgToLZ2+uwUKPFJFTDRmg4kxTjPBAsF47pR X-Received: by 2002:a17:906:5acd:: with SMTP id x13mr14703119ejs.147.1583139672975; Mon, 02 Mar 2020 01:01:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139672; cv=none; d=google.com; s=arc-20160816; b=YsqOsuwD+oqEx8ME6HkVrUUaOwoIMXCIEpyaBinAse5/17pYgvv+M+fAhBOGNEj77M 4iwIK5jPBAugCMYaYYBd2wZXne/2mW+Xh4juFG9GNv5BTQ7Zvh1+08BDkqzpcmL4zmZ/ Cf0k+1Gx71x1WPFOHY5eebRlw7nHe0IZVtq+vLxbLL6TjmC+bGvi33mWCNUbNqqj02qu 0axA/0y89bWiHJBs2Wlsa2PJumwkfZ6rTUrsOnajicILwcMB9CfnUSLEf05jlMmSxtpX 6VgAzhpMKa/tmW9ZwQ8geyRIxsBy81Zn4YViBoMdQp3OLZxKxv1QseJXwpwBcRAIPqDq nqUg== 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=ZaqNnk3Km/9XAjh0C8gETSn+rBLpXjqFx3OfqUhuA3Q=; b=WxdM12H3JZ8ycit+rWu4XwSrh0Ts3NNj5mx2W6oWyXCEykbbsxT6ZD7MINQon80mTY ptBzNt7tHnwgAZ0RGq0D5wkwx1LfSnAszbax23egT583kWkfm07zs9TTAV35Hr5jAu58 /QH8jRauTCueI3cpUKWpp/fnOJ5SM6Hn387Tu2CLeFD4E6Wz1psRHamCtPHrdz6XOveK IjkZcgs/XJdrSjeuekF+TmNsW8MThM39tsddvrq0GZh1CtjYS/9erxD+cOBBS61fmdLQ fZ20LhUCWO6Z9Rkz9G/yOl8nHX775vdShUp8ppxi/obp46QYDOLLmK4Px4Lco8C6KLUo t/jA== 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 e2si5160708ejd.235.2020.03.02.01.01.12; Mon, 02 Mar 2020 01:01:12 -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 9DB211C07B; Mon, 2 Mar 2020 10:00:23 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 35E921C01B for ; Mon, 2 Mar 2020 10:00:18 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 172321A0FC1; Mon, 2 Mar 2020 10:00:18 +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 8BC9A1A0FA6; Mon, 2 Mar 2020 10:00:15 +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 4B64840324; Mon, 2 Mar 2020 17:00:12 +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:04 +0530 Message-Id: <20200302143209.11854-6-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 05/10] net/enetc: improve batching Rx ring refill 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 Move from doing batch refill of Rx ring from bundles of 8 to once per enetc_clean_rx_ring call. One benefit is that we're cleaning up all the BDs that we just processed, which should still be cached. The other is that hardware Rx index stays a little back and doesn't cause contention on the BDs processed in the Rx loop. Signed-off-by: Alex Marginean --- drivers/net/enetc/enetc_rxtx.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c index 958e3a21d..262ed8a0f 100644 --- a/drivers/net/enetc/enetc_rxtx.c +++ b/drivers/net/enetc/enetc_rxtx.c @@ -14,8 +14,6 @@ #include "enetc.h" #include "enetc_logs.h" -#define ENETC_RXBD_BUNDLE 8 /* Number of BDs to update at once */ - static int enetc_clean_tx_ring(struct enetc_bdr *tx_ring) { @@ -305,12 +303,6 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring, union enetc_rx_bd *rxbd; uint32_t bd_status; - if (cleaned_cnt >= ENETC_RXBD_BUNDLE) { - int count = enetc_refill_rx_ring(rx_ring, cleaned_cnt); - - cleaned_cnt -= count; - } - rxbd = ENETC_RXBD(*rx_ring, i); bd_status = rte_le_to_cpu_32(rxbd->r.lstatus); if (!bd_status) @@ -337,6 +329,8 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring, rx_frm_cnt++; } + enetc_refill_rx_ring(rx_ring, cleaned_cnt); + return rx_frm_cnt; } From patchwork Mon Mar 2 14:32:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184067 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2170444ile; Mon, 2 Mar 2020 01:01:24 -0800 (PST) X-Google-Smtp-Source: ADFU+vuEup6nyNEfms+4hctFwiish2QmAbxDQ3xnNYzR0TML23e6EsjYAVSXuCQQtPsvxOpztpoN X-Received: by 2002:a17:906:d97a:: with SMTP id rp26mr4218517ejb.141.1583139684410; Mon, 02 Mar 2020 01:01:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139684; cv=none; d=google.com; s=arc-20160816; b=X8TZIFCFXsCcXv0/0TvOU5L8L2Vc7piFYXnYYmItMCXQSGnOx0pHx89v4M4azUnkZr Jup/qtDXsaC2N1SvByTpkhGExIfP+DnaMsIoG3lCKak8pLiqF1G7YCdnYj8uDwA3Lj1O FsArznAjDe33TqrqqTkKto17HVCvVpt9uoaOBN2jWSIe8GqzbudHGKr1QEVHwTc7cPs3 qbfao7STpid8TvVeQCP7aDq0qhT+WI/KEV9xxIXpGQfRLlkuzZ7LOnQQNCa7rvA/oAsV CruqVuva75E7ljNonRbufTUgB791WBCza4gd80nHWKQnfqFBfMwk8n7JucEYxpocuKW4 9iRQ== 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=5gRk83cLnKfH6+r253XNHxbR2oCCew+H3DxW1dID5PI=; b=KF+2Kj9L1HO1GAZy5BH+JMbdvwCIkof1/QQoPW9M6ruwzNpi0SkoaCCv3wqg6D0Y0/ M+9i0MzScnLp2bI3yOqiaYm63bUIQ3zPtwSox4skaKCd7dAG+OHrkCvT98l6n65iC9D2 9u3ERoQOZTZn9o4VgNrJJdZt8suImRbuDQ9SDfcKnD8pUX4eIKl3DzsvLXz5k6OPjN1b JC9hg3E0qiPqEPADa4GZqQJXKnXS2Lw0DuSkBbm3HE3Z4awa++chLcSlrTiD0IgP8dfa 83I6SML8Beod2Bd2k8JawlWvFZZMVo94Znn8KskSHyPB172b0lGfaSAyKpzsqPshv1Qy LUKw== 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 j10si6503394edq.384.2020.03.02.01.01.24; Mon, 02 Mar 2020 01:01:24 -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 E633B1C07D; Mon, 2 Mar 2020 10:00:24 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 06CE51C029 for ; Mon, 2 Mar 2020 10:00:19 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id DF9901A0FAA; Mon, 2 Mar 2020 10:00:18 +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 6A2DE1A100E; Mon, 2 Mar 2020 10:00:16 +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 2DC7C40299; Mon, 2 Mar 2020 17:00:13 +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:05 +0530 Message-Id: <20200302143209.11854-7-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 06/10] net/enetc: cache align enetc bdr structure 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 Reorder the members of the structure so that the ones used on datapath fit in a single cache line, to slightly reduce pressure on cache and miss rate. Signed-off-by: Alex Marginean --- drivers/net/enetc/enetc.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/net/enetc/enetc.h b/drivers/net/enetc/enetc.h index 8c830a5c0..14ef3bc18 100644 --- a/drivers/net/enetc/enetc.h +++ b/drivers/net/enetc/enetc.h @@ -53,23 +53,23 @@ struct enetc_swbd { }; struct enetc_bdr { - struct rte_eth_dev *ndev; - struct rte_mempool *mb_pool; /* mbuf pool to populate RX ring. */ void *bd_base; /* points to Rx or Tx BD ring */ + struct enetc_swbd *q_swbd; union { void *tcir; void *rcir; }; - uint16_t index; int bd_count; /* # of BDs */ int next_to_use; int next_to_clean; - struct enetc_swbd *q_swbd; + uint16_t index; + uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */ union { void *tcisr; /* Tx */ int next_to_alloc; /* Rx */ }; - uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */ + struct rte_mempool *mb_pool; /* mbuf pool to populate RX ring. */ + struct rte_eth_dev *ndev; }; /* From patchwork Mon Mar 2 14:32:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184068 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2170615ile; Mon, 2 Mar 2020 01:01:34 -0800 (PST) X-Google-Smtp-Source: APXvYqwtA7fpMjgmCc1FYMjGPKjZHr9gKDSKqxgCUTqeF+EFCdzMAFm9tHRvRyaQJJEmKZD7Z2zP X-Received: by 2002:a17:906:4ecc:: with SMTP id i12mr13589036ejv.227.1583139694550; Mon, 02 Mar 2020 01:01:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139694; cv=none; d=google.com; s=arc-20160816; b=P/JuMq1mu6UByb31EmNQ4Y0Ek4c/QB/rn2/+5TV4mufDnihj+sW8qdpJXHMK25GJcZ Ro70d9tANoG7XTbcthCaUFmE3GXRL60CtrvD8ygWdwicj1uglTTj49vQ783uLcg7Wige ihF+w0pY6aAjEMydtaxHbgmtlvd/Tn5Hm8VxbKSXIjbdDwY1N7hrxzR87hsyMPjCQeda hnHb3iiF+Ed0dFJWCUxdlwykWfw3UWK29EIdwPuk7FagRmBPsFrQsgxRmt4jeETQe6MR Os5Ye/lVAsY9zJFdHotqEgzgD/iHXsf665WcXAWMHlvb7m74hHytvNvlxvElF8s8C+lR 4qUA== 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=WI1nqzdFM3vZiN3yoOzgQlD+WPA6dlTYZuDK9FE7p1I=; b=Tvs/KdL8aU29lZQZPtuH93pE9qPUXE1cnGj7XUXwgvdtyhqlCKctLDmEuJcaaR9Z6d kY86XCcLn7CW6WdghERfNB2Ar78BMCvlpBrinOqoZq7qR/MJFiIQD4Tx3EbqZFa94LIM sNeqIsbqshEkPmg0rKFhUlRu3+EYwHs7MQs+bIv/A1Y1HWJpRuxdsErpD7QP1orwDWAs mRZTcfal0x5WcqJUhs519xtzb8zyPhrJinOja744cGKBBeVrxoCzTLN18dscyafik/Hp svRpk+zbNH7lUMlGqjD2sq9sVvAFKkr8bvq4q1kRzYJUMssdRnGLP43+zdY55Ce/6OwE hLzQ== 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 w24si6440115eju.308.2020.03.02.01.01.34; Mon, 02 Mar 2020 01:01:34 -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 2AF5E1C08E; Mon, 2 Mar 2020 10:00:26 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id E07A81C02C for ; Mon, 2 Mar 2020 10:00:19 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id C52841A0FC8; Mon, 2 Mar 2020 10:00:19 +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 437091A0FB4; Mon, 2 Mar 2020 10:00:17 +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 0C67F402D5; Mon, 2 Mar 2020 17:00:13 +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:06 +0530 Message-Id: <20200302143209.11854-8-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 07/10] net/enetc: use bulk alloc in Rx refill ring 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 Since we know in advance that we're going to fill in multiple descriptors it's convenient to allocate the buffers in batches. Signed-off-by: Alex Marginean --- drivers/net/enetc/enetc_rxtx.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c index 262ed8a0f..8b85c5371 100644 --- a/drivers/net/enetc/enetc_rxtx.c +++ b/drivers/net/enetc/enetc_rxtx.c @@ -14,6 +14,8 @@ #include "enetc.h" #include "enetc_logs.h" +#define ENETC_RXBD_BUNDLE 16 /* Number of buffers to allocate at once */ + static int enetc_clean_tx_ring(struct enetc_bdr *tx_ring) { @@ -107,15 +109,25 @@ enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt) { struct enetc_swbd *rx_swbd; union enetc_rx_bd *rxbd; - int i, j; + int i, j, k = ENETC_RXBD_BUNDLE; + struct rte_mbuf *m[ENETC_RXBD_BUNDLE]; + struct rte_mempool *mb_pool; i = rx_ring->next_to_use; + mb_pool = rx_ring->mb_pool; rx_swbd = &rx_ring->q_swbd[i]; rxbd = ENETC_RXBD(*rx_ring, i); for (j = 0; j < buff_cnt; j++) { - rx_swbd->buffer_addr = (void *)(uintptr_t) - rte_cpu_to_le_64((uint64_t)(uintptr_t) - rte_pktmbuf_alloc(rx_ring->mb_pool)); + /* bulk alloc for the next up to 8 BDs */ + if (k == ENETC_RXBD_BUNDLE) { + k = 0; + int m_cnt = RTE_MIN(buff_cnt - j, ENETC_RXBD_BUNDLE); + + if (rte_pktmbuf_alloc_bulk(mb_pool, m, m_cnt)) + return -1; + } + + rx_swbd->buffer_addr = m[k]; rxbd->w.addr = (uint64_t)(uintptr_t) rx_swbd->buffer_addr->buf_iova + rx_swbd->buffer_addr->data_off; @@ -124,6 +136,7 @@ enetc_refill_rx_ring(struct enetc_bdr *rx_ring, const int buff_cnt) rx_swbd++; rxbd++; i++; + k++; if (unlikely(i == rx_ring->bd_count)) { i = 0; rxbd = ENETC_RXBD(*rx_ring, 0); 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 From patchwork Mon Mar 2 14:32:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184070 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2171069ile; Mon, 2 Mar 2020 01:01:59 -0800 (PST) X-Google-Smtp-Source: APXvYqzfebRwmwXDhQRdvQ0sYHAkq8fJQk3gb9UHTHKG0ZHrAntXztd86fU2+ChYkuakHrkshdIG X-Received: by 2002:a17:906:5a99:: with SMTP id l25mr14130413ejq.277.1583139719838; Mon, 02 Mar 2020 01:01:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139719; cv=none; d=google.com; s=arc-20160816; b=UzUMepRI95l2rDnB/k16VaH/Vt7JRdDNl6U7n1q+O0apZ5B5cIk1+NdSwsw2UQLKYU 5lqDNvuPqAegn+Ewqyaic10dhRid/ba4accaUcQDJ9vrNFfpF72oqtYbG3hcYraS7UMv 3fcWii5g93HKlSaCv2zjfJHjctkerrepdp7YYPIEj5oqHjBkzfZA2Jbp0anIoW8CTA8i Msu/Kjl2qg2PlLql4yVq7TEAEjr937bctpinwYXCWj/66lCaQbskk1r32xELB/D8av/+ EVw3owcmJRbHKmDtef2JhbaMDB6Jm5PGIEOn0aXsbQhxHjyBUpNXnrg22ekUh8Jkd2N/ OpIA== 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=utnT1FyxiN3xwUiWPcmLJR5Qi98ClvEE0lCOu1MpBVU=; b=aPfPZxeYGg7jyFrJJ8IdFry6fAhfic6vIcRePyQbjDw/0pgVNTpNgymKC+vMO0q9zC rLlUO8X5TJpR2a+QgFpW1To4q8u7LZjzQoTS9FJKHuzgOzIVOyhDAMWPmIr1ieUljLu5 y9RPDbCv4bgBTyk8giy/G/LqmrTtaaBYbMdxURaS8QttJk8qnhNgyadn/orJjY/LL2Oh 9cRHNHcr/sd//s71jsmjm+ZvHmj8T88U1K4FXepPNmO2O1hOO/7NAtjZg8GY4c9IFu+V A29rkUxX3uZy5F67d5PrRd2UiDnxIBjD2soWHvYnsn/mSxJaPc1hV4vjKW0Y5Okv7xCF ftcA== 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 g15si2191903edq.200.2020.03.02.01.01.59; Mon, 02 Mar 2020 01:01:59 -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 BEBD81C0B6; Mon, 2 Mar 2020 10:00:28 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 07B8C1C067 for ; Mon, 2 Mar 2020 10:00:22 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E07B21A0FDC; Mon, 2 Mar 2020 10:00:21 +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 206861A0FB1; Mon, 2 Mar 2020 10:00:19 +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 C2D96402FA; Mon, 2 Mar 2020 17:00:15 +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:08 +0530 Message-Id: <20200302143209.11854-10-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 09/10] net/enetc: improve prefetch in Rx ring 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 LS1028A does not have platform cache so any reads following a hardware write will go directly to DDR. Latency of such a read is in excess of 100 core cycles, so try to prefetch more in advance to mitigate this. How much is worth prefetching really depends on traffic conditions. With congested Rx this could go up to 4 cache lines or so. But if software keeps up with hardware and follows behind Rx PI by a cache line then it's harmful in terms of performance to cache more. We would only prefetch data that's yet to be written by ENETC, which will be evicted again anyway. Signed-off-by: Alex Marginean --- drivers/net/enetc/enetc_rxtx.c | 38 +++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c index 1acc43a08..e57ecf2d4 100644 --- a/drivers/net/enetc/enetc_rxtx.c +++ b/drivers/net/enetc/enetc_rxtx.c @@ -14,6 +14,8 @@ #include "enetc.h" #include "enetc_logs.h" +#define ENETC_CACHE_LINE_RXBDS (RTE_CACHE_LINE_SIZE / \ + sizeof(union enetc_rx_bd)) #define ENETC_RXBD_BUNDLE 16 /* Number of buffers to allocate at once */ static int @@ -321,18 +323,37 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring, int work_limit) { int rx_frm_cnt = 0; - int cleaned_cnt, i; + int cleaned_cnt, i, bd_count; struct enetc_swbd *rx_swbd; + union enetc_rx_bd *rxbd; - cleaned_cnt = enetc_bd_unused(rx_ring); /* next descriptor to process */ i = rx_ring->next_to_clean; + /* next descriptor to process */ + rxbd = ENETC_RXBD(*rx_ring, i); + rte_prefetch0(rxbd); + bd_count = rx_ring->bd_count; + /* LS1028A does not have platform cache so any software access following + * a hardware write will go directly to DDR. Latency of such a read is + * in excess of 100 core cycles, so try to prefetch more in advance to + * mitigate this. + * How much is worth prefetching really depends on traffic conditions. + * With congested Rx this could go up to 4 cache lines or so. But if + * software keeps up with hardware and follows behind Rx PI by a cache + * line or less then it's harmful in terms of performance to cache more. + * We would only prefetch BDs that have yet to be written by ENETC, + * which will have to be evicted again anyway. + */ + rte_prefetch0(ENETC_RXBD(*rx_ring, + (i + ENETC_CACHE_LINE_RXBDS) % bd_count)); + rte_prefetch0(ENETC_RXBD(*rx_ring, + (i + ENETC_CACHE_LINE_RXBDS * 2) % bd_count)); + + cleaned_cnt = enetc_bd_unused(rx_ring); rx_swbd = &rx_ring->q_swbd[i]; while (likely(rx_frm_cnt < work_limit)) { - union enetc_rx_bd *rxbd; uint32_t bd_status; - rxbd = ENETC_RXBD(*rx_ring, i); bd_status = rte_le_to_cpu_32(rxbd->r.lstatus); if (!bd_status) break; @@ -353,11 +374,18 @@ enetc_clean_rx_ring(struct enetc_bdr *rx_ring, i = 0; rx_swbd = &rx_ring->q_swbd[i]; } + rxbd = ENETC_RXBD(*rx_ring, i); + rte_prefetch0(ENETC_RXBD(*rx_ring, + (i + ENETC_CACHE_LINE_RXBDS) % + bd_count)); + rte_prefetch0(ENETC_RXBD(*rx_ring, + (i + ENETC_CACHE_LINE_RXBDS * 2) % + bd_count)); - rx_ring->next_to_clean = i; rx_frm_cnt++; } + rx_ring->next_to_clean = i; enetc_refill_rx_ring(rx_ring, cleaned_cnt); return rx_frm_cnt; From patchwork Mon Mar 2 14:32:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 184071 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp2171251ile; Mon, 2 Mar 2020 01:02:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzC/YLl5rdXEU8wBTil8zo4xwL9vJ+PzlBreqrvZlum/4hyl9sX866wW5i1fMTNFia0sL/e X-Received: by 2002:a17:906:c40d:: with SMTP id u13mr14640586ejz.178.1583139730270; Mon, 02 Mar 2020 01:02:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583139730; cv=none; d=google.com; s=arc-20160816; b=G3vWT06ns4KWhWfRjIfceyAZDWiZRk4STlgmIJZ44qyjf9AtcCcPqroTMdx/l9m+MK PSsytcMNkBlSG+1W2m4yf1OK0jnsoR86q7Y6jDHTw+R3ptjugCGI9/tWs04Z3j7lj6DM BuXwnVe2NZOngYAE4wr9ojlheseB+EW1Brr4+Ldy3+owuDteRkpwh8p+5TpwnpqCDTKi LBqUV9oMrZUiMbzZcScmSRLKqX9Af9x1YMKG+JDpoCK/fWEX4a7Q/d+l3tTDq3gNAAZK 3HOwdaX4Uh85x502aL4THOY6hen0WYA+tn2tCbDtdV/LfQOSB/kzRG9Y5LgIJEfu81sQ ynyQ== 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=YVekuCGm3LV+j94Xs3mql8i+JrwOEmav+uAnIlcf+TE=; b=dJv8IcuoWFaP3ZA3ccllbl5XDcAfnvjlpjvpmpYIShOfG3lI+OmB2X+zIbwsT1tCSp k1SmWQkmW4u0U3i2n9LV9o1XAtxO02w0f2sEVjb/CPMm6fnINC57HZH+vOruQEy0bV80 Js84zdKsumM0zSFjfdeq0N/bfzPXgXAgl6Qi0XTG19pPcjTBRy2mxUPbSgdrNI3rUp2V 9vI7td8Qjd7r1HzhCUvmqxS5cUnaj4G1Xfu85+NcVpFebNuTNieeR6MN9yg/yq92XEqn gh92qmvanS4MMfWzRdhS31Kyh+dtX4qhcX6nk1YtPt9SeFnUXmEVuShJfCbeKVByX7mn RHeA== 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 dd11si98588ejb.281.2020.03.02.01.02.10; Mon, 02 Mar 2020 01:02:10 -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 1CC692C38; Mon, 2 Mar 2020 10:00:30 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 8D83F1C06B for ; Mon, 2 Mar 2020 10:00:22 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 733701A1030; Mon, 2 Mar 2020 10:00:22 +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 E8C301A0FBD; Mon, 2 Mar 2020 10:00:19 +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 C202D4029E; Mon, 2 Mar 2020 17:00:16 +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:09 +0530 Message-Id: <20200302143209.11854-11-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 10/10] net/enetc: init SI transactions attribute reg 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 This was left to its default value. With the patch transactions are: - coherent, - do not allocate in downstream cache (there is none on LS1028a), - merge surrounding data for BD writes, - overwrite surrounding data for frame data writes. Signed-off-by: Alex Marginean --- drivers/net/enetc/base/enetc_hw.h | 2 ++ drivers/net/enetc/enetc_ethdev.c | 6 ++++++ 2 files changed, 8 insertions(+) -- 2.17.1 diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h index 00813284e..66fad58e5 100644 --- a/drivers/net/enetc/base/enetc_hw.h +++ b/drivers/net/enetc/base/enetc_hw.h @@ -22,6 +22,8 @@ #define ENETC_SIMR 0x0 #define ENETC_SIMR_EN BIT(31) +#define ENETC_SICAR0 0x40 +#define ENETC_SICAR0_COHERENT 0x2B2B6727 #define ENETC_SIPMAR0 0x80 #define ENETC_SIPMAR1 0x84 diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c index eb637d030..1716e11dd 100644 --- a/drivers/net/enetc/enetc_ethdev.c +++ b/drivers/net/enetc/enetc_ethdev.c @@ -150,6 +150,12 @@ enetc_hardware_init(struct enetc_eth_hw *hw) /* WA for Rx lock-up HW erratum */ enetc_port_wr(enetc_hw, ENETC_PM0_RX_FIFO, 1); + /* set ENETC transaction flags to coherent, don't allocate. + * BD writes merge with surrounding cache line data, frame data writes + * overwrite cache line. + */ + enetc_wr(enetc_hw, ENETC_SICAR0, ENETC_SICAR0_COHERENT); + /* Enabling Station Interface */ enetc_wr(enetc_hw, ENETC_SIMR, ENETC_SIMR_EN);