From patchwork Tue Aug 27 07:07:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172250 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5396291ily; Tue, 27 Aug 2019 00:09:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqwbh2yr8787sIQljP/k5ijXYGcHzYCPw6EVLo8zWDr/A2gIz5YUafneDlfQmnSyGfCwyhl6 X-Received: by 2002:a50:e611:: with SMTP id y17mr22315944edm.66.1566889773050; Tue, 27 Aug 2019 00:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889773; cv=none; d=google.com; s=arc-20160816; b=bYotvZbHv0cINDtmSSzAbHNku9LRXEP2r57v+p52CzWBgyrAUIfb4FVVBEtEXZumBQ fMgMG+U949H/Uc590b0AGLLsiWNv/TT5JkizERQg/KwugFW9j+MZE774FCIyEsOW3dl7 Hw9HpBw8c98idcl/OoJBoRHrt8Q0UwlGUqOEbyKd8RhhAyjazFqKUm0JgkHkGBY+Ft69 jATWR4E5xfnDfH5AMwX1VtQYAoNnfymvC4yWD/xIRUERBEPPM0tRe6OmxQul8XZel+Gx Se6kkLg5kFD9uGABsHIqH5QwCWweTQeqaDth1euRr8ZvJCWs76c9vt+jRA+t+pi9y6Uf wvTg== 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=i5N3T66YhwE++Olp3QJktTEwyhXAsX/WKplpbgCNjXs=; b=b5ve+Otsvn1oxWzyVdb87IgzWnrobewq28fqTguAsuGuJzUQ5nUta9Ph+69jUE0aT/ pTpiJCEjYAqWwBQABcTrzh33KDlvXWWKuk8bszo2Ge74GzSkA3kWjAc/R08vhTsOZ8SU LB7FVi2DIrf0FvnRvn3n/d4iovcVY30N/0GHGYH47iKh0ZSJEX2ptwQ20WyHofZ7/UDb AaMujwPZuoMt1xhrW+TS1fQGSOcxREHIdJEOsHKOGEhgRXNJDpx6jeLejp+FW9Jw3BJi PXEmuTsVghIv1o3NL+P5FVVV38fI6AJMUkmt0Kikv+3quIdjxLLKoByjit2rzAoq7BGA AHDg== 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 k40si8671225edb.14.2019.08.27.00.09.32; Tue, 27 Aug 2019 00:09:33 -0700 (PDT) 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 D311B1041; Tue, 27 Aug 2019 09:09:19 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 816EA1BF7C; Tue, 27 Aug 2019 09:09:15 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 0C9152005BF; Tue, 27 Aug 2019 09:09:15 +0200 (CEST) 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 91BAE2001BC; Tue, 27 Aug 2019 09:09:12 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 7C9F1402DE; Tue, 27 Aug 2019 15:09:08 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, stable@dpdk.org, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:01 +0530 Message-Id: <20190827070730.11206-2-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 01/30] bus/dpaa: fix DPAA SEC blacklist case 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: Hemant Agrawal The black list of dpaa_sec devices fails. EAL: failed to parse device "dpaa:dpaa_sec-1" This patch address following issues: - bus usages dpaa-sec while the driver usage dpaa_sec - bus usages numbers from 0 to MAX_SEC - while driver probe usages sec number form max-fman_device +1 Fixes: 6e0752205bb2 ("bus/dpaa: support device blacklisting") Cc: stable@dpdk.org Signed-off-by: Hemant Agrawal Reviewed-by: Sachin Saxena --- doc/guides/cryptodevs/dpaa_sec.rst | 6 +++--- drivers/bus/dpaa/dpaa_bus.c | 6 +++--- drivers/crypto/dpaa_sec/dpaa_sec.c | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/doc/guides/cryptodevs/dpaa_sec.rst b/doc/guides/cryptodevs/dpaa_sec.rst index 0a2600634..3a3e30aaf 100644 --- a/doc/guides/cryptodevs/dpaa_sec.rst +++ b/doc/guides/cryptodevs/dpaa_sec.rst @@ -85,11 +85,11 @@ For blacklisting a DPAA device, following commands can be used. .. code-block:: console - -b "dpaa_bus:dpaa-secX" -- ... - e.g. "dpaa_bus:dpaa-sec0" + -b "dpaa:dpaa_sec-X" -- ... + e.g. "dpaa:dpaa_sec-1" or to disable all 4 SEC devices - -b "dpaa_sec:dpaa-sec0" -b "dpaa_sec:dpaa-sec1" -b "dpaa_sec:dpaa-sec2" -b "dpaa_sec:dpaa-sec3" + -b "dpaa:dpaa_sec-1" -b "dpaa:dpaa_sec-2" -b "dpaa:dpaa_sec-3" -b "dpaa:dpaa_sec-4" Limitations ----------- diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 07cc5c667..f7d1a5b63 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -218,7 +218,7 @@ dpaa_create_device_list(void) * allocated for dev->name/ */ memset(dev->name, 0, RTE_ETH_NAME_MAX_LEN); - sprintf(dev->name, "dpaa-sec%d", i); + sprintf(dev->name, "dpaa_sec-%d", i+1); DPAA_BUS_LOG(INFO, "%s cryptodev added", dev->name); dev->device.name = dev->name; dev->device.devargs = dpaa_devargs_lookup(dev); @@ -397,7 +397,7 @@ rte_dpaa_bus_parse(const char *name, void *out_name) * without separator. Both need to be handled. * It is also possible that "name=fm1-mac3" is passed along. */ - DPAA_BUS_DEBUG("Parse device name (%s)\n", name); + DPAA_BUS_DEBUG("Parse device name (%s)", name); /* Check for dpaa_bus:fm1-mac3 style */ dup_name = strdup(name); @@ -428,7 +428,7 @@ rte_dpaa_bus_parse(const char *name, void *out_name) for (i = 0; i < RTE_LIBRTE_DPAA_MAX_CRYPTODEV; i++) { char sec_name[16]; - snprintf(sec_name, 16, "dpaa-sec%d", i); + snprintf(sec_name, 16, "dpaa_sec-%d", i+1); if (strcmp(sec_name, sep) == 0) { if (out_name) strcpy(out_name, sep); diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 122c80a07..1754862be 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -2678,8 +2678,7 @@ cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused, int retval; - snprintf(cryptodev_name, sizeof(cryptodev_name), "dpaa_sec-%d", - dpaa_dev->id.dev_id); + snprintf(cryptodev_name, sizeof(cryptodev_name), "%s", dpaa_dev->name); cryptodev = rte_cryptodev_pmd_allocate(cryptodev_name, rte_socket_id()); if (cryptodev == NULL) From patchwork Tue Aug 27 07:07:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172249 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5396156ily; Tue, 27 Aug 2019 00:09:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpF2uBFS+Aec62ri9Qgj9g00YE62GWR5/wZxGjDLTT9fWjT9ysizEiIF4UjJUFHS6hGnbM X-Received: by 2002:a05:6402:170f:: with SMTP id y15mr23382285edu.55.1566889764740; Tue, 27 Aug 2019 00:09:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889764; cv=none; d=google.com; s=arc-20160816; b=H2cA1Z2/CDnmN7bvD8W5CgId7VxKytljZ5silraQGFu0gL/23RUpfOo5ygJF1h1/VZ lPtN2YLMoF3AxYTiNrzmFInC6ntG/uWDklIkmgUC1URsd3rkmeba7kuQ6Q5R43/wuG2L MNF0NxwZaLlTynf1nUgScE3AkK5/AdUGb1wfNKniO4zvoFmTYKqHzVF1jmJRGJzj3tEE Ad0aqRe00+UXYjI5Bvqgj+Gl8sWdt+5Q67IBbuDY0Pao+jD0namVn+BgGhQnNeakbOsC iJoA8sD7dFv3G0qUrLfidngLpGElLieKBeYZvSGRJMKVHZjUryJzjWNioyHHvvLVbJr5 WoOA== 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=QHb3EC6meRr3vE1PotUlGzqxaBR93YfK8/9Etjh/Ir8=; b=dseFgZhv5KrgbAGKz/MmIR+EDthLOg4ngBv7tBbryK7yT+cR8jRXIDeR+NauMuGpp0 AC1jfzVO54miF1lAfCuJSUF82DzdBNJF6HrKWVSc1XngvYmBZZZAtpT0WOHlTPLcbfKk lFLFGN3YcFt0DpRJh0LwJzf8eX0cxyReq4hiHPhivP9xNVUTIjcK3+HKX1q4+DoF+1As tm4k2thu7u4NN61jyp/IM/z5idpF9zUAYIVBzfaMIXs7YpdSuzaMN54yT6jrBAPs2KsY GVHIrXhzyIWuklbn7YtuktTBK9XKgubbb3eCND1w+8Z6HITk1FscJ36lEHb0XebiDAIs Rn/Q== 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 o7si7110964ejr.13.2019.08.27.00.09.24; Tue, 27 Aug 2019 00:09:24 -0700 (PDT) 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 09ED31BF7E; Tue, 27 Aug 2019 09:09:17 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 74DC71BF7B for ; Tue, 27 Aug 2019 09:09:15 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id DA2131A05A1; Tue, 27 Aug 2019 09:09:14 +0200 (CEST) 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 D7B1B1A021C; Tue, 27 Aug 2019 09:09:12 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 5A6CB402E7; Tue, 27 Aug 2019 15:09:09 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:02 +0530 Message-Id: <20190827070730.11206-3-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 02/30] net/dpaa: improve the Rx offload debug message 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: Hemant Agrawal This patch also align few RX offload support to right category. Signed-off-by: Hemant Agrawal Reviewed-by: Sachin Saxena --- drivers/net/dpaa/dpaa_ethdev.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 7154fb9b4..7f5a8ac3b 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -59,7 +59,9 @@ static uint64_t dev_rx_offloads_nodis = DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM; /* Supported Tx offloads */ -static uint64_t dev_tx_offloads_sup; +static uint64_t dev_tx_offloads_sup = + DEV_TX_OFFLOAD_MT_LOCKFREE | + DEV_TX_OFFLOAD_MBUF_FAST_FREE; /* Tx offloads which cannot be disabled */ static uint64_t dev_tx_offloads_nodis = @@ -68,9 +70,7 @@ static uint64_t dev_tx_offloads_nodis = DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM | DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | - DEV_TX_OFFLOAD_MULTI_SEGS | - DEV_TX_OFFLOAD_MT_LOCKFREE | - DEV_TX_OFFLOAD_MBUF_FAST_FREE; + DEV_TX_OFFLOAD_MULTI_SEGS; /* Keep track of whether QMAN and BMAN have been globally initialized */ static int is_global_init; @@ -196,20 +196,20 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); - /* Rx offloads validation */ + /* Rx offloads which are enabled by default */ if (dev_rx_offloads_nodis & ~rx_offloads) { - DPAA_PMD_WARN( - "Rx offloads non configurable - requested 0x%" PRIx64 - " ignored 0x%" PRIx64, - rx_offloads, dev_rx_offloads_nodis); + DPAA_PMD_INFO( + "Some of rx offloads enabled by default - requested 0x%" PRIx64 + " fixed are 0x%" PRIx64, + rx_offloads, dev_rx_offloads_nodis); } - /* Tx offloads validation */ + /* Tx offloads which are enabled by default */ if (dev_tx_offloads_nodis & ~tx_offloads) { - DPAA_PMD_WARN( - "Tx offloads non configurable - requested 0x%" PRIx64 - " ignored 0x%" PRIx64, - tx_offloads, dev_tx_offloads_nodis); + DPAA_PMD_INFO( + "Some of tx offloads enabled by default - requested 0x%" PRIx64 + " fixed are 0x%" PRIx64, + tx_offloads, dev_tx_offloads_nodis); } if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { From patchwork Tue Aug 27 07:07:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172251 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5396462ily; Tue, 27 Aug 2019 00:09:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyySsMBwna6N1PZ4J+piOO68VupUHSGKjgLGH59xWmIYOjlUf2NFuuBDUhBxhnSEW3TMKb X-Received: by 2002:a17:906:e088:: with SMTP id gh8mr19999866ejb.117.1566889782478; Tue, 27 Aug 2019 00:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889782; cv=none; d=google.com; s=arc-20160816; b=w4eYr/qA2Op/nWX9/uNAKQjHWWST9kRGRkyuBYZzz/VSeiyQbq0zIY1hfpq978lwLt +/C6TD3qyUbHymJ7TLLioP+7vwOLnsiMtl6JtGFC+62fBDR5cQYY398dwBLR5z77BeqA o/nHBSzEPDhaLCo3Md4Q24KuPVwlrG44InD8AZBR3wk9cGfpc/i40EoR7jOxhsXeaBwb S1NSoWNccVLheePaEs8r8YQRcXX/0oEcB19vhR1LhOl4hnT37+b5av3VWudb9AMe/TLP 3Op65EKmjv7eju9nH3gzxsYBPgn6LtEnbxFF5vVw8hxCKzurNFsOLDkQ2MPNhwYlR3NY ORtw== 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=l0UKPCTMnGCbO+BhomoJqgqwQq4WXLWjd4U+1AElciI=; b=ccpeos/ffRG6e3Rv9vL7F/n4lSp8GWfzPKw3N9yK6asSp3uLDDYEKlw5wsClbNs4ME YljtR1eo5HkoK7NJj/msBLgbnTkraETs+3pj5BrZ6iuEi+B867xIk2f3xujpn7YCKRVn 9DU0MsFDU4KIosCRCO+uAsrYU6XjkBCYcWUMU5IuA7w7im+EIA0pypZLD/okvnfZ+LpD bW/7J+qKLW0CCfPs6rf++rxoKJfC10g278Zd89qrNLaBRAQa94N6ud4Bx0eBtkO3E/l8 ytjLSsHnjJ/ngxeRYid2Kgf5k7a7+qX84DpYxAREbM9MQ8uA75kJOiWYS/JnUtkUKh1H F3Rg== 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 f27si8335728edf.102.2019.08.27.00.09.42; Tue, 27 Aug 2019 00:09:42 -0700 (PDT) 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 52DD01BFC6; Tue, 27 Aug 2019 09:09:22 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 5383E1BF7D for ; Tue, 27 Aug 2019 09:09:16 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E1D08200131; Tue, 27 Aug 2019 09:09:15 +0200 (CEST) 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 9EFB92005C6; Tue, 27 Aug 2019 09:09:13 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 20F5A402EB; Tue, 27 Aug 2019 15:09:10 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Nipun Gupta Date: Tue, 27 Aug 2019 12:37:03 +0530 Message-Id: <20190827070730.11206-4-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 03/30] bus/dpaa: remove un-necessary thread affinity 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: Nipun Gupta Thread affinity is already taken care by DPDK. Remove them from bus. Signed-off-by: Nipun Gupta --- drivers/bus/dpaa/base/qbman/qman_driver.c | 56 ++--------------------- drivers/bus/dpaa/dpaa_bus.c | 13 ------ 2 files changed, 3 insertions(+), 66 deletions(-) -- 2.17.1 diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c index ba153396d..5c773669a 100644 --- a/drivers/bus/dpaa/base/qbman/qman_driver.c +++ b/drivers/bus/dpaa/base/qbman/qman_driver.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2008-2016 Freescale Semiconductor Inc. - * Copyright 2017 NXP + * Copyright 2017,2019 NXP * */ @@ -32,31 +32,9 @@ static __thread struct dpaa_ioctl_portal_map map = { static int fsl_qman_portal_init(uint32_t index, int is_shared) { - cpu_set_t cpuset; struct qman_portal *portal; - int loop, ret; struct dpaa_ioctl_irq_map irq_map; - - /* Verify the thread's cpu-affinity */ - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), - &cpuset); - if (ret) { - error(0, ret, "pthread_getaffinity_np()"); - return ret; - } - qpcfg.cpu = -1; - for (loop = 0; loop < CPU_SETSIZE; loop++) - if (CPU_ISSET(loop, &cpuset)) { - if (qpcfg.cpu != -1) { - pr_err("Thread is not affine to 1 cpu\n"); - return -EINVAL; - } - qpcfg.cpu = loop; - } - if (qpcfg.cpu == -1) { - pr_err("Bug in getaffinity handling!\n"); - return -EINVAL; - } + int ret; /* Allocate and map a qman portal */ map.index = index; @@ -145,14 +123,11 @@ void qman_thread_irq(void) struct qman_portal *fsl_qman_portal_create(void) { - cpu_set_t cpuset; struct qman_portal *res; - struct qm_portal_config *q_pcfg; - int loop, ret; struct dpaa_ioctl_irq_map irq_map; struct dpaa_ioctl_portal_map q_map = {0}; - int q_fd; + int q_fd, ret; q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0); if (!q_pcfg) { @@ -160,31 +135,6 @@ struct qman_portal *fsl_qman_portal_create(void) return NULL; } - /* Verify the thread's cpu-affinity */ - ret = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), - &cpuset); - if (ret) { - error(0, ret, "pthread_getaffinity_np()"); - kfree(q_pcfg); - return NULL; - } - - q_pcfg->cpu = -1; - for (loop = 0; loop < CPU_SETSIZE; loop++) - if (CPU_ISSET(loop, &cpuset)) { - if (q_pcfg->cpu != -1) { - pr_err("Thread is not affine to 1 cpu\n"); - kfree(q_pcfg); - return NULL; - } - q_pcfg->cpu = loop; - } - if (q_pcfg->cpu == -1) { - pr_err("Bug in getaffinity handling!\n"); - kfree(q_pcfg); - return NULL; - } - /* Allocate and map a qman portal */ q_map.type = dpaa_portal_qman; q_map.index = QBMAN_ANY_PORTAL_IDX; diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index f7d1a5b63..b0e68c4a4 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -250,11 +250,9 @@ dpaa_clean_device_list(void) int rte_dpaa_portal_init(void *arg) { - pthread_t id; unsigned int cpu, lcore = rte_lcore_id(); int ret; struct dpaa_portal *dpaa_io_portal; - rte_cpuset_t cpuset; BUS_INIT_FUNC_TRACE(); @@ -266,17 +264,6 @@ int rte_dpaa_portal_init(void *arg) cpu = rte_lcore_to_cpu_id(lcore); - /* Set CPU affinity for this thread.*/ - id = pthread_self(); - cpuset = rte_lcore_cpuset(lcore); - ret = pthread_setaffinity_np(id, sizeof(cpu_set_t), - &cpuset); - if (ret) { - DPAA_BUS_LOG(ERR, "pthread_setaffinity_np failed on core :%u" - " (lcore=%u) with ret: %d", cpu, lcore, ret); - return ret; - } - /* Initialise bman thread portals */ ret = bman_thread_init(); if (ret) { From patchwork Tue Aug 27 07:07:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172252 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5396567ily; Tue, 27 Aug 2019 00:09:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2p2/pe5oPjKCL3V0y20Vt6Cd2y9m2G5Z9qmbh0wUdKqdkTcqcdFw9fBoEf1ovr9SQLCVS X-Received: by 2002:a17:906:2310:: with SMTP id l16mr20319428eja.0.1566889789957; Tue, 27 Aug 2019 00:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889789; cv=none; d=google.com; s=arc-20160816; b=Ftz1WswAqv73iEWCG/PBoUzikrqI1/IeeaizQrO2/be8CBSaK+X81hAZqf8pK3QIB7 yj4TGPJ8OR/H5V20BjbE+QjxFWJCK1qjjOta2eM0QCseE5RHbQMuldTqrUHJXF7S0D3V YGTgGgHUIHN2mt8orYCWbGejpMMK0v36GeiiMcsajZLqRTuwzXeXyiDjNAC16FSETgbz /xnQ2HWqw9JCBWp9C1K6FqfpR4R7HNQQykPDeF43TkLg/QrCHqsX3iukKlW3O6iA++qf AC2jVoLB4nRfxOSyCChCLGWRVP4CmI57lRP2FZnHQg9DDxMah/UAjILu6cyQRcMU8Vtm +9Pg== 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=KjOiZO/lW5qWOFhfj4+hYL7TaIwlN/JajoEdobd+KEk=; b=0wVqFNEqKbkkM4bMVM3XsEDosPqw578k7rwEUahB9zktUtI8/3/V8DUQQZh4i0qPEj fKZK8gT5nI8n1977IypLzlXtL/TLzD440KRvMYl8E4/96bplk/VYkyqj2t0l7l73gwm+ US0AjIZiMLRZTiYG7X1rFV9IsKEUDzL4rCDhm3diO6OOTvga0ukClrNMNHBR/Jf3V7OU xiJBQ+SxADm6wC5cWexpgQeAvF8BsHLxzvnlLYY0N8S9giDnUHS0pNzMINAXAJE7TLFg snGZsciFYgpigYbsNFobeoa6gnxMMDN5TkPyfIy9k3DYoV7kLVUauws1YNCxNyhQp2Ij 44MA== 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 s47si8127239edm.38.2019.08.27.00.09.49; Tue, 27 Aug 2019 00:09:49 -0700 (PDT) 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 D8F261BFED; Tue, 27 Aug 2019 09:09:24 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 349B21BF91 for ; Tue, 27 Aug 2019 09:09:17 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0F35C1A020A; Tue, 27 Aug 2019 09:09:17 +0200 (CEST) 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 C76D81A059B; Tue, 27 Aug 2019 09:09:14 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id DA78E402F0; Tue, 27 Aug 2019 15:09:10 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Nipun Gupta Date: Tue, 27 Aug 2019 12:37:04 +0530 Message-Id: <20190827070730.11206-5-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 04/30] bus/dpaa: decouple fq portal alloc and init 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: Nipun Gupta The decoupling of FQ portal allocation is required as a pre-requisite to support Rx interrupts as we need to have event FD's at portal allocation i.e. before the initialization of the Frame Queues. This change will help us get the event fd once the portals have been allocated for static FQ's. Signed-off-by: Nipun Gupta --- drivers/bus/dpaa/base/qbman/qman.c | 35 ++++++++--------- drivers/bus/dpaa/base/qbman/qman_driver.c | 46 ++++++++++++++++------- drivers/bus/dpaa/base/qbman/qman_priv.h | 13 +++++-- drivers/bus/dpaa/dpaa_bus.c | 13 +++---- drivers/bus/dpaa/include/fsl_qman.h | 3 +- drivers/bus/dpaa/include/fsl_usd.h | 6 ++- drivers/bus/dpaa/rte_bus_dpaa_version.map | 7 ++++ drivers/net/dpaa/dpaa_ethdev.c | 10 +++++ drivers/net/dpaa/dpaa_rxtx.c | 3 +- 9 files changed, 90 insertions(+), 46 deletions(-) -- 2.17.1 diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c index c6f7d7bb3..79017f7f2 100644 --- a/drivers/bus/dpaa/base/qbman/qman.c +++ b/drivers/bus/dpaa/base/qbman/qman.c @@ -498,11 +498,10 @@ static inline void qm_mr_pvb_update(struct qm_portal *portal) dcbit_ro(res); } -static inline -struct qman_portal *qman_create_portal( - struct qman_portal *portal, - const struct qm_portal_config *c, - const struct qman_cgrs *cgrs) +struct qman_portal * +qman_init_portal(struct qman_portal *portal, + const struct qm_portal_config *c, + const struct qman_cgrs *cgrs) { struct qm_portal *p; char buf[16]; @@ -511,6 +510,9 @@ struct qman_portal *qman_create_portal( p = &portal->p; + if (!c) + c = portal->config; + if (dpaa_svr_family == SVR_LS1043A_FAMILY) portal->use_eqcr_ci_stashing = 3; else @@ -632,21 +634,23 @@ struct qman_portal *qman_create_portal( static struct qman_portal global_portals[MAX_GLOBAL_PORTALS]; static rte_atomic16_t global_portals_used[MAX_GLOBAL_PORTALS]; -static struct qman_portal * -qman_alloc_global_portal(void) +struct qman_portal * +qman_alloc_global_portal(struct qm_portal_config *q_pcfg) { unsigned int i; for (i = 0; i < MAX_GLOBAL_PORTALS; i++) { - if (rte_atomic16_test_and_set(&global_portals_used[i])) + if (rte_atomic16_test_and_set(&global_portals_used[i])) { + global_portals[i].config = q_pcfg; return &global_portals[i]; + } } pr_err("No portal available (%x)\n", MAX_GLOBAL_PORTALS); return NULL; } -static int +int qman_free_global_portal(struct qman_portal *portal) { unsigned int i; @@ -661,22 +665,15 @@ qman_free_global_portal(struct qman_portal *portal) } struct qman_portal *qman_create_affine_portal(const struct qm_portal_config *c, - const struct qman_cgrs *cgrs, - int alloc) + const struct qman_cgrs *cgrs) { struct qman_portal *res; - struct qman_portal *portal; - - if (alloc) - portal = qman_alloc_global_portal(); - else - portal = get_affine_portal(); + struct qman_portal *portal = get_affine_portal(); /* A criteria for calling this function (from qman_driver.c) is that * we're already affine to the cpu and won't schedule onto another cpu. */ - - res = qman_create_portal(portal, c, cgrs); + res = qman_init_portal(portal, c, cgrs); if (res) { spin_lock(&affine_mask_lock); CPU_SET(c->cpu, &affine_mask); diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c index 5c773669a..06ed814e1 100644 --- a/drivers/bus/dpaa/base/qbman/qman_driver.c +++ b/drivers/bus/dpaa/base/qbman/qman_driver.c @@ -62,7 +62,7 @@ static int fsl_qman_portal_init(uint32_t index, int is_shared) qpcfg.node = NULL; qpcfg.irq = qmfd; - portal = qman_create_affine_portal(&qpcfg, NULL, 0); + portal = qman_create_affine_portal(&qpcfg, NULL); if (!portal) { pr_err("Qman portal initialisation failed (%d)\n", qpcfg.cpu); @@ -121,13 +121,13 @@ void qman_thread_irq(void) out_be32(qpcfg.addr_virt[DPAA_PORTAL_CI] + 0x36C0, 0); } -struct qman_portal *fsl_qman_portal_create(void) +struct qman_portal *fsl_qman_fq_portal_create(void) { - struct qman_portal *res; + struct qman_portal *portal = NULL; struct qm_portal_config *q_pcfg; struct dpaa_ioctl_irq_map irq_map; struct dpaa_ioctl_portal_map q_map = {0}; - int q_fd, ret; + int q_fd = 0, ret; q_pcfg = kzalloc((sizeof(struct qm_portal_config)), 0); if (!q_pcfg) { @@ -155,38 +155,58 @@ struct qman_portal *fsl_qman_portal_create(void) q_fd = open(QMAN_PORTAL_IRQ_PATH, O_RDONLY); if (q_fd == -1) { pr_err("QMan irq init failed\n"); - goto err1; + goto err; } q_pcfg->irq = q_fd; - res = qman_create_affine_portal(q_pcfg, NULL, true); - if (!res) { + portal = qman_alloc_global_portal(q_pcfg); + if (!portal) { pr_err("Qman portal initialisation failed (%d)\n", q_pcfg->cpu); - goto err2; + goto err; } irq_map.type = dpaa_portal_qman; irq_map.portal_cinh = q_map.addr.cinh; process_portal_irq_map(q_fd, &irq_map); - return res; -err2: - close(q_fd); -err1: + return portal; +err: + if (portal) + qman_free_global_portal(portal); + if (q_fd) + close(q_fd); process_portal_unmap(&q_map.addr); kfree(q_pcfg); return NULL; } -int fsl_qman_portal_destroy(struct qman_portal *qp) +int fsl_qman_fq_portal_init(struct qman_portal *qp) +{ + struct qman_portal *res; + + res = qman_init_portal(qp, NULL, NULL); + if (!res) { + pr_err("Qman portal initialisation failed\n"); + return -1; + } + + return 0; +} + +int fsl_qman_fq_portal_destroy(struct qman_portal *qp) { const struct qm_portal_config *cfg; struct dpaa_portal_map addr; int ret; cfg = qman_destroy_affine_portal(qp); + + ret = qman_free_global_portal(qp); + if (ret) + pr_err("qman_free_global_portal() (%d)\n", ret); + kfree(qp); process_portal_irq_unmap(cfg->irq); diff --git a/drivers/bus/dpaa/base/qbman/qman_priv.h b/drivers/bus/dpaa/base/qbman/qman_priv.h index 02f6301f0..97d5521a8 100644 --- a/drivers/bus/dpaa/base/qbman/qman_priv.h +++ b/drivers/bus/dpaa/base/qbman/qman_priv.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) * * Copyright 2008-2016 Freescale Semiconductor Inc. - * Copyright 2017 NXP + * Copyright 2017,2019 NXP * */ @@ -145,11 +145,18 @@ int qm_get_wpm(int *wpm); struct qman_portal *qman_create_affine_portal( const struct qm_portal_config *config, - const struct qman_cgrs *cgrs, - int alloc); + const struct qman_cgrs *cgrs); const struct qm_portal_config * qman_destroy_affine_portal(struct qman_portal *q); +struct qman_portal * +qman_init_portal(struct qman_portal *portal, + const struct qm_portal_config *c, + const struct qman_cgrs *cgrs); + +struct qman_portal *qman_alloc_global_portal(struct qm_portal_config *q_pcfg); +int qman_free_global_portal(struct qman_portal *portal); + struct qm_portal_config *qm_get_unused_portal(void); struct qm_portal_config *qm_get_unused_portal_idx(uint32_t idx); diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index b0e68c4a4..1d8a294b1 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -321,7 +321,6 @@ rte_dpaa_portal_fq_init(void *arg, struct qman_fq *fq) { /* Affine above created portal with channel*/ u32 sdqcr; - struct qman_portal *qp; int ret; if (unlikely(!RTE_PER_LCORE(dpaa_io))) { @@ -333,21 +332,21 @@ rte_dpaa_portal_fq_init(void *arg, struct qman_fq *fq) } /* Initialise qman specific portals */ - qp = fsl_qman_portal_create(); - if (!qp) { - DPAA_BUS_LOG(ERR, "Unable to alloc fq portal"); + ret = fsl_qman_fq_portal_init(fq->qp); + if (ret) { + DPAA_BUS_LOG(ERR, "Unable to init fq portal"); return -1; } - fq->qp = qp; + sdqcr = QM_SDQCR_CHANNELS_POOL_CONV(fq->ch_id); - qman_static_dequeue_add(sdqcr, qp); + qman_static_dequeue_add(sdqcr, fq->qp); return 0; } int rte_dpaa_portal_fq_close(struct qman_fq *fq) { - return fsl_qman_portal_destroy(fq->qp); + return fsl_qman_fq_portal_destroy(fq->qp); } void diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h index e5cccbbea..5f13a5544 100644 --- a/drivers/bus/dpaa/include/fsl_qman.h +++ b/drivers/bus/dpaa/include/fsl_qman.h @@ -1217,7 +1217,8 @@ struct qman_fq { u32 fqid_le; u16 ch_id; u8 cgr_groupid; - u8 is_static; + u8 is_static:4; + u8 qp_initialized:4; /* DPDK Interface */ void *dpaa_intf; diff --git a/drivers/bus/dpaa/include/fsl_usd.h b/drivers/bus/dpaa/include/fsl_usd.h index ec1ab7cee..ea7be38af 100644 --- a/drivers/bus/dpaa/include/fsl_usd.h +++ b/drivers/bus/dpaa/include/fsl_usd.h @@ -2,6 +2,7 @@ * * Copyright 2010-2011 Freescale Semiconductor, Inc. * All rights reserved. + * Copyright 2019 NXP * */ @@ -74,8 +75,9 @@ int qman_global_init(void); int bman_global_init(void); /* Direct portal create and destroy */ -struct qman_portal *fsl_qman_portal_create(void); -int fsl_qman_portal_destroy(struct qman_portal *qp); +struct qman_portal *fsl_qman_fq_portal_create(void); +int fsl_qman_fq_portal_destroy(struct qman_portal *qp); +int fsl_qman_fq_portal_init(struct qman_portal *qp); #ifdef __cplusplus } diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map index c88deaf7f..f779469f9 100644 --- a/drivers/bus/dpaa/rte_bus_dpaa_version.map +++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map @@ -123,3 +123,10 @@ DPDK_19.05 { local: *; } DPDK_18.11; + +DPDK_19.11 { + global: + fsl_qman_fq_portal_create; + + local: *; +} DPDK_19.05; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 7f5a8ac3b..4e2c9471e 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -629,6 +629,8 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, dev->data->dev_conf.rxmode.max_rx_pkt_len); /* checking if push mode only, no error check for now */ if (dpaa_push_mode_max_queue > dpaa_push_queue_idx) { + struct qman_portal *qp; + dpaa_push_queue_idx++; opts.we_mask = QM_INITFQ_WE_FQCTRL | QM_INITFQ_WE_CONTEXTA; opts.fqd.fq_ctrl = QM_FQCTRL_AVOIDBLOCK | @@ -672,6 +674,14 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, } rxq->is_static = true; + + /* Allocate qman specific portals */ + qp = fsl_qman_fq_portal_create(); + if (!qp) { + DPAA_PMD_ERR("Unable to alloc fq portal"); + return -1; + } + rxq->qp = qp; } rxq->bp_array = rte_dpaa_bpid_info; dev->data->rx_queues[queue_idx] = rxq; diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 30b183607..220c3477d 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -517,12 +517,13 @@ dpaa_eth_queue_portal_rx(struct qman_fq *fq, { int ret; - if (unlikely(fq->qp == NULL)) { + if (unlikely(!fq->qp_initialized)) { ret = rte_dpaa_portal_fq_init((void *)0, fq); if (ret) { DPAA_PMD_ERR("Failure in affining portal %d", ret); return 0; } + fq->qp_initialized = 1; } return qman_portal_poll_rx(nb_bufs, (void **)bufs, fq->qp); From patchwork Tue Aug 27 07:07:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172253 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5396730ily; Tue, 27 Aug 2019 00:10:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwnGOff6MRWn2gKxNUBj6pqtcMDv1S49oj47BHPMMHfxi4Gi2cq5YaRhicsV53GGn4l+Nic X-Received: by 2002:aa7:d397:: with SMTP id x23mr22103088edq.11.1566889800509; Tue, 27 Aug 2019 00:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889800; cv=none; d=google.com; s=arc-20160816; b=j3JdKZNSNFAL0ADnN9a4H+oPcChc1y7kSKHyob5zzMSgZtwBNhcleuCVMJaNd373sm 7jARsaWbKL1Q4iiGM6+cKi6lVXxXB/Xl/YLzj5GA3RggzHh2PoN/yRg3y8PpIW+lJr7x S0NeXtwedadNBQb40c4Wq+Yq8wtUMJ34LE9ebjTla+jXSHpJNknwDFG4E2VJTEY149w2 x+Wo6FtRaIFHKHhOCTO4UpohvhHZDd/t3dk01qdTIfRlYx3AVrUlW+DHftT6Z39UCahb JyMC474E2qyEkejSu7rI3KFyH29xLad+wh0hj4X0K76NwtTbisD9U87ov2h1GhjsYPbV zRzQ== 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=YGOEtEg0vvPkN8F5KCCW9mzfFqF0wwZFF9JwSyaQK2A=; b=vJhBMR1MC0zhh41CJc/1e+rX0vNAnbGS24PK82V/yippXPaJRiR+RNVNL0x1mFZNer a5NG53gkKM6hE/AIw3g5AOLP+Onu7Tfxy+dZQTXrki18I1s/qRB6zopzCi9UbhYpMkD0 MHQf/xI13xLJDN5S+NYyCW3Sh93JGqcSouPuNsmVMsCUeTzaLBhOuqtf9BpfGcEHX7gB xS8ZkMmtre5MASzHdB/fMJvZAVeclTl0lYMey25ORrJLteI5FtTh8UGIL8K5Z37pDx53 CU+U14VPq5LoOXYHQCAeN/Sx5qugf10cjSSBwMyjA6pXqKwZCmueneYif1O7fkPQmXqY enPw== 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 t49si8364806edb.429.2019.08.27.00.10.00; Tue, 27 Aug 2019 00:10:00 -0700 (PDT) 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 DF3971BFFC; Tue, 27 Aug 2019 09:09:28 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 8906B1BF9A for ; Tue, 27 Aug 2019 09:09:17 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 63E522001BC; Tue, 27 Aug 2019 09:09:17 +0200 (CEST) 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 283122005C9; Tue, 27 Aug 2019 09:09:15 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 9EB3C4031D; Tue, 27 Aug 2019 15:09:11 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Nipun Gupta Date: Tue, 27 Aug 2019 12:37:05 +0530 Message-Id: <20190827070730.11206-6-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 05/30] net/dpaa: support Rx interrupt handler 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: Nipun Gupta This patch adds interrupt handler support for the ethernet devices which are configured with a dedicated portal for packet Rx (i.e. for FQ's in push mode). Signed-off-by: Nipun Gupta --- drivers/bus/dpaa/base/qbman/qman_driver.c | 3 ++- drivers/bus/dpaa/include/fsl_qman.h | 18 +++++++++++++- drivers/bus/dpaa/include/fsl_usd.h | 2 +- drivers/bus/dpaa/rte_dpaa_bus.h | 1 + drivers/net/dpaa/dpaa_ethdev.c | 29 +++++++++++++++++++++-- 5 files changed, 48 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c index 06ed814e1..acd003143 100644 --- a/drivers/bus/dpaa/base/qbman/qman_driver.c +++ b/drivers/bus/dpaa/base/qbman/qman_driver.c @@ -121,7 +121,7 @@ void qman_thread_irq(void) out_be32(qpcfg.addr_virt[DPAA_PORTAL_CI] + 0x36C0, 0); } -struct qman_portal *fsl_qman_fq_portal_create(void) +struct qman_portal *fsl_qman_fq_portal_create(int *fd) { struct qman_portal *portal = NULL; struct qm_portal_config *q_pcfg; @@ -171,6 +171,7 @@ struct qman_portal *fsl_qman_fq_portal_create(void) irq_map.portal_cinh = q_map.addr.cinh; process_portal_irq_map(q_fd, &irq_map); + *fd = q_fd; return portal; err: if (portal) diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h index 5f13a5544..064b65aed 100644 --- a/drivers/bus/dpaa/include/fsl_qman.h +++ b/drivers/bus/dpaa/include/fsl_qman.h @@ -1215,6 +1215,9 @@ struct qman_fq { struct qman_fq_cb cb; u32 fqid_le; + u32 fqid; + + int q_fd; u16 ch_id; u8 cgr_groupid; u8 is_static:4; @@ -1231,7 +1234,6 @@ struct qman_fq { volatile unsigned long flags; enum qman_fq_state state; - u32 fqid; spinlock_t fqlock; struct rb_node node; @@ -1333,6 +1335,13 @@ u32 qman_portal_dequeue(struct rte_event ev[], unsigned int poll_limit, */ int qman_irqsource_add(u32 bits); +/** + * qman_fq_portal_irqsource_add - samilar to qman_irqsource_add, but it + * takes portal (fq specific) as input rather than using the thread affined + * portal. + */ +int qman_fq_portal_irqsource_add(struct qman_portal *p, u32 bits); + /** * qman_irqsource_remove - remove processing sources from being interrupt-driven * @bits: bitmask of QM_PIRQ_**I processing sources @@ -1343,6 +1352,13 @@ int qman_irqsource_add(u32 bits); */ int qman_irqsource_remove(u32 bits); +/** + * qman_fq_portal_irqsource_remove - similar to qman_irqsource_remove, but it + * takes portal (fq specific) as input rather than using the thread affined + * portal. + */ +int qman_fq_portal_irqsource_remove(struct qman_portal *p, u32 bits); + /** * qman_affine_channel - return the channel ID of an portal * @cpu: the cpu whose affine portal is the subject of the query diff --git a/drivers/bus/dpaa/include/fsl_usd.h b/drivers/bus/dpaa/include/fsl_usd.h index ea7be38af..a407e2b22 100644 --- a/drivers/bus/dpaa/include/fsl_usd.h +++ b/drivers/bus/dpaa/include/fsl_usd.h @@ -75,7 +75,7 @@ int qman_global_init(void); int bman_global_init(void); /* Direct portal create and destroy */ -struct qman_portal *fsl_qman_fq_portal_create(void); +struct qman_portal *fsl_qman_fq_portal_create(int *fd); int fsl_qman_fq_portal_destroy(struct qman_portal *qp); int fsl_qman_fq_portal_init(struct qman_portal *qp); diff --git a/drivers/bus/dpaa/rte_dpaa_bus.h b/drivers/bus/dpaa/rte_dpaa_bus.h index 554a56f2e..9601aebdd 100644 --- a/drivers/bus/dpaa/rte_dpaa_bus.h +++ b/drivers/bus/dpaa/rte_dpaa_bus.h @@ -75,6 +75,7 @@ struct rte_dpaa_device { }; struct rte_dpaa_driver *driver; struct dpaa_device_id id; + struct rte_intr_handle intr_handle; enum rte_dpaa_type device_type; /**< Ethernet or crypto type device */ char name[RTE_ETH_NAME_MAX_LEN]; }; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 4e2c9471e..1934f85ae 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -628,8 +628,10 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, fman_if_get_sg_enable(dpaa_intf->fif), dev->data->dev_conf.rxmode.max_rx_pkt_len); /* checking if push mode only, no error check for now */ - if (dpaa_push_mode_max_queue > dpaa_push_queue_idx) { + if (!rxq->is_static && + dpaa_push_mode_max_queue > dpaa_push_queue_idx) { struct qman_portal *qp; + int q_fd; dpaa_push_queue_idx++; opts.we_mask = QM_INITFQ_WE_FQCTRL | QM_INITFQ_WE_CONTEXTA; @@ -676,12 +678,35 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, rxq->is_static = true; /* Allocate qman specific portals */ - qp = fsl_qman_fq_portal_create(); + qp = fsl_qman_fq_portal_create(&q_fd); if (!qp) { DPAA_PMD_ERR("Unable to alloc fq portal"); return -1; } rxq->qp = qp; + + /* Set up the device interrupt handler */ + if (!dev->intr_handle) { + struct rte_dpaa_device *dpaa_dev; + struct rte_device *rdev = dev->device; + + dpaa_dev = container_of(rdev, struct rte_dpaa_device, + device); + dev->intr_handle = &dpaa_dev->intr_handle; + dev->intr_handle->intr_vec = rte_zmalloc(NULL, + dpaa_push_mode_max_queue, 0); + if (!dev->intr_handle->intr_vec) { + DPAA_PMD_ERR("intr_vec alloc failed"); + return -ENOMEM; + } + dev->intr_handle->nb_efd = dpaa_push_mode_max_queue; + dev->intr_handle->max_intr = dpaa_push_mode_max_queue; + } + + dev->intr_handle->type = RTE_INTR_HANDLE_EXT; + dev->intr_handle->intr_vec[queue_idx] = queue_idx + 1; + dev->intr_handle->efds[queue_idx] = q_fd; + rxq->q_fd = q_fd; } rxq->bp_array = rte_dpaa_bpid_info; dev->data->rx_queues[queue_idx] = rxq; From patchwork Tue Aug 27 07:07:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172254 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5396955ily; Tue, 27 Aug 2019 00:10:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFqcBFHtowiliBCBJt3Cz4irvQ2zROEjU8ME9kvoZr+Wqn0ifLrF2ihQZ7gEIOGTb3M1pk X-Received: by 2002:a50:f419:: with SMTP id r25mr22619668edm.57.1566889813181; Tue, 27 Aug 2019 00:10:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889813; cv=none; d=google.com; s=arc-20160816; b=rACWCep2/pOldiXx/jR/cpmzAfcxBta2n0pQfz0HVQGU63yKBbwW3QzMpZTyET954h JsJul1wiQjV+/9Qh2jg6gbWxid21jq13BRrGbLRf4SNLu2TdsPKVy8erqrIEcMY8lqP4 vnQr1Gb60qjMnkiwbcI6X5OnvjywyvZAUj21q9rXWgVJ5gMYKYBSW2ItscWCaGVztboc Yr6Sy8t4806SYbnzFHpMoqbmhuSJN+eol7TD51CeBztmVMS9dG/73a2JsF3cgCVNKVL+ 6SK2K+kgVms9W2SpRZcHz7Z7fWbQIm/8YTZu3LNbeuIUSymijre5n3ZZ4oow6xYE82NQ t5pA== 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=Z+nZGZiQGKDaKOoHsSmuMGcsmH7xRqqMclJffc7Ng1M=; b=NT2EQCM5yMCemS/3e8JKQaSysMnOh6SR9jcXhVQ9zZSlBPQ5UKbL54Q4d0mDdctnzB K4r+4gzJfhoBupcxImamHPWYFAKb/goLMiyCEquScTFXhK+uqWRPGGnLHcWlZo7qaMci Rbb0gJFswnyO2xLnvbahZ/3zaT92AsZoZ32kl22a/WqcIsmGKAAMoj1+vBJO1VxMtPYc H/5maguI9SVxoXB7gL74GdRyzNg9K6VXTNTT/DpOne9/01qvjA1VtssN2geyOriYOwyX 7g8ryJmBtJnau/yTC+3eT9s+arGRG/+E/uAQAV+b4FI+YdO6bInKa/miM29BH3m17VmF ORGg== 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 m57si8186108edc.376.2019.08.27.00.10.13; Tue, 27 Aug 2019 00:10:13 -0700 (PDT) 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 BB5A71C025; Tue, 27 Aug 2019 09:09:31 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 47D131BEDE for ; Tue, 27 Aug 2019 09:09:18 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 257851A021C; Tue, 27 Aug 2019 09:09:18 +0200 (CEST) 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 E13771A0049; Tue, 27 Aug 2019 09:09:15 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 63DDA402A5; Tue, 27 Aug 2019 15:09:12 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Nipun Gupta Date: Tue, 27 Aug 2019 12:37:06 +0530 Message-Id: <20190827070730.11206-7-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 06/30] net/dpaa: support for Rx interrupt enable and disable 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: Nipun Gupta This patch adds support for dpaa eth driver interrupt enable and disable callback functions. Signed-off-by: Nipun Gupta --- drivers/bus/dpaa/base/qbman/qman.c | 45 +++++++++++++++++++++++ drivers/bus/dpaa/base/qbman/qman_driver.c | 5 +++ drivers/bus/dpaa/base/qbman/qman_priv.h | 2 + drivers/bus/dpaa/include/fsl_usd.h | 1 + drivers/bus/dpaa/rte_bus_dpaa_version.map | 3 ++ drivers/net/dpaa/dpaa_ethdev.c | 39 +++++++++++++++++++- 6 files changed, 94 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c index 79017f7f2..96208bc40 100644 --- a/drivers/bus/dpaa/base/qbman/qman.c +++ b/drivers/bus/dpaa/base/qbman/qman.c @@ -664,6 +664,12 @@ qman_free_global_portal(struct qman_portal *portal) return -1; } +void +qman_portal_uninhibit_isr(struct qman_portal *portal) +{ + qm_isr_uninhibit(&portal->p); +} + struct qman_portal *qman_create_affine_portal(const struct qm_portal_config *c, const struct qman_cgrs *cgrs) { @@ -1053,6 +1059,20 @@ int qman_irqsource_add(u32 bits) dpaa_set_bits(bits, &p->irq_sources); qm_isr_enable_write(&p->p, p->irq_sources); + return 0; +} + +int qman_fq_portal_irqsource_add(struct qman_portal *p, u32 bits) +{ + bits = bits & QM_PIRQ_VISIBLE; + + /* Clear any previously remaining interrupt conditions in + * QCSP_ISR. This prevents raising a false interrupt when + * interrupt conditions are enabled in QCSP_IER. + */ + qm_isr_status_clear(&p->p, bits); + dpaa_set_bits(bits, &p->irq_sources); + qm_isr_enable_write(&p->p, p->irq_sources); return 0; } @@ -1083,6 +1103,31 @@ int qman_irqsource_remove(u32 bits) return 0; } +int qman_fq_portal_irqsource_remove(struct qman_portal *p, u32 bits) +{ + u32 ier; + + /* Our interrupt handler only processes+clears status register bits that + * are in p->irq_sources. As we're trimming that mask, if one of them + * were to assert in the status register just before we remove it from + * the enable register, there would be an interrupt-storm when we + * release the IRQ lock. So we wait for the enable register update to + * take effect in h/w (by reading it back) and then clear all other bits + * in the status register. Ie. we clear them from ISR once it's certain + * IER won't allow them to reassert. + */ + + bits &= QM_PIRQ_VISIBLE; + dpaa_clear_bits(bits, &p->irq_sources); + qm_isr_enable_write(&p->p, p->irq_sources); + ier = qm_isr_enable_read(&p->p); + /* Using "~ier" (rather than "bits" or "~p->irq_sources") creates a + * data-dependency, ie. to protect against re-ordering. + */ + qm_isr_status_clear(&p->p, ~ier); + return 0; +} + u16 qman_affine_channel(int cpu) { if (cpu < 0) { diff --git a/drivers/bus/dpaa/base/qbman/qman_driver.c b/drivers/bus/dpaa/base/qbman/qman_driver.c index acd003143..69244ef70 100644 --- a/drivers/bus/dpaa/base/qbman/qman_driver.c +++ b/drivers/bus/dpaa/base/qbman/qman_driver.c @@ -121,6 +121,11 @@ void qman_thread_irq(void) out_be32(qpcfg.addr_virt[DPAA_PORTAL_CI] + 0x36C0, 0); } +void qman_fq_portal_thread_irq(struct qman_portal *qp) +{ + qman_portal_uninhibit_isr(qp); +} + struct qman_portal *fsl_qman_fq_portal_create(int *fd) { struct qman_portal *portal = NULL; diff --git a/drivers/bus/dpaa/base/qbman/qman_priv.h b/drivers/bus/dpaa/base/qbman/qman_priv.h index 97d5521a8..8254729e6 100644 --- a/drivers/bus/dpaa/base/qbman/qman_priv.h +++ b/drivers/bus/dpaa/base/qbman/qman_priv.h @@ -157,6 +157,8 @@ qman_init_portal(struct qman_portal *portal, struct qman_portal *qman_alloc_global_portal(struct qm_portal_config *q_pcfg); int qman_free_global_portal(struct qman_portal *portal); +void qman_portal_uninhibit_isr(struct qman_portal *portal); + struct qm_portal_config *qm_get_unused_portal(void); struct qm_portal_config *qm_get_unused_portal_idx(uint32_t idx); diff --git a/drivers/bus/dpaa/include/fsl_usd.h b/drivers/bus/dpaa/include/fsl_usd.h index a407e2b22..3c26d6ccb 100644 --- a/drivers/bus/dpaa/include/fsl_usd.h +++ b/drivers/bus/dpaa/include/fsl_usd.h @@ -67,6 +67,7 @@ int bman_thread_fd(void); */ void qman_thread_irq(void); void bman_thread_irq(void); +void qman_fq_portal_thread_irq(struct qman_portal *qp); void qman_clear_irq(void); diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map index f779469f9..962b952d3 100644 --- a/drivers/bus/dpaa/rte_bus_dpaa_version.map +++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map @@ -127,6 +127,9 @@ DPDK_19.05 { DPDK_19.11 { global: fsl_qman_fq_portal_create; + qman_fq_portal_irqsource_add; + qman_fq_portal_irqsource_remove; + qman_fq_portal_thread_irq; local: *; } DPDK_19.05; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 1934f85ae..42ab3d05f 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: BSD-3-Clause * * Copyright 2016 Freescale Semiconductor, Inc. All rights reserved. - * Copyright 2017 NXP + * Copyright 2017-2019 NXP * */ /* System headers */ @@ -1013,6 +1013,40 @@ dpaa_dev_set_mac_addr(struct rte_eth_dev *dev, return ret; } +static int dpaa_dev_queue_intr_enable(struct rte_eth_dev *dev, + uint16_t queue_id) +{ + struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_id]; + + if (!rxq->is_static) + return -EINVAL; + + return qman_fq_portal_irqsource_add(rxq->qp, QM_PIRQ_DQRI); +} + +static int dpaa_dev_queue_intr_disable(struct rte_eth_dev *dev, + uint16_t queue_id) +{ + struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_id]; + uint32_t temp; + ssize_t temp1; + + if (!rxq->is_static) + return -EINVAL; + + qman_fq_portal_irqsource_remove(rxq->qp, ~0); + + temp1 = read(rxq->q_fd, &temp, sizeof(temp)); + if (temp1 != sizeof(temp)) + DPAA_EVENTDEV_ERR("irq read error"); + + qman_fq_portal_thread_irq(rxq->qp); + + return 0; +} + static struct eth_dev_ops dpaa_devops = { .dev_configure = dpaa_eth_dev_configure, .dev_start = dpaa_eth_dev_start, @@ -1050,6 +1084,9 @@ static struct eth_dev_ops dpaa_devops = { .mac_addr_set = dpaa_dev_set_mac_addr, .fw_version_get = dpaa_fw_version_get, + + .rx_queue_intr_enable = dpaa_dev_queue_intr_enable, + .rx_queue_intr_disable = dpaa_dev_queue_intr_disable, }; static bool From patchwork Tue Aug 27 07:07:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172255 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5397122ily; Tue, 27 Aug 2019 00:10:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWdUnEosPEYYVJUta5rxhzJa5tLL5U1DfAbJIackAZbn/BEupxhV0tU+3a3ERCjdWcFpux X-Received: by 2002:a17:907:447f:: with SMTP id oo23mr19807965ejb.193.1566889821720; Tue, 27 Aug 2019 00:10:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889821; cv=none; d=google.com; s=arc-20160816; b=vXCSSO0Aa79bEEjEidWAjaLwXk9B4nWL/faXTwIndrf3Y3wf+UZvVcZjGpJUPyW2vi BDDqOOU5eMyu7fBZUmYC+OqWJV0K/W/xz4HFDlWH7aXrAw5N3WS7q8ZYG8bYcwEEx5Sw yurS9Rrl/zplPL3jGJrZsUu/vGLCGIzZfT0L3IyhmzEDz5S920p3vS7m0zWIbHMMXflN mdyP7346E7lSMa+VyfAUegBPhfBDRxPYt/sRmMQd2MbPiSJlWpEShGl+BJtvVdUtUzfy B++HIu+rkbJ+2r89bFgrFqX/ql8+VxsqZYpk7GHeYBEjZU1kjP4c97K6trNU2g1OtCGe zbgw== 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=smYfWK6Why1FUt6Xx/c+6KOBsTUKi7w7ZSw3AFPfCZM=; b=gyXyMOYXRqRD7vQin14UxZ6CTVj5t5Ipk+hnxrhdOjjGREK/Xho0eakAr/1Kok8Net oICJgLN1usELL1Tq1FaD0bpqUhyIDhCbIOuu9NgAG5b/dqCMsxRIod5uUSTnYqs7v1AL FcXIZDLiYz8mzHEP8uVo/vL8XP0zL070llDxwE8NGXA3GCx2v8oHe1J+XeBz0cfrrItk bgRcwVzja0z4v/1ZyaxlH3Yny5k47cIJhQ8HeDwzSv5dMgo1uAgb90pJUMstCr8hK7eO wuJyc91KFAEeG3PT+hPI049DtgcgV1xw2yRu0HVasjYbWonhoBiUikZqq7WIjsSPNPwj /j2w== 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 b6si7537820edd.72.2019.08.27.00.10.20; Tue, 27 Aug 2019 00:10:21 -0700 (PDT) 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 493171C036; Tue, 27 Aug 2019 09:09:34 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 0BF9A1BF91 for ; Tue, 27 Aug 2019 09:09:19 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E0C601A0049; Tue, 27 Aug 2019 09:09:18 +0200 (CEST) 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 A70D41A01F4; Tue, 27 Aug 2019 09:09:16 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 28F6C402BF; Tue, 27 Aug 2019 15:09:13 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Nipun Gupta Date: Tue, 27 Aug 2019 12:37:07 +0530 Message-Id: <20190827070730.11206-8-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 07/30] net/dpaa: add SG support in Tx for non DPAA buffer 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: Nipun Gupta This patch adds support for Scatter Gather in the transmit side, for the cases where the buffer are received which are not from DPAA buffer pool. Signed-off-by: Nipun Gupta --- drivers/net/dpaa/dpaa_rxtx.c | 189 +++++++++++++++++++---------------- 1 file changed, 101 insertions(+), 88 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c index 220c3477d..2de1a1a7e 100644 --- a/drivers/net/dpaa/dpaa_rxtx.c +++ b/drivers/net/dpaa/dpaa_rxtx.c @@ -642,53 +642,6 @@ uint16_t dpaa_eth_queue_rx(void *q, return num_rx; } -static void *dpaa_get_pktbuf(struct dpaa_bp_info *bp_info) -{ - int ret; - size_t buf = 0; - struct bm_buffer bufs; - - ret = bman_acquire(bp_info->bp, &bufs, 1, 0); - if (ret <= 0) { - DPAA_PMD_WARN("Failed to allocate buffers %d", ret); - return (void *)buf; - } - - DPAA_DP_LOG(DEBUG, "got buffer 0x%" PRIx64 " from pool %d", - (uint64_t)bufs.addr, bufs.bpid); - - buf = (size_t)DPAA_MEMPOOL_PTOV(bp_info, bufs.addr) - - bp_info->meta_data_size; - if (!buf) - goto out; - -out: - return (void *)buf; -} - -static struct rte_mbuf *dpaa_get_dmable_mbuf(struct rte_mbuf *mbuf, - struct dpaa_if *dpaa_intf) -{ - struct rte_mbuf *dpaa_mbuf; - - /* allocate pktbuffer on bpid for dpaa port */ - dpaa_mbuf = dpaa_get_pktbuf(dpaa_intf->bp_info); - if (!dpaa_mbuf) - return NULL; - - memcpy((uint8_t *)(dpaa_mbuf->buf_addr) + RTE_PKTMBUF_HEADROOM, (void *) - ((uint8_t *)(mbuf->buf_addr) + mbuf->data_off), mbuf->pkt_len); - - /* Copy only the required fields */ - dpaa_mbuf->data_off = RTE_PKTMBUF_HEADROOM; - dpaa_mbuf->pkt_len = mbuf->pkt_len; - dpaa_mbuf->ol_flags = mbuf->ol_flags; - dpaa_mbuf->packet_type = mbuf->packet_type; - dpaa_mbuf->tx_offload = mbuf->tx_offload; - rte_pktmbuf_free(mbuf); - return dpaa_mbuf; -} - int dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, struct qm_fd *fd, @@ -862,26 +815,84 @@ tx_on_dpaa_pool(struct rte_mbuf *mbuf, } /* Handle all mbufs on an external pool (non-dpaa) */ -static inline uint16_t -tx_on_external_pool(struct qman_fq *txq, struct rte_mbuf *mbuf, - struct qm_fd *fd_arr) +static inline struct rte_mbuf * +reallocate_mbuf(struct qman_fq *txq, struct rte_mbuf *mbuf) { struct dpaa_if *dpaa_intf = txq->dpaa_intf; - struct rte_mbuf *dmable_mbuf; + struct dpaa_bp_info *bp_info = dpaa_intf->bp_info; + struct rte_mbuf *new_mbufs[DPAA_SGT_MAX_ENTRIES + 1] = {0}; + struct rte_mbuf *temp_mbuf; + int num_new_segs, mbuf_greater, ret, extra_seg = 0, i = 0; + uint64_t mbufs_size, bytes_to_copy, offset1 = 0, offset2 = 0; + char *data; + + DPAA_DP_LOG(DEBUG, "Reallocating transmit buffer"); + + mbufs_size = bp_info->size - + bp_info->meta_data_size - RTE_PKTMBUF_HEADROOM; + extra_seg = !!(mbuf->pkt_len % mbufs_size); + num_new_segs = (mbuf->pkt_len / mbufs_size) + extra_seg; + + ret = rte_pktmbuf_alloc_bulk(bp_info->mp, new_mbufs, num_new_segs); + if (ret != 0) { + DPAA_DP_LOG(DEBUG, "Allocation for new buffers failed"); + return NULL; + } - DPAA_DP_LOG(DEBUG, "Non-BMAN offloaded buffer." - "Allocating an offloaded buffer"); - dmable_mbuf = dpaa_get_dmable_mbuf(mbuf, dpaa_intf); - if (!dmable_mbuf) { - DPAA_DP_LOG(DEBUG, "no dpaa buffers."); - return 1; + temp_mbuf = mbuf; + + while (temp_mbuf) { + /* If mbuf data is less than new mbuf remaining memory */ + if ((temp_mbuf->data_len - offset1) < (mbufs_size - offset2)) { + bytes_to_copy = temp_mbuf->data_len - offset1; + mbuf_greater = -1; + /* If mbuf data is greater than new mbuf remaining memory */ + } else if ((temp_mbuf->data_len - offset1) > + (mbufs_size - offset2)) { + bytes_to_copy = mbufs_size - offset2; + mbuf_greater = 1; + /* if mbuf data is equal to new mbuf remaining memory */ + } else { + bytes_to_copy = temp_mbuf->data_len - offset1; + mbuf_greater = 0; + } + + /* Copy the data */ + data = rte_pktmbuf_append(new_mbufs[0], bytes_to_copy); + + rte_memcpy((uint8_t *)data, rte_pktmbuf_mtod_offset(mbuf, + void *, offset1), bytes_to_copy); + + /* Set new offsets and the temp buffers */ + if (mbuf_greater == -1) { + offset1 = 0; + offset2 += bytes_to_copy; + temp_mbuf = temp_mbuf->next; + } else if (mbuf_greater == 1) { + offset2 = 0; + offset1 += bytes_to_copy; + new_mbufs[i]->next = new_mbufs[i + 1]; + new_mbufs[0]->nb_segs++; + i++; + } else { + offset1 = 0; + offset2 = 0; + temp_mbuf = temp_mbuf->next; + new_mbufs[i]->next = new_mbufs[i + 1]; + if (new_mbufs[i + 1]) + new_mbufs[0]->nb_segs++; + i++; + } } - DPAA_MBUF_TO_CONTIG_FD(dmable_mbuf, fd_arr, dpaa_intf->bp_info->bpid); - if (mbuf->ol_flags & DPAA_TX_CKSUM_OFFLOAD_MASK) - dpaa_unsegmented_checksum(mbuf, fd_arr); + /* Copy other required fields */ + new_mbufs[0]->ol_flags = mbuf->ol_flags; + new_mbufs[0]->packet_type = mbuf->packet_type; + new_mbufs[0]->tx_offload = mbuf->tx_offload; - return 0; + rte_pktmbuf_free(mbuf); + + return new_mbufs[0]; } uint16_t @@ -893,7 +904,7 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) struct qm_fd fd_arr[DPAA_TX_BURST_SIZE]; uint32_t frames_to_send, loop, sent = 0; uint16_t state; - int ret; + int ret, realloc_mbuf = 0; uint32_t seqn, index, flags[DPAA_TX_BURST_SIZE] = {0}; if (unlikely(!RTE_PER_LCORE(dpaa_io))) { @@ -911,6 +922,13 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) DPAA_TX_BURST_SIZE : nb_bufs; for (loop = 0; loop < frames_to_send; loop++) { mbuf = *(bufs++); + /* In case the data offset is not multiple of 16, + * FMAN can stall because of an errata. So reallocate + * the buffer in such case. + */ + if (dpaa_svr_family == SVR_LS1043A_FAMILY && + (mbuf->data_off & 0xFF) != 0x0) + realloc_mbuf = 1; seqn = mbuf->seqn; if (seqn != DPAA_INVALID_MBUF_SEQN) { index = seqn - 1; @@ -930,6 +948,7 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) if (likely(mp->ops_index == bp_info->dpaa_ops_index && mbuf->nb_segs == 1 && + realloc_mbuf == 0 && rte_mbuf_refcnt_read(mbuf) == 1)) { DPAA_MBUF_TO_CONTIG_FD(mbuf, &fd_arr[loop], bp_info->bpid); @@ -945,32 +964,12 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) } bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp); - if (likely(mp->ops_index == bp_info->dpaa_ops_index)) { - state = tx_on_dpaa_pool(mbuf, bp_info, - &fd_arr[loop]); - if (unlikely(state)) { - /* Set frames_to_send & nb_bufs so - * that packets are transmitted till - * previous frame. - */ - frames_to_send = loop; - nb_bufs = loop; - goto send_pkts; - } - } else { - /* TODO not supporting sg for external bufs*/ - if (unlikely(mbuf->nb_segs > 1)) { - /* Set frames_to_send & nb_bufs so - * that packets are transmitted till - * previous frame. - */ - frames_to_send = loop; - nb_bufs = loop; - goto send_pkts; - } - state = tx_on_external_pool(q, mbuf, - &fd_arr[loop]); - if (unlikely(state)) { + if (unlikely(mp->ops_index != bp_info->dpaa_ops_index || + realloc_mbuf == 1)) { + struct rte_mbuf *temp_mbuf; + + temp_mbuf = reallocate_mbuf(q, mbuf); + if (!temp_mbuf) { /* Set frames_to_send & nb_bufs so * that packets are transmitted till * previous frame. @@ -979,6 +978,20 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) nb_bufs = loop; goto send_pkts; } + mbuf = temp_mbuf; + realloc_mbuf = 0; + } + + state = tx_on_dpaa_pool(mbuf, bp_info, + &fd_arr[loop]); + if (unlikely(state)) { + /* Set frames_to_send & nb_bufs so + * that packets are transmitted till + * previous frame. + */ + frames_to_send = loop; + nb_bufs = loop; + goto send_pkts; } } From patchwork Tue Aug 27 07:07:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172256 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5397298ily; Tue, 27 Aug 2019 00:10:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqypD3UYU9O7SNKJCXHB9fe0dYiHiK3PoK9KOMfQDm7q5WuegkWm3zs1DkmfMKQ5EhV4BIdR X-Received: by 2002:a50:d79b:: with SMTP id w27mr22075710edi.126.1566889832307; Tue, 27 Aug 2019 00:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889832; cv=none; d=google.com; s=arc-20160816; b=jV0PeLEFFJU0tXphu1jOCQZ58vkgyGKO6Y/j1gET0CE74SezvXkh9vCUdpTkdURv82 99QQhCQ2MazkAeZrtdl4clI3XYicVSxkunvjMT3Bb/ep6R275own7dDnhVIJAnJoGZBo 7p5f2WOvwjnv1CIBeJXVYx9U2MHK6kz7orpXNkainVz8Mf8NovMsvs+am4NFiHSoPNPW EyM2Vk2+Q3yTbDHPG09LqayNK+j+I6yuhnfwyHpRGgs9Otv7lBjbsz/IRdAWrvbRFSNl TrkigX05V7mlgz+crQHb6/UdG1rsG3cC+fW2uOQlO5xkuUIAWYoeRHNwCWTxj/BYYxo5 bL3A== 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=IiU8lk+L/ZWSNAWWNky00BH3PX5aYDAXeFUgpjJ2+kM=; b=bXn57y8eFDSMcagSN1Ivr7FnxCB8jEtbKF2yH5tNh3AbMtueXsjJEDtiwPi8I3vj4V jWHO8L31Cz5vDdXuBzmcPXq5px6VlcsPi+j5FsBCAfctDB02Ksh4ASnD3iS4Y6JJQ7CD iaNzYrxJ8ME2VmGcX0JqXNUIqEuRqk+LWQoIkU+SFrVTd5RGtjKNbhsw15EDC9V+I37X MJh1Bj6ZGCaKITIZLEeUv6K6zERIJODsXL5fhEpl2Do6gkMF0DEbQIAWAHyL9YIhxGKm b/T7zPWktWHdSO9ZBuZU3HVkRu5847VKzHRvQxsoVzL8whfqTaDw+9sD++hEj/1GSg5c eanw== 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 gu19si6671826ejb.219.2019.08.27.00.10.31; Tue, 27 Aug 2019 00:10:32 -0700 (PDT) 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 6EB2E1C07C; Tue, 27 Aug 2019 09:09:37 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 066381BFA8 for ; Tue, 27 Aug 2019 09:09:20 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id DDA371A020A; Tue, 27 Aug 2019 09:09:19 +0200 (CEST) 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 DBDA11A0211; Tue, 27 Aug 2019 09:09:17 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id E3BB94031E; Tue, 27 Aug 2019 15:09:13 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:08 +0530 Message-Id: <20190827070730.11206-9-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 08/30] net/dpaa: reduce debug messages 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: Hemant Agrawal Signed-off-by: Hemant Agrawal Reviewed-by: Sachin Saxena --- drivers/net/dpaa/dpaa_ethdev.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index 42ab3d05f..dc2e584b1 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -335,7 +335,7 @@ static void dpaa_eth_dev_info(struct rte_eth_dev *dev, { struct dpaa_if *dpaa_intf = dev->data->dev_private; - PMD_INIT_FUNC_TRACE(); + DPAA_PMD_DEBUG(": %s", dpaa_intf->name); dev_info->max_rx_queues = dpaa_intf->nb_rx_queues; dev_info->max_tx_queues = dpaa_intf->nb_tx_queues; @@ -1172,8 +1172,6 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx, } }; - PMD_INIT_FUNC_TRACE(); - if (fqid) { ret = qman_reserve_fqid(fqid); if (ret) { @@ -1225,8 +1223,6 @@ static int dpaa_tx_queue_init(struct qman_fq *fq, struct qm_mcc_initfq opts = {0}; int ret; - PMD_INIT_FUNC_TRACE(); - ret = qman_create_fq(0, QMAN_FQ_FLAG_DYNAMIC_FQID | QMAN_FQ_FLAG_TO_DCPORTAL, fq); if (ret) { From patchwork Tue Aug 27 07:07:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172257 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5397433ily; Tue, 27 Aug 2019 00:10:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhzIjj13CD19rKQtQL5BV5PI7vfpe4Q/LFfnbi3ICfNuI92Uf+pDd427jONzXGccinsdEq X-Received: by 2002:aa7:c81a:: with SMTP id a26mr22620654edt.26.1566889841262; Tue, 27 Aug 2019 00:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889841; cv=none; d=google.com; s=arc-20160816; b=QfAtGUtU2+93ey77jbcy2OdJ7GPhMtDnsvzC56ny3GcD7BrWqiGOA7d3o7FaVMNDKf u4bKufcrQuOSsh7d1fvEQ0z8r+vYdr8kIxXm9tNx1KOh29JacgzgslCrlx0LvXWrK/I4 15ij5YAY6AtPryJy6qDcx8Zfwe+CkC0ii84GU1AcG5EV4D6qhC6qMTNwBeeFBtw9yfQu P7g7WNgpBMJq2pK5Vbugd+CE3k7cOlIzqlKtpbHvRFgTKnnWWcDwUXblfRMBCwyBlHwe t/LqqocOlt7qDIuUtmTNvtSn6EZSESPzfuDJBqDNQNSIS9e6Hi8v8er3W5vfRgcgaBL2 ScuQ== 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=kh2On7sBlljzffwt6fmdEYXA5VAJ3OXfxDrgTvsGa8s=; b=IH+60YzTx/mHJFQeYO5TmQNjfFWI1ReRHPLI2TuChhVA02t9xMajoaqJ7lRA61Kg0O kzTF5PMOt1rH8uqr3TGnVgnGlX9Hj1bDmpZGWmXXfMq31hwGDZpQL1cjGQkns1W9tLFs N41JVZGyF63JHua51Bp6lFmyvkTpyjvH5zBXeC1Y9KoE34UpbBSnKg8WCxKIVd9Eib+8 TzAKtqcFz6ngxexITvBbUUSZnfBsqKt7sRY3Cg75lfgw/TETVoPcp7xl8hTqLm9d2upu jF1bGqGyjb0nd8T3Wp8/vuXBRpPEYS96qVF1ARPC5EtEcP6+mQ3jaNDKenzkErU9zjLr B5ZQ== 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 r24si6786861eji.339.2019.08.27.00.10.41; Tue, 27 Aug 2019 00:10:41 -0700 (PDT) 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 1AC851C0AA; Tue, 27 Aug 2019 09:09:40 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 604761BFB4 for ; Tue, 27 Aug 2019 09:09:20 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 426FB2005CA; Tue, 27 Aug 2019 09:09:20 +0200 (CEST) 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 3F13F2005C6; Tue, 27 Aug 2019 09:09:18 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B422A4031F; Tue, 27 Aug 2019 15:09:14 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:09 +0530 Message-Id: <20190827070730.11206-10-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 09/30] net/dpaa2: improve the Rx offload debug message 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: Hemant Agrawal Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ethdev.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index dd6a78f9f..bbebb66fe 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -395,20 +395,20 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); - /* Rx offloads validation */ + /* Rx offloads which are enabled by default */ if (dev_rx_offloads_nodis & ~rx_offloads) { - DPAA2_PMD_WARN( - "Rx offloads non configurable - requested 0x%" PRIx64 - " ignored 0x%" PRIx64, - rx_offloads, dev_rx_offloads_nodis); + DPAA2_PMD_INFO( + "Some of rx offloads enabled by default - requested 0x%" PRIx64 + " fixed are 0x%" PRIx64, + rx_offloads, dev_rx_offloads_nodis); } - /* Tx offloads validation */ + /* Tx offloads which are enabled by default */ if (dev_tx_offloads_nodis & ~tx_offloads) { - DPAA2_PMD_WARN( - "Tx offloads non configurable - requested 0x%" PRIx64 - " ignored 0x%" PRIx64, - tx_offloads, dev_tx_offloads_nodis); + DPAA2_PMD_INFO( + "Some of tx offloads enabled by default - requested 0x%" PRIx64 + " fixed are 0x%" PRIx64, + tx_offloads, dev_tx_offloads_nodis); } if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { From patchwork Tue Aug 27 07:07:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172258 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5397556ily; Tue, 27 Aug 2019 00:10:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLFGuHVJbaegCX7DQ3ycHPheuLi1EZSfIq12l+LxpV+FomyNCWGPEEKKHbYUuSvgSVRaA2 X-Received: by 2002:a05:6402:1594:: with SMTP id c20mr22533235edv.130.1566889850627; Tue, 27 Aug 2019 00:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889850; cv=none; d=google.com; s=arc-20160816; b=rkLBRpYu9ffstJrPaUSCFPu3nO5Ffj0zK9mXMselpbu35ethLMlyQ9zXk3B7iVU6P9 UgfGmIwBzvoy0zfPKRlUu6gN2+sYR1nnu74EBAWvjzKTsYjG/FMH9OHZNCT/cJgwmPMl hYZWR6UBXyu9UyILj5AmELrwK4MVrFDpu7LvZUd4CLt3C3Ugdh93LbLm9dGhlHg/UhhI xIFBAL/Ln4ydsyb72Y5NZkAPdB8k8kEqNUae2oVKhE+5iFDOc3Yy3yV7Ssy6PscFwpX5 iIpuAlyCqedTrPEo6Oi9/ISs426MGZORCGUO2CXMlxvJaiTjfZqUmTli+QlB9YsvYrI2 zinw== 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=WqzB9MoyGTXXdlHu1nCSF/Nvw5mHjrAjfnUNfJ1C8pI=; b=InTyb2YxWNTVJHChGIiqQ6WRmt7SJ0C5jYGy/4gNLYqXKK5BgXPu7U4c058R6/xyMD M0W7RO7iTDSCru5TCoY5S1laCi00Ctn/9FCVizvczHVyOKOQ0858afx1J+/QR11u33ud HxvUR9QjkDipcWuqDkH9MuX9hHwIGvgQQH/rhPtkWW+sjAPTChH/JZxbdAjonVgStc8h y39mOIX/1he7LC3LqQO/JfexUPjxwJNRhBDAGonrku8YzHeaZh4jUs0hy7i5Z+wgtYbm JZbRrHO1dsCa8iXsc6OeH3iGimIW59+8sJZo60luliQVnY3hYgc8bV0NuxvY0NcgxsEu T5ew== 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 b1si6830085eje.185.2019.08.27.00.10.50; Tue, 27 Aug 2019 00:10:50 -0700 (PDT) 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 563501C0B1; Tue, 27 Aug 2019 09:09:42 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 280731BFA8 for ; Tue, 27 Aug 2019 09:09:21 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 090462005CF; Tue, 27 Aug 2019 09:09:21 +0200 (CEST) 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 04E342005B6; Tue, 27 Aug 2019 09:09:19 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 7ADED402DE; Tue, 27 Aug 2019 15:09:15 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:10 +0530 Message-Id: <20190827070730.11206-11-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 10/30] common/dpaax: reduce debug mesages 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: Hemant Agrawal Signed-off-by: Hemant Agrawal Reviewed-by: Sachin Saxena --- drivers/common/dpaax/dpaax_iova_table.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c index ae0af0919..43c9c72e6 100644 --- a/drivers/common/dpaax/dpaax_iova_table.c +++ b/drivers/common/dpaax/dpaax_iova_table.c @@ -140,7 +140,8 @@ read_memory_node(unsigned int *count) DPAAX_DEBUG("Device-tree memory node data:"); do { - DPAAX_DEBUG("\n %08" PRIx64 " %08zu", nodes[j].addr, nodes[j].len); + DPAAX_DEBUG(" %08" PRIx64 " %08zu", + nodes[j].addr, nodes[j].len); } while (--j); cleanup: @@ -241,7 +242,7 @@ dpaax_iova_table_populate(void) /* Release memory associated with nodes array - not required now */ free(nodes); - DPAAX_DEBUG("Adding mem-event handler\n"); + DPAAX_DEBUG("Adding mem-event handler"); ret = dpaax_handle_memevents(); if (ret) { DPAAX_ERR("Unable to add mem-event handler"); @@ -306,10 +307,11 @@ dpaax_iova_table_update(phys_addr_t paddr, void *vaddr, size_t length) * case. */ entry[i].pages[e_offset] = align_vaddr; +#ifdef RTE_COMMON_DPAAX_DEBUG DPAAX_DEBUG("Added: vaddr=%zu for Phy:%"PRIu64" at %zu" " remaining len %zu", align_vaddr, align_paddr, e_offset, req_length); - +#endif /* Incoming request can be larger than the * DPAAX_MEM_SPLIT size - in which case, multiple * entries in entry->pages[] are filled up. @@ -336,10 +338,11 @@ dpaax_iova_table_update(phys_addr_t paddr, void *vaddr, size_t length) vaddr, paddr); return -1; } - +#ifdef RTE_COMMON_DPAAX_DEBUG DPAAX_DEBUG("Add: Found slot at (%"PRIu64")[(%zu)] for vaddr:(%p)," " phy(%"PRIu64"), len(%zu)", entry[i].start, e_offset, vaddr, paddr, length); +#endif return 0; } @@ -404,13 +407,13 @@ dpaax_memevent_cb(enum rte_mem_event type, const void *addr, size_t len, phys_addr = rte_mem_virt2phy(ms->addr); virt_addr = ms->addr; map_len = ms->len; - +#ifdef RTE_COMMON_DPAAX_DEBUG DPAAX_DEBUG("Request for %s, va=%p, virt_addr=%p," "iova=%"PRIu64", map_len=%zu", type == RTE_MEM_EVENT_ALLOC ? "alloc" : "dealloc", va, virt_addr, phys_addr, map_len); - +#endif if (type == RTE_MEM_EVENT_ALLOC) ret = dpaax_iova_table_update(phys_addr, virt_addr, map_len); From patchwork Tue Aug 27 07:07:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172259 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5397689ily; Tue, 27 Aug 2019 00:10:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9ZSbzZ6OdPTbymkZvtewvnZpT9+bWAu1ycFbj1q7+sNuNdOcYwRBRvuxxeYE8QXcB8VE6 X-Received: by 2002:a17:906:3fc7:: with SMTP id k7mr20401877ejj.208.1566889859632; Tue, 27 Aug 2019 00:10:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889859; cv=none; d=google.com; s=arc-20160816; b=ih86MlINnF0ffojf3oba6mZp2sOEjnQAe/Qat40kJ/gDS8TZqWB8Z+pbZSCywWoQK7 LicpnTTRvnbDPNz5qbvEgNsAKwc00C+3Lo9a2Eo29TjZsV0erj0GoLRnE6QL8BcKWia1 EOPupTP37ejaVLBG955ZYiVwF/GuyROHZ49YxLU12jDx+iaGfcXnEb2EwYJqkmPLwmxY I9Yl8Rm0h5+aTcMHn6AL/dDr7CFSqUlYoDZpiNRtrQ4hM4ltgGybhk8TWvFUZ2CTWrd6 wBG8wL0Xjzea2xBHkbMy3m7p5HkqJLa9XCeOeA4NIBy9aCceVCs+b+ur9/oQcMky7ZXI Tj6w== 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=y5ZuhV8wtmrGASDSrDF/US3Yp+7uGiPFJQgBDsCz56Y=; b=XzXKW/HDXfsOQSbIiboePco/kgN3zeV7RiCVi0he9Awr47fNpJpXfZCHZ5MC39Iy7d A/HjwskHNorJXdgg2tXMzO703Xzc1mR62mFR48L9zV8EN8O7gMMPYqZThKfehRqrFwUD lXvR/LxpS6j0hpWeyNmnblawRfs1JnF7DSw5LdPLudO68IL0CGVWeeuf3JZNi7mIK2i6 53lfU01crFIae6OaW1nKp0adegmR4vxF31q2WaHbV7Qn7WF+E+aS0iNpwGZS8c1LDyoK RcIdk0QMx7vR3gdUZpM8iTes+qNjJ2/mXnWudWFLUqSyhGDXUWTYj7KSPxoOw9b0GN+m VV/A== 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 x8si8329164edm.247.2019.08.27.00.10.59; Tue, 27 Aug 2019 00:10:59 -0700 (PDT) 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 2BBB31C0C3; Tue, 27 Aug 2019 09:09:45 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id E724A1BFA8 for ; Tue, 27 Aug 2019 09:09:21 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id C9F172005CD; Tue, 27 Aug 2019 09:09:21 +0200 (CEST) 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 C73762005C5; Tue, 27 Aug 2019 09:09:19 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 402CA402E7; Tue, 27 Aug 2019 15:09:16 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:11 +0530 Message-Id: <20190827070730.11206-12-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 11/30] mempool/dpaa: reduce debug messages 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: Hemant Agrawal Signed-off-by: Hemant Agrawal Reviewed-by: Sachin Saxena --- drivers/mempool/dpaa/dpaa_mempool.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c index c371d3a6b..a25697f05 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -298,8 +298,6 @@ dpaa_populate(struct rte_mempool *mp, unsigned int max_objs, struct dpaa_bp_info *bp_info; unsigned int total_elt_sz; - MEMPOOL_INIT_FUNC_TRACE(); - if (!mp || !mp->pool_data) { DPAA_MEMPOOL_ERR("Invalid mempool provided\n"); return 0; @@ -311,7 +309,7 @@ dpaa_populate(struct rte_mempool *mp, unsigned int max_objs, bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp); total_elt_sz = mp->header_size + mp->elt_size + mp->trailer_size; - DPAA_MEMPOOL_DEBUG("Req size %" PRIx64 " vs Available %u\n", + DPAA_MEMPOOL_DPDEBUG("Req size %" PRIx64 " vs Available %u\n", (uint64_t)len, total_elt_sz * mp->size); /* Detect pool area has sufficient space for elements in this memzone */ From patchwork Tue Aug 27 07:07:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172260 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5397924ily; Tue, 27 Aug 2019 00:11:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqzuRpMU4hjpHdYodjZaWDjSJz4a2StdA7uSZZ5HiceQBueKMJw+7TSkYHaz5QDQzeji9ZSQ X-Received: by 2002:a17:907:4362:: with SMTP id nd2mr19782573ejb.29.1566889871992; Tue, 27 Aug 2019 00:11:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889871; cv=none; d=google.com; s=arc-20160816; b=Td6vI9mgjcD8zYlk0iIHKfdXnocV2pZ2WhZc2wnF/jXNY8NgV5ky/YzGoeDZAGfxB9 F+W0/8Tlfl2EnOFIe2jgvs8Ibxr6go8gd5LFGgSrgD8AsZ2yfKLWzcnVhI+f+5IKGEUX B6xRIhUuA1Q+avJ1MLQYIiwXTfFq3ti9bx9fHGW4YycvD3Li7857RWm7Q/YI1+XE+0wc O4ZExfLUJuUUfmlPdrYH9h0w5+59S+PEHB31YoPwlnlFzfzJAb0rsrLdrt5ObZTDid4e b6uS9tSNuy4nogQJPlOtMlFhJFkMGPjytX9tbLrY8yoebsvb2DX51P0EjBs6sLXVKwuu yqOg== 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=nnNDeQmjTqf2d21sEMKM97QRX9F2bHbqe1Y785j0Rx8=; b=t3/mQwnl1CcYFvHnc52/9VGqi0kRJ1A3PWroJtYXCCEksBRFftkY3XvmwBaxO/FAyU Z01U32xhCYeYTu3OpR/Ehggo8WkawNmsZc8YthcRX6UW5FYfSZPMl4YzPOnp3mhOvuCp VYxlU0ceCw5rSVbDS24nFQbf9PXcquBhOOgjtUUUHLRo91T4ohGL0GPtzvxHBZ9spKxW nphUOPjRr2Tn0UP+2mbyS44UMPfflyxeVkSdmZJnSx7W+CtFrBTUehlXfhjUiVs/Qh/y zV8osNV/VfTDvcRmV80wA1NxB51pZUkCB9O3IKvjor6O2i99ZmtmlTtZHxJXGYC+hT0i 6ILg== 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 h47si8236815eda.243.2019.08.27.00.11.11; Tue, 27 Aug 2019 00:11:11 -0700 (PDT) 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 4CE9F1C0CD; Tue, 27 Aug 2019 09:09:48 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 3FB7F1BFBF for ; Tue, 27 Aug 2019 09:09:22 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 22B4C1A01F4; Tue, 27 Aug 2019 09:09:22 +0200 (CEST) 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 20B141A0211; Tue, 27 Aug 2019 09:09:20 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 0EA57402EB; Tue, 27 Aug 2019 15:09:16 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:12 +0530 Message-Id: <20190827070730.11206-13-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 12/30] net/dpaa2: realign Rx offload support types 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: Hemant Agrawal Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ethdev.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index bbebb66fe..130fb5297 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -32,11 +32,11 @@ /* Supported Rx offloads */ static uint64_t dev_rx_offloads_sup = - DEV_RX_OFFLOAD_VLAN_STRIP | - DEV_RX_OFFLOAD_IPV4_CKSUM | - DEV_RX_OFFLOAD_UDP_CKSUM | - DEV_RX_OFFLOAD_TCP_CKSUM | + DEV_RX_OFFLOAD_CHECKSUM | + DEV_RX_OFFLOAD_SCTP_CKSUM | DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM | + DEV_RX_OFFLOAD_OUTER_UDP_CKSUM | + DEV_RX_OFFLOAD_VLAN_STRIP | DEV_RX_OFFLOAD_VLAN_FILTER | DEV_RX_OFFLOAD_JUMBO_FRAME; @@ -51,13 +51,13 @@ static uint64_t dev_tx_offloads_sup = DEV_TX_OFFLOAD_UDP_CKSUM | DEV_TX_OFFLOAD_TCP_CKSUM | DEV_TX_OFFLOAD_SCTP_CKSUM | - DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM; + DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | + DEV_TX_OFFLOAD_MT_LOCKFREE | + DEV_TX_OFFLOAD_MBUF_FAST_FREE; /* Tx offloads which cannot be disabled */ static uint64_t dev_tx_offloads_nodis = - DEV_TX_OFFLOAD_MULTI_SEGS | - DEV_TX_OFFLOAD_MT_LOCKFREE | - DEV_TX_OFFLOAD_MBUF_FAST_FREE; + DEV_TX_OFFLOAD_MULTI_SEGS; /* enable timestamp in mbuf */ enum pmd_dpaa2_ts dpaa2_enable_ts; @@ -439,7 +439,8 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev) rx_l3_csum_offload = true; if ((rx_offloads & DEV_RX_OFFLOAD_UDP_CKSUM) || - (rx_offloads & DEV_RX_OFFLOAD_TCP_CKSUM)) + (rx_offloads & DEV_RX_OFFLOAD_TCP_CKSUM) || + (rx_offloads & DEV_RX_OFFLOAD_SCTP_CKSUM)) rx_l4_csum_offload = true; ret = dpni_set_offload(dpni, CMD_PRI_LOW, priv->token, From patchwork Tue Aug 27 07:07:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172261 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5398090ily; Tue, 27 Aug 2019 00:11:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqwc1loSGHFKKDvEn/JKFWzs5kx1nsDEBT3rFHI2GKHKtcyfvmjY5QsnOsOEau6Qh4894ud/ X-Received: by 2002:aa7:c81a:: with SMTP id a26mr22623214edt.26.1566889883366; Tue, 27 Aug 2019 00:11:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889883; cv=none; d=google.com; s=arc-20160816; b=rpD571wL9JLkL2QPd10r/bbZ0FfvD0Qcg3csj7jd2sJNCPFU4JGW+pgb/3oydc2mI3 wOl5YiLv0aAJbgmm/DAElCX+BblwPJzDHERV4cM2ysnCgxGFBynj+6nA4s3KnQIPeb8k FYi7LmETSS/8l0PG/ioiUY0w6gMM11bKgdCg3kV1nvrj5xtSy8UEtBtVoxc+wWD0bju7 LVVtd1T5RZUPwEw/gwTb/daKHkHkJjG48DleGIPzPGCg3wnog5N/bekRdWpNz7mmwEeq UUB/4Dank0BdWBI7jm5orE+rOTuBFzvDKFW/EoKZq8orPN341UqtdKQCoAA9x8vHuy2h ikYA== 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=deAB1sqgLpGqQwqIqCeFAPOHuHlA0SR3n+/RUDaVrq0=; b=i6HXJ5BDJaK0Mt6Ed9W+3tp6yhK/9o3QqN3tFVNV2qeqTkihfZeP6VOEo8slarA+nV s0venFzIvUE84SvGubTuOxGfYqV9BhChN6elNB6Gcg8szH2Wn4k+tO4DeCUAUJgNM2lb WJj3IQzmcZruJaCEsBwMCXL8DxGArENvD1y5C7IizMNMThwRJKcsUqNTjuCtY63wZ7U4 Uv+Xjkv5nZjsO0xMkulc8n1hUeYNV1uitUIgxrFDwmbILAAdkZIWc0e4w76a9FPvcNsc wYwf0SdM9LAk7iGEqnU8iIjvaHeSw21D3zWQco/P0yiSBSMtmMC2lhWFA/mL2h/B6EWm bZjQ== 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 h13si6969993ejd.391.2019.08.27.00.11.23; Tue, 27 Aug 2019 00:11:23 -0700 (PDT) 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 DCD2E1C0DD; Tue, 27 Aug 2019 09:09:50 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 0BDF41BFE1 for ; Tue, 27 Aug 2019 09:09:23 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E659C1A059B; Tue, 27 Aug 2019 09:09:22 +0200 (CEST) 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 E35591A021C; Tue, 27 Aug 2019 09:09:20 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id C76EC402F0; Tue, 27 Aug 2019 15:09:17 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:13 +0530 Message-Id: <20190827070730.11206-14-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 13/30] net/dpaa2: enable Rx offload for timestamp 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: Hemant Agrawal Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ethdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 130fb5297..4689cf9a4 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -38,7 +38,8 @@ static uint64_t dev_rx_offloads_sup = DEV_RX_OFFLOAD_OUTER_UDP_CKSUM | DEV_RX_OFFLOAD_VLAN_STRIP | DEV_RX_OFFLOAD_VLAN_FILTER | - DEV_RX_OFFLOAD_JUMBO_FRAME; + DEV_RX_OFFLOAD_JUMBO_FRAME | + DEV_RX_OFFLOAD_TIMESTAMP; /* Rx offloads which cannot be disabled */ static uint64_t dev_rx_offloads_nodis = @@ -457,6 +458,9 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev) return ret; } + if (rx_offloads & DEV_RX_OFFLOAD_TIMESTAMP) + dpaa2_enable_ts = true; + if (tx_offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) tx_l3_csum_offload = true; From patchwork Tue Aug 27 07:07:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172262 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5398196ily; Tue, 27 Aug 2019 00:11:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqzK3bkOx1QY3f+RxDSjusmViMW3VQBUVxK4ELduC7co5CFrkc+0N4H1xXIaAl3lL8EGdU+v X-Received: by 2002:a50:fd82:: with SMTP id o2mr22799924edt.80.1566889891537; Tue, 27 Aug 2019 00:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889891; cv=none; d=google.com; s=arc-20160816; b=oGrHm710qmeGtopYKmuS7JiDcGJyVm73fVUcuEsZ/8V473ITeTKb09r5p9xX+fCxMV Cdcumu+GhL+/xy/SqRfxKDTnkMe2jPPkVq68PFJelwbKqzSk5IJRRGxtq6UcR9I5pHUi i4h1yaNzWm0Q9Gku6XTe+tOPRX9XZmM7gYQ5hRtpkeAL/jubneXZUwN9vuaLBkbrBMKc yXNcpu/D4l9KEfnUAPw1KMSDxPaJbvuqRSCdPe8+c2KxDQb13BnHsbMIe9tEV0sre3mg hpGg4QfjHKKK+RE/zFR5DEl8L6/tZeixpHUP1my5xsteV3rHLN+L+kBQMlRY+M+m7CHm hv8w== 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=TAZRpzk4jQHTY0QB46wEpO9jrlg2t5y0IEqNHpxArms=; b=U2XUAGGn1K0KxFzUcyuqDc0jYzKncTff/oyl6mxWq2t9ZHjI6CvAJUcMsRbnbCcgh1 LeptnFlhwBO0Hy1GqqeF/gONDf13oYl2lUrA+QHXBw5lTpnf6GkzoQcMyQ4N6rm8pwRv ZbbHAjIYThdfDhCYDEALGAbDEkb3j9EqS4cvLlwlTs2h0I3WunLvzu8OHYWl+psEiQ7G tAeqMkAfhMoSQ9EFapVzzM2Q7u0d9iRzCPbyMxN7I7IDMaPxyFjX0ztyZL3xnJ+tG6io JlBSGyIoKtBjZfHKrq/s0r0odrc7O4CSwDdgk1JH1P7O0Iz/BDuKAWqRauCErcHCyGCW QKCA== 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 t13si6742415eju.370.2019.08.27.00.11.31; Tue, 27 Aug 2019 00:11:31 -0700 (PDT) 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 6B2BD1C112; Tue, 27 Aug 2019 09:09:52 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id CE3351BFE3 for ; Tue, 27 Aug 2019 09:09:23 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B20671A05CA; Tue, 27 Aug 2019 09:09:23 +0200 (CEST) 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 B0CAE1A0207; Tue, 27 Aug 2019 09:09:21 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 952FE402A5; Tue, 27 Aug 2019 15:09:18 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:14 +0530 Message-Id: <20190827070730.11206-15-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 14/30] net/dpaa2: support L2 payload based RSS distribution 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: Hemant Agrawal Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ethdev.h | 1 + 1 file changed, 1 insertion(+) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 33b1506aa..69ab577f5 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -54,6 +54,7 @@ #define DPAA2_RX_TAILDROP_OFF 0x04 #define DPAA2_RSS_OFFLOAD_ALL ( \ + ETH_RSS_L2_PAYLOAD | \ ETH_RSS_IP | \ ETH_RSS_UDP | \ ETH_RSS_TCP | \ From patchwork Tue Aug 27 07:07:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172263 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5398329ily; Tue, 27 Aug 2019 00:11:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqwETftsMqaDk8jBFT4kPWniJ5ljjOG+BrBPc9RhS1At23i1sE8bkljBdk68J1R6Uq6if4Zh X-Received: by 2002:a50:f419:: with SMTP id r25mr22624958edm.57.1566889899805; Tue, 27 Aug 2019 00:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889899; cv=none; d=google.com; s=arc-20160816; b=dcR8h6TFy5OZ/tF3qdnlcs5mLdil6bh9vIgPZc1QE/wiC+dGYxKePA+WjnmmaIs8Qx wxnhXvxMXLEzOOf9tyQDaLUimQR27AQldKAradJi043Ogfur0eA2iH5mOWCHytljLEmF NhqPeJ+IuNJo44Ds8ojrH5gXy2P/onJG6ocU/utfL73/XwZ2rFpdQRXXjpFpq2cO+Ei7 gQSASwy4+6IUA/cyGqFQKQNtBCSdU2orKNzFFFA5sZoXrGN50nJyijjrQQ1HkfRNDGnl 3uF2GRKi2a9q5h4LdMdy8LzPTVoCWuTRRCN96vIc4Wb0ITwL0tWxrlXnd1Lyoyl+YfUf S0MQ== 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=RkoLDjJOofgRmWsRa0i+cLAAwGQEi9hYB/KsgboT6gI=; b=zd4TfMgPYV7VzeON5C86tqzDyCUxFaHvokhgoojl/x8wQgr+pheq/NT+4bRqkZe3ts m6EVZsfW1IpIs0UVZL1atDvaor4UDn4HGuXQGVDUBYz4q6yzefELppTUvlKzQk5ShFtu ldwMTzSWoK7Ho59Xf9afwb7fLT35q3R9DbOSZjGbEvFgEPuTOUUsPERHc2dD0+3GqXJw +XptaedHL3ej0C+VUfp9WpWcRJBV+sLSXHrJ1nOxIjPe6mzgJQAkR11g374FJgerepMn KGGK1YCSWSqvBBvLFlEKaeJ3dRfJQMU1dO/uoVVkKvqYpSPqGoc2uq1LdnN3aWYVaRSH d2GA== 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 t57si8510277edd.26.2019.08.27.00.11.39; Tue, 27 Aug 2019 00:11:39 -0700 (PDT) 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 E76021C11E; Tue, 27 Aug 2019 09:09:53 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id CD6271BFE3 for ; Tue, 27 Aug 2019 09:09:24 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id AE7501A0207; Tue, 27 Aug 2019 09:09:24 +0200 (CEST) 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 763EF1A0211; Tue, 27 Aug 2019 09:09:22 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 63BE8402BF; Tue, 27 Aug 2019 15:09:19 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Nipun Gupta Date: Tue, 27 Aug 2019 12:37:15 +0530 Message-Id: <20190827070730.11206-16-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 15/30] net/dpaa2: add optional non-prefetch Rx mode 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: Nipun Gupta When we need particular number of packets from the rx routine, which would change in every call, we cannot prefetch the packets and provide previous results to the user. User can select the mode by using devargs for non pretech mode. Signed-off-by: Nipun Gupta --- doc/guides/nics/dpaa2.rst | 4 ++ drivers/net/dpaa2/dpaa2_ethdev.c | 11 +++- drivers/net/dpaa2/dpaa2_ethdev.h | 2 + drivers/net/dpaa2/dpaa2_rxtx.c | 105 +++++++++++++++++++++++++++++++ 4 files changed, 121 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/doc/guides/nics/dpaa2.rst b/doc/guides/nics/dpaa2.rst index a698e5ab6..99e4c8d72 100644 --- a/doc/guides/nics/dpaa2.rst +++ b/doc/guides/nics/dpaa2.rst @@ -504,6 +504,10 @@ for details. driver level. Any packet received will be reflected back by the driver on same port. e.g. ``fslmc:dpni.1,drv_loopback=1`` +* Use dev arg option ``drv_no_prefetch=1`` to disable prefetching + of the packet pull command which is issued in the previous cycle. + e.g. ``fslmc:dpni.1,drv_no_prefetch=1`` + Enabling logs ------------- diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 4689cf9a4..f25cdfb3d 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -29,6 +29,7 @@ #include #define DRIVER_LOOPBACK_MODE "drv_loopback" +#define DRIVER_NO_PREFETCH_MODE "drv_no_prefetch" /* Supported Rx offloads */ static uint64_t dev_rx_offloads_sup = @@ -750,6 +751,7 @@ dpaa2_supported_ptypes_get(struct rte_eth_dev *dev) }; if (dev->rx_pkt_burst == dpaa2_dev_prefetch_rx || + dev->rx_pkt_burst == dpaa2_dev_rx || dev->rx_pkt_burst == dpaa2_dev_loopback_rx) return ptypes; return NULL; @@ -2118,6 +2120,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) eth_dev->dev_ops = &dpaa2_ethdev_ops; if (dpaa2_get_devargs(dev->devargs, DRIVER_LOOPBACK_MODE)) eth_dev->rx_pkt_burst = dpaa2_dev_loopback_rx; + else if (dpaa2_get_devargs(dev->devargs, + DRIVER_NO_PREFETCH_MODE)) + eth_dev->rx_pkt_burst = dpaa2_dev_rx; else eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx; eth_dev->tx_pkt_burst = dpaa2_dev_tx; @@ -2236,6 +2241,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) if (dpaa2_get_devargs(dev->devargs, DRIVER_LOOPBACK_MODE)) { eth_dev->rx_pkt_burst = dpaa2_dev_loopback_rx; DPAA2_PMD_INFO("Loopback mode"); + } else if (dpaa2_get_devargs(dev->devargs, DRIVER_NO_PREFETCH_MODE)) { + eth_dev->rx_pkt_burst = dpaa2_dev_rx; + DPAA2_PMD_INFO("No Prefetch mode"); } else { eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx; } @@ -2395,7 +2403,8 @@ static struct rte_dpaa2_driver rte_dpaa2_pmd = { RTE_PMD_REGISTER_DPAA2(net_dpaa2, rte_dpaa2_pmd); RTE_PMD_REGISTER_PARAM_STRING(net_dpaa2, - DRIVER_LOOPBACK_MODE "="); + DRIVER_LOOPBACK_MODE "= " + DRIVER_NO_PREFETCH_MODE "="); RTE_INIT(dpaa2_pmd_init_log) { dpaa2_logtype_pmd = rte_log_register("pmd.net.dpaa2"); diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 69ab577f5..a991ccc1d 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -149,6 +149,8 @@ int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev, int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev, int eth_rx_queue_id); +uint16_t dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts); + uint16_t dpaa2_dev_loopback_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts); diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 6ca5071e0..19838180f 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -727,6 +727,111 @@ dpaa2_dev_process_ordered_event(struct qbman_swp *swp, qbman_swp_dqrr_consume(swp, dq); } +uint16_t +dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) +{ + /* Function receive frames for a given device and VQ */ + struct dpaa2_queue *dpaa2_q = (struct dpaa2_queue *)queue; + struct qbman_result *dq_storage; + uint32_t fqid = dpaa2_q->fqid; + int ret, num_rx = 0, next_pull = nb_pkts, num_pulled; + uint8_t pending, status; + struct qbman_swp *swp; + const struct qbman_fd *fd, *next_fd; + struct qbman_pull_desc pulldesc; + struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data; + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_PMD_ERR("Failure in affining portal\n"); + return 0; + } + } + swp = DPAA2_PER_LCORE_PORTAL; + + do { + dq_storage = dpaa2_q->q_storage->dq_storage[0]; + qbman_pull_desc_clear(&pulldesc); + qbman_pull_desc_set_fq(&pulldesc, fqid); + qbman_pull_desc_set_storage(&pulldesc, dq_storage, + (size_t)(DPAA2_VADDR_TO_IOVA(dq_storage)), 1); + + if (next_pull > dpaa2_dqrr_size) { + qbman_pull_desc_set_numframes(&pulldesc, + dpaa2_dqrr_size); + next_pull -= dpaa2_dqrr_size; + } else { + qbman_pull_desc_set_numframes(&pulldesc, next_pull); + next_pull = 0; + } + + while (1) { + if (qbman_swp_pull(swp, &pulldesc)) { + DPAA2_PMD_DP_DEBUG( + "VDQ command is not issued.QBMAN is busy\n"); + /* Portal was busy, try again */ + continue; + } + break; + } + + rte_prefetch0((void *)((size_t)(dq_storage + 1))); + /* Check if the previous issued command is completed. */ + while (!qbman_check_command_complete(dq_storage)) + ; + + num_pulled = 0; + pending = 1; + do { + /* Loop until the dq_storage is updated with + * new token by QBMAN + */ + while (!qbman_check_new_result(dq_storage)) + ; + rte_prefetch0((void *)((size_t)(dq_storage + 2))); + /* Check whether Last Pull command is Expired and + * setting Condition for Loop termination + */ + if (qbman_result_DQ_is_pull_complete(dq_storage)) { + pending = 0; + /* Check for valid frame. */ + status = qbman_result_DQ_flags(dq_storage); + if (unlikely((status & + QBMAN_DQ_STAT_VALIDFRAME) == 0)) + continue; + } + fd = qbman_result_DQ_fd(dq_storage); + + next_fd = qbman_result_DQ_fd(dq_storage + 1); + /* Prefetch Annotation address for the parse results */ + rte_prefetch0( + (void *)(size_t)(DPAA2_GET_FD_ADDR(next_fd) + + DPAA2_FD_PTA_SIZE + 16)); + + if (unlikely(DPAA2_FD_GET_FORMAT(fd) == qbman_fd_sg)) + bufs[num_rx] = eth_sg_fd_to_mbuf(fd); + else + bufs[num_rx] = eth_fd_to_mbuf(fd); + bufs[num_rx]->port = eth_data->port_id; + + if (eth_data->dev_conf.rxmode.offloads & + DEV_RX_OFFLOAD_VLAN_STRIP) { + rte_vlan_strip(bufs[num_rx]); + } + + dq_storage++; + num_rx++; + num_pulled++; + } while (pending); + /* Last VDQ provided all packets and more packets are requested */ + } while (next_pull && num_pulled == dpaa2_dqrr_size); + + dpaa2_q->rx_pkts += num_rx; + + return num_rx; +} + /* * Callback to handle sending packets through WRIOP based interface */ From patchwork Tue Aug 27 07:07:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172264 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5398470ily; Tue, 27 Aug 2019 00:11:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMvRkdc0Of507qi8QXPDlmRLhjUhOoW50nP60n2g/NOya6alzixONQexDqWfjLa9LG6CSB X-Received: by 2002:a17:906:2312:: with SMTP id l18mr10617631eja.177.1566889909399; Tue, 27 Aug 2019 00:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889909; cv=none; d=google.com; s=arc-20160816; b=JAjaCHYVwpBQmzZkfXb7QQSIbRwewdupEPocU1sSWaMaSjAPXf5gTrUKcaDNNZ1j4i X9b6zU26JbZUeOWpfFYNqgbF8Ykc9HjPbhlHtgHl7Z8QRXkTE92y+cZMz6AeauRWsqEd iOMu4QA6saLVNigvkliyMdwQfx6dxbm47GtGvvgy9H9E5vScQhO1ZbVoGBuM0UT+aXmx Gqt4VJ+aAE99k/wMIL4KVg1e14DxUSHl+0z+w1o6gTDGNHdj6hIbcKrvF5WzvoKy+2Cp QjDpw8E4uNcKwhccvdT7esWwplpvQnnGU6W9KQoidgTVq7l2Fw9DajWoNRc971wSsFvy NDMA== 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=PP/L+7/ZZaP2e0Hp1JUFPYmL9fl8QefjGkF2zhtomSk=; b=EvyyVG0WCz6rwgNdS4yuG1U2YDN2Rha6s4YIwifADfboss8ZTTGC7X6aWoeRcBsFFn Da6gEWcKEYPqOaSkezYAvFhwH4PTR7NgVEEFkyKBEnjLx0fDQKEYErInx6pr1uhpmkVT w+IjKi4VZMOh51fni+aZa3UznofGjZZtM2pOrENDwlrQ//Ayztakqp2IPv9bScJ1Da3U S9z5XZtFpx96uexXuhlZloxQyJVtAmGFb/XaxU2zgX8cVe/d0pIaxo3M0ufPSJE+/PsH AlXZed8PsZw0AiK7E5G02BYrY7FkoK9JbqnumAg0tPmw31/si/8WrB0VSDXd5n5JSdK/ Mk8g== 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 x10si6686837eju.179.2019.08.27.00.11.49; Tue, 27 Aug 2019 00:11:49 -0700 (PDT) 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 5FC251C127; Tue, 27 Aug 2019 09:09:55 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 985771BFE3 for ; Tue, 27 Aug 2019 09:09:25 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 759962001BC; Tue, 27 Aug 2019 09:09:25 +0200 (CEST) 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 3BA4B2005BF; Tue, 27 Aug 2019 09:09:23 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 28C474031D; Tue, 27 Aug 2019 15:09:20 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:16 +0530 Message-Id: <20190827070730.11206-17-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 16/30] net/dpaa2: add taildrop support on frame count basis 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: Hemant Agrawal The existing taildrop was based on queue data size. This patch replaces it with frame count bases using CGR methods of DPAA2 device. The number of CGRs are limited. So, - use per queue CGR based tail drop for as many as CGR available. - Remaining queues shall use the legacy byte based tail drop Number of CGRs can be controlled by dpl file during dpni_create. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 5 +- drivers/net/dpaa2/dpaa2_ethdev.c | 112 +++++++++++++++++++++--- drivers/net/dpaa2/dpaa2_ethdev.h | 6 +- 3 files changed, 106 insertions(+), 17 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h index 4bb6b26c7..7f7e2fd78 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h @@ -145,10 +145,10 @@ struct dpaa2_queue { struct rte_eth_dev_data *eth_data; struct rte_cryptodev_data *crypto_data; }; - int32_t eventfd; /*!< Event Fd of this queue */ uint32_t fqid; /*!< Unique ID of this queue */ - uint8_t tc_index; /*!< traffic class identifier */ uint16_t flow_id; /*!< To be used by DPAA2 frmework */ + uint8_t tc_index; /*!< traffic class identifier */ + uint8_t cgid; /*! < Congestion Group id for this queue */ uint64_t rx_pkts; uint64_t tx_pkts; uint64_t err_pkts; @@ -157,6 +157,7 @@ struct dpaa2_queue { struct qbman_result *cscn; }; struct rte_event ev; + int32_t eventfd; /*!< Event Fd of this queue */ dpaa2_queue_cb_dqrr_t *cb; dpaa2_queue_cb_eqresp_free_t *cb_eqresp_free; struct dpaa2_bp_info *bp_array; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index f25cdfb3d..b30f37ecb 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -514,7 +514,7 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev) static int dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id, - uint16_t nb_rx_desc __rte_unused, + uint16_t nb_rx_desc, unsigned int socket_id __rte_unused, const struct rte_eth_rxconf *rx_conf __rte_unused, struct rte_mempool *mb_pool) @@ -526,7 +526,7 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev, uint8_t options = 0; uint8_t flow_id; uint32_t bpid; - int ret; + int i, ret; PMD_INIT_FUNC_TRACE(); @@ -545,12 +545,28 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev, dpaa2_q->bp_array = rte_dpaa2_bpid_info; /*Get the flow id from given VQ id*/ - flow_id = rx_queue_id % priv->nb_rx_queues; + flow_id = dpaa2_q->flow_id; memset(&cfg, 0, sizeof(struct dpni_queue)); options = options | DPNI_QUEUE_OPT_USER_CTX; cfg.user_context = (size_t)(dpaa2_q); + /* check if a private cgr available. */ + for (i = 0; i < priv->max_cgs; i++) { + if (!priv->cgid_in_use[i]) { + priv->cgid_in_use[i] = 1; + break; + } + } + + if (i < priv->max_cgs) { + options |= DPNI_QUEUE_OPT_SET_CGID; + cfg.cgid = i; + dpaa2_q->cgid = cfg.cgid; + } else { + dpaa2_q->cgid = 0xff; + } + /*if ls2088 or rev2 device, enable the stashing */ if ((dpaa2_svr_family & 0xffff0000) != SVR_LS2080A) { @@ -579,15 +595,56 @@ dpaa2_dev_rx_queue_setup(struct rte_eth_dev *dev, struct dpni_taildrop taildrop; taildrop.enable = 1; - /*enabling per rx queue congestion control */ - taildrop.threshold = CONG_THRESHOLD_RX_Q; - taildrop.units = DPNI_CONGESTION_UNIT_BYTES; - taildrop.oal = CONG_RX_OAL; - DPAA2_PMD_DEBUG("Enabling Early Drop on queue = %d", - rx_queue_id); - ret = dpni_set_taildrop(dpni, CMD_PRI_LOW, priv->token, + + /* Private CGR will use tail drop length as nb_rx_desc. + * for rest cases we can use standard byte based tail drop. + * There is no HW restriction, but number of CGRs are limited, + * hence this restriction is placed. + */ + if (dpaa2_q->cgid != 0xff) { + /*enabling per rx queue congestion control */ + taildrop.threshold = nb_rx_desc; + taildrop.units = DPNI_CONGESTION_UNIT_FRAMES; + taildrop.oal = 0; + DPAA2_PMD_DEBUG("Enabling CG Tail Drop on queue = %d", + rx_queue_id); + ret = dpni_set_taildrop(dpni, CMD_PRI_LOW, priv->token, + DPNI_CP_CONGESTION_GROUP, + DPNI_QUEUE_RX, + dpaa2_q->tc_index, + flow_id, &taildrop); + } else { + /*enabling per rx queue congestion control */ + taildrop.threshold = CONG_THRESHOLD_RX_BYTES_Q; + taildrop.units = DPNI_CONGESTION_UNIT_BYTES; + taildrop.oal = CONG_RX_OAL; + DPAA2_PMD_DEBUG("Enabling Byte based Drop on queue= %d", + rx_queue_id); + ret = dpni_set_taildrop(dpni, CMD_PRI_LOW, priv->token, + DPNI_CP_QUEUE, DPNI_QUEUE_RX, + dpaa2_q->tc_index, flow_id, + &taildrop); + } + if (ret) { + DPAA2_PMD_ERR("Error in setting taildrop. err=(%d)", + ret); + return -1; + } + } else { /* Disable tail Drop */ + struct dpni_taildrop taildrop = {}; + DPAA2_PMD_INFO("Tail drop is disabled on queue"); + + taildrop.enable = 0; + if (dpaa2_q->cgid != 0xff) { + ret = dpni_set_taildrop(dpni, CMD_PRI_LOW, priv->token, + DPNI_CP_CONGESTION_GROUP, DPNI_QUEUE_RX, + dpaa2_q->tc_index, + flow_id, &taildrop); + } else { + ret = dpni_set_taildrop(dpni, CMD_PRI_LOW, priv->token, DPNI_CP_QUEUE, DPNI_QUEUE_RX, dpaa2_q->tc_index, flow_id, &taildrop); + } if (ret) { DPAA2_PMD_ERR("Error in setting taildrop. err=(%d)", ret); @@ -655,7 +712,7 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev, dpaa2_q->tc_index = tc_id; if (!(priv->flags & DPAA2_TX_CGR_OFF)) { - struct dpni_congestion_notification_cfg cong_notif_cfg; + struct dpni_congestion_notification_cfg cong_notif_cfg = {}; cong_notif_cfg.units = DPNI_CONGESTION_UNIT_FRAMES; cong_notif_cfg.threshold_entry = CONG_ENTER_TX_THRESHOLD; @@ -693,7 +750,28 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev, static void dpaa2_dev_rx_queue_release(void *q __rte_unused) { + struct dpaa2_queue *dpaa2_q = (struct dpaa2_queue *)q; + struct dpaa2_dev_priv *priv = dpaa2_q->eth_data->dev_private; + struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; + uint8_t options = 0; + int ret; + struct dpni_queue cfg = {}; + PMD_INIT_FUNC_TRACE(); + if (dpaa2_q->cgid != 0xff) { + options = DPNI_QUEUE_OPT_CLEAR_CGID; + cfg.cgid = dpaa2_q->cgid; + + ret = dpni_set_queue(dpni, CMD_PRI_LOW, priv->token, + DPNI_QUEUE_RX, + dpaa2_q->tc_index, dpaa2_q->flow_id, + options, &cfg); + if (ret) + DPAA2_PMD_ERR("Unable to clear CGR from q=%u err=%d", + dpaa2_q->fqid, ret); + priv->cgid_in_use[dpaa2_q->cgid] = 0; + dpaa2_q->cgid = 0xff; + } } static void @@ -2166,6 +2244,14 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) } priv->num_rx_tc = attr.num_rx_tcs; + /* only if the custom CG is enabled */ + if (attr.options & DPNI_OPT_CUSTOM_CG) + priv->max_cgs = attr.num_cgs; + else + priv->max_cgs = 0; + + for (i = 0; i < priv->max_cgs; i++) + priv->cgid_in_use[i] = 0; for (i = 0; i < attr.num_rx_tcs; i++) priv->nb_rx_queues += attr.num_queues; @@ -2173,9 +2259,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) /* Using number of TX queues as number of TX TCs */ priv->nb_tx_queues = attr.num_tx_tcs; - DPAA2_PMD_DEBUG("RX-TC= %d, nb_rx_queues= %d, nb_tx_queues=%d", + DPAA2_PMD_DEBUG("RX-TC= %d, rx_queues= %d, tx_queues=%d, max_cgs=%d", priv->num_rx_tc, priv->nb_rx_queues, - priv->nb_tx_queues); + priv->nb_tx_queues, priv->max_cgs); priv->hw = dpni_dev; priv->hw_id = hw_id; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index a991ccc1d..2f14a3525 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -37,9 +37,9 @@ #define CONG_RETRY_COUNT 18000 /* RX queue tail drop threshold - * currently considering 32 KB packets + * currently considering 64 KB packets */ -#define CONG_THRESHOLD_RX_Q (64 * 1024) +#define CONG_THRESHOLD_RX_BYTES_Q (64 * 1024) #define CONG_RX_OAL 128 /* Size of the input SMMU mapped memory required by MC */ @@ -115,6 +115,8 @@ struct dpaa2_dev_priv { uint8_t flags; /*dpaa2 config flags */ uint8_t en_ordered; uint8_t en_loose_ordered; + uint8_t max_cgs; + uint8_t cgid_in_use[MAX_RX_QUEUES]; struct pattern_s { uint8_t item_count; From patchwork Tue Aug 27 07:07:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172265 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5398592ily; Tue, 27 Aug 2019 00:11:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5487SGkYJNSPRzpnNVeSWe6UM3e/uD/Kg4jPbIW6Evi7XHWaspGsdh5yaRpbFlcM1PEpo X-Received: by 2002:a50:a7c2:: with SMTP id i60mr22632736edc.215.1566889918321; Tue, 27 Aug 2019 00:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889918; cv=none; d=google.com; s=arc-20160816; b=Q9yHIGxDu1vEL4f4MPqXM7y6pqpB7j3rTgxPrf+1GaEAYomlgf/JHstv90NBbAAk3L O4ObeP8FyIfAN7EXWDjhGQIk4Mf9t/KYKTs1XbZujGLTeY6nodrDtI9S85zfBS0W/3DY 0Zk/7gCvQJL0lEEq1BfUcYkmtuT/gEybUrmwjzZdk/VkGrNmPhwyhAV4MFz3h7r6zdYr r3g5RBWBcd8OOqxUTCALC7GxRELuNI6ghCuYN0Eu2nldMfm4nN2+01sJXTvPO68j4YA1 JJrwvNL9d0txjis5O6waJVcXJe8OfwEL3E+BD+CmBpEIf+bUHBUJAtR6a+A51giTaVM5 rR8g== 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=Q4i557/6uZtFCxxNg/+6YnFuuUcFejlKzEEVoA+a8z4=; b=0PyA9FabvIsndKLLUPPYQ63AcF/Z//YpOJTv+hR+0p0oZQnV5A+SYIKCP1D2NPuzTy ajjsdHBKAsvRszYfFKiS5U9VMdc7wSJhhleqVi2CSPZxnwUElvUtOWiYisTWGUToE8Qb dik8JaQAMBdsvBeDaI9KI8veucI/TpuYzBvVF1xAj1LoiNlRtaE83WDFsOmRsD46YsBU VU4AZPazFpZ2qDIi0P5c/YoheyH0jmTIcikj+HrMmSvQeJ1GqrtrHTTizWtYGlUMRzK7 3gZA+clKvDMVTEp2t4ounSEqqVZceeXZaF17/xF3uHZXmIUA4c019sAuXP5gEOpsUuBN esMw== 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 e35si7327904eda.401.2019.08.27.00.11.58; Tue, 27 Aug 2019 00:11:58 -0700 (PDT) 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 0F8751C12F; Tue, 27 Aug 2019 09:09:57 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 290E41BFFA for ; Tue, 27 Aug 2019 09:09:26 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 049182005B6; Tue, 27 Aug 2019 09:09:26 +0200 (CEST) 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 00909200108; Tue, 27 Aug 2019 09:09:24 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id E1F744031E; Tue, 27 Aug 2019 15:09:20 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:17 +0530 Message-Id: <20190827070730.11206-18-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 17/30] net/dpaa2: add cgr counters in xtra stats 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: Hemant Agrawal Add congestion frame drop and byte drop count in xtra stats. Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ethdev.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index b30f37ecb..259180e4f 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -84,6 +84,8 @@ static const struct rte_dpaa2_xstats_name_off dpaa2_xstats_strings[] = { {"ingress_nobuffer_discards", 2, 2}, {"egress_discarded_frames", 2, 3}, {"egress_confirmed_frames", 2, 4}, + {"cgr_reject_frames", 4, 0}, + {"cgr_reject_bytes", 4, 1}, }; static const enum rte_filter_op dpaa2_supported_filter_ops[] = { @@ -1370,7 +1372,7 @@ dpaa2_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; int32_t retcode; - union dpni_statistics value[3] = {}; + union dpni_statistics value[5] = {}; unsigned int i = 0, num = RTE_DIM(dpaa2_xstats_strings); if (n < num) @@ -1397,6 +1399,18 @@ dpaa2_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, if (retcode) goto err; + for (i = 0; i < priv->max_cgs; i++) { + if (!priv->cgid_in_use[i]) { + /* Get Counters from page_4*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, + priv->token, + 4, 0, &value[4]); + if (retcode) + goto err; + break; + } + } + for (i = 0; i < num; i++) { xstats[i].id = i; xstats[i].value = value[dpaa2_xstats_strings[i].page_id]. @@ -1438,7 +1452,7 @@ dpaa2_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, struct dpaa2_dev_priv *priv = dev->data->dev_private; struct fsl_mc_io *dpni = (struct fsl_mc_io *)priv->hw; int32_t retcode; - union dpni_statistics value[3] = {}; + union dpni_statistics value[5] = {}; if (n < stat_cnt) return stat_cnt; @@ -1464,6 +1478,12 @@ dpaa2_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, if (retcode) return 0; + /* Get Counters from page_4*/ + retcode = dpni_get_statistics(dpni, CMD_PRI_LOW, priv->token, + 4, 0, &value[4]); + if (retcode) + return 0; + for (i = 0; i < stat_cnt; i++) { values[i] = value[dpaa2_xstats_strings[i].page_id]. raw.counter[dpaa2_xstats_strings[i].stats_id]; From patchwork Tue Aug 27 07:07:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172266 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5398695ily; Tue, 27 Aug 2019 00:12:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqydCz29SnCmnHZOTjB0LKMLn+hmWk70LnegKCq8vdriY8evW0iWRfXv2XwgP5A22NFu4obH X-Received: by 2002:a17:906:4706:: with SMTP id y6mr20190995ejq.191.1566889926847; Tue, 27 Aug 2019 00:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889926; cv=none; d=google.com; s=arc-20160816; b=hqhVGjo6jgp72gTOwDJm7k02NZfCm+trnTV4aW9XeM2esgm1Y5qP7OLXXYUVEjuCth aas5WxHFrs7qccdIYmDG6Eg5cZrOk0jkRxqKAZDzg5tEDpn+t1UWNu7nHp37ScUIUix6 ioudJELy9UEsHABLk6BZva6DJw6DMyQusofkXwGuEDmxDy3TNhzlV5RvxyysnOJSJT8N 6QRnNQVZ6spDlptRlJHJyo86TRDSRn8eYkIZ0z7HyQlmZyiMPXW+Ks0H7iCqSWVVMLrT IWDRuYLsjF7g4OaeFqBDh5nCW5QP/C+eqE9ALWvafxHOP5TZc44pHZCwudMMiP9sjasa 8YSg== 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=wPNZ+Nbs0k0kbtvCswh7V7VwNINw77XLV5Vfe/nor6I=; b=i7TYkwhTBsvmBe5F7P/S/RpbDqZxjkG123k9vo2IH/CGz61UOqly/fRetwcbs54/kJ aPCRJk1nO98wM0LFbD/NZHJAza0Gm4Pzz791BLc1O8VWmA3ccJDVNXMKxLEageViHNPb ksrKqHNZBVZIfdxfIamRy98W9rSOopblxUMMwNMKT/Qm94cndsm2Hwvgsog4yscf/otG 2RUKoG3hJgKBsIkyxAHRY09Md20+V5tpeRLRH4cRKndquGqwoxhexpdvhSTw0hl7Je3o 1RtyJUsKWFRJY7KA1zzvR0xjJr5MRnre2Xv5Rx9IHHgT/bSHK52LyKX5RdVGS7AFtLGX vwbA== 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 b10si6859290ejq.174.2019.08.27.00.12.06; Tue, 27 Aug 2019 00:12:06 -0700 (PDT) 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 727B51C137; Tue, 27 Aug 2019 09:09:59 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 03FA91BFE3 for ; Tue, 27 Aug 2019 09:09:27 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id BD3B3200108; Tue, 27 Aug 2019 09:09:26 +0200 (CEST) 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 BA6102005B2; Tue, 27 Aug 2019 09:09:24 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id A7056402DE; Tue, 27 Aug 2019 15:09:21 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:18 +0530 Message-Id: <20190827070730.11206-19-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 18/30] net/dpaa2: add support for config max Rx length in HW 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: Hemant Agrawal The MC expects the length to be configured without CRC Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_ethdev.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 259180e4f..925637409 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -418,12 +418,17 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev) if (rx_offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { if (eth_conf->rxmode.max_rx_pkt_len <= DPAA2_MAX_RX_PKT_LEN) { ret = dpni_set_max_frame_length(dpni, CMD_PRI_LOW, - priv->token, eth_conf->rxmode.max_rx_pkt_len); + priv->token, eth_conf->rxmode.max_rx_pkt_len + - RTE_ETHER_CRC_LEN); if (ret) { DPAA2_PMD_ERR( "Unable to set mtu. check config"); return ret; } + dev->data->mtu = + dev->data->dev_conf.rxmode.max_rx_pkt_len - + RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN - + VLAN_TAG_SIZE; } else { return -1; } @@ -1200,7 +1205,7 @@ dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) * Maximum Ethernet header length */ ret = dpni_set_max_frame_length(dpni, CMD_PRI_LOW, priv->token, - frame_size); + frame_size - RTE_ETHER_CRC_LEN); if (ret) { DPAA2_PMD_ERR("Setting the max frame length failed"); return -1; @@ -2375,6 +2380,14 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) } } + ret = dpni_set_max_frame_length(dpni_dev, CMD_PRI_LOW, priv->token, + RTE_ETHER_MAX_LEN - RTE_ETHER_CRC_LEN + + VLAN_TAG_SIZE); + if (ret) { + DPAA2_PMD_ERR("Unable to set mtu. check config"); + goto init_err; + } + RTE_LOG(INFO, PMD, "%s: netdev created\n", eth_dev->data->name); return 0; init_err: From patchwork Tue Aug 27 07:07:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172267 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5398977ily; Tue, 27 Aug 2019 00:12:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxx4s04+t3Mnj9ac6wpiA46OafEJ01V5OVKaWJ30Gn/hd737t3RW10absOTgHgmYJ91GUzf X-Received: by 2002:a17:906:852:: with SMTP id f18mr20296226ejd.18.1566889946017; Tue, 27 Aug 2019 00:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566889946; cv=none; d=google.com; s=arc-20160816; b=mHnIaJMBMzeT+5grjrv315MZHSkEqzcG0AO7K5ZJkiZ6J1RFCqc3UCKPUr6KPqvXkl SCT90qLczVipmRlUukQ0EzZP+CEG85B3FJ+vWenS4w1+cKjHtmfaRcJ6FTVDIZhf0kr8 DfuJUmOyj7zWLoaYS6NYliBvH3+dhfqtZYZKKTkStB2AswaGvPdSAbVfbwOu+RZC+Ziw USrsjk9JrfVyTYcIXKXNnfJOnmb0ExIlLyZ8O00Ttp7GXGSi8L5myzWKOhdgjO065G28 HMsznL9AkKBCjftz1gN6j8w8a1vNdFJf16Wi/cotIqrCGek953FUJGeNDxeBFQIYTDtp KzJA== 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=yY+PbLstWWZwm2r8YxIPG6f1qjLNYEwSoK8cs88ccsk=; b=mekBnLno7bsATHcCyhuyQn66mh/XG/mPkx7ps+RNdYp93wY30l33JOnGt0Ry+II3KZ 25amKac1/zgfZG7J5rjsWQQ8d3swGfvs3vB8OFIagLinFnkXTVCjRLQaYF5/O5uEpNuX 0ahiXDR6AalD6Xot88frSvw6D0HSoSdrB2TUepaK90Jj1q+xYTFQNBkzy8Lnox5UfDpV xpZlhsoiMLGtmQLXXA7AebIzBau4LyOHQPJHbztAQM1zRMDplkUMgz9Z7Jehe98gH3Gb F2KsOAv5m2gGOYvsXQC3e4mR0Rdocj+aPRp2N4K+1vUdqXpVyCyuj1TbwbJXqxerO8yK JjVQ== 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 s8si6805598ejo.45.2019.08.27.00.12.25; Tue, 27 Aug 2019 00:12:26 -0700 (PDT) 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 C28FE1C194; Tue, 27 Aug 2019 09:10:06 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id A4F7B1BFE3 for ; Tue, 27 Aug 2019 09:09:28 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 8523E1A0586; Tue, 27 Aug 2019 09:09:28 +0200 (CEST) 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 4DAF71A05A4; Tue, 27 Aug 2019 09:09:26 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 32B2E402EB; Tue, 27 Aug 2019 15:09:23 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:20 +0530 Message-Id: <20190827070730.11206-21-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 20/30] net/dpaa2: support dpdmux classification on eth type 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: Hemant Agrawal Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_mux.c | 84 +++++++++++++++++++++++------------ 1 file changed, 55 insertions(+), 29 deletions(-) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c index e487c6b54..1910cc418 100644 --- a/drivers/net/dpaa2/dpaa2_mux.c +++ b/drivers/net/dpaa2/dpaa2_mux.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: BSD-3-Clause - * Copyright 2018 NXP + * Copyright 2018-2019 NXP */ #include @@ -60,19 +60,13 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, { struct dpaa2_dpdmux_dev *dpdmux_dev; struct dpkg_profile_cfg kg_cfg; - const struct rte_flow_item_ipv4 *spec; const struct rte_flow_action_vf *vf_conf; struct dpdmux_cls_action dpdmux_action; struct rte_flow *flow = NULL; void *key_iova, *mask_iova, *key_cfg_iova = NULL; + uint8_t key_size = 0; int ret; - if (pattern[0]->type != RTE_FLOW_ITEM_TYPE_IPV4) { - DPAA2_PMD_ERR("Not supported pattern type: %d", - pattern[0]->type); - return NULL; - } - /* Find the DPDMUX from dpdmux_id in our list */ dpdmux_dev = get_dpdmux_from_id(dpdmux_id); if (!dpdmux_dev) { @@ -86,16 +80,63 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, DPAA2_PMD_ERR("Unable to allocate flow-dist parameters"); return NULL; } + flow = rte_zmalloc(NULL, sizeof(struct rte_flow) + + (2 * DIST_PARAM_IOVA_SIZE), RTE_CACHE_LINE_SIZE); + if (!flow) { + DPAA2_PMD_ERR( + "Memory allocation failure for rule configration\n"); + goto creation_error; + } + key_iova = (void *)((size_t)flow + sizeof(struct rte_flow)); + mask_iova = (void *)((size_t)key_iova + DIST_PARAM_IOVA_SIZE); /* Currently taking only IP protocol as an extract type. * This can be exended to other fields using pattern->type. */ memset(&kg_cfg, 0, sizeof(struct dpkg_profile_cfg)); - kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_IP; - kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_IP_PROTO; - kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR; - kg_cfg.extracts[0].extract.from_hdr.type = DPKG_FULL_FIELD; - kg_cfg.num_extracts = 1; + + switch (pattern[0]->type) { + case RTE_FLOW_ITEM_TYPE_IPV4: + { + const struct rte_flow_item_ipv4 *spec; + kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_IP; + kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_IP_PROTO; + kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR; + kg_cfg.extracts[0].extract.from_hdr.type = DPKG_FULL_FIELD; + kg_cfg.num_extracts = 1; + + spec = (const struct rte_flow_item_ipv4 *)pattern[0]->spec; + memcpy(key_iova, (const void *)(&spec->hdr.next_proto_id), + sizeof(uint8_t)); + memcpy(mask_iova, pattern[0]->mask, sizeof(uint8_t)); + key_size = sizeof(uint8_t); + } + break; + + case RTE_FLOW_ITEM_TYPE_ETH: + { + const struct rte_flow_item_eth *spec; + uint16_t eth_type; + kg_cfg.extracts[0].extract.from_hdr.prot = NET_PROT_ETH; + kg_cfg.extracts[0].extract.from_hdr.field = NH_FLD_ETH_TYPE; + kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_HDR; + kg_cfg.extracts[0].extract.from_hdr.type = DPKG_FULL_FIELD; + kg_cfg.num_extracts = 1; + + spec = (const struct rte_flow_item_eth *)pattern[0]->spec; + eth_type = rte_constant_bswap16(spec->type); + memcpy((void *)key_iova, (const void *)ð_type, + sizeof(rte_be16_t)); + memcpy(mask_iova, pattern[0]->mask, sizeof(uint16_t)); + key_size = sizeof(uint16_t); + } + break; + + default: + DPAA2_PMD_ERR("Not supported pattern type: %d", + pattern[0]->type); + goto creation_error; + } ret = dpkg_prepare_key_cfg(&kg_cfg, key_cfg_iova); if (ret) { @@ -114,24 +155,9 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, /* As now our key extract parameters are set, let us configure * the rule. */ - flow = rte_zmalloc(NULL, sizeof(struct rte_flow) + - (2 * DIST_PARAM_IOVA_SIZE), RTE_CACHE_LINE_SIZE); - if (!flow) { - DPAA2_PMD_ERR( - "Memory allocation failure for rule configration\n"); - goto creation_error; - } - key_iova = (void *)((size_t)flow + sizeof(struct rte_flow)); - mask_iova = (void *)((size_t)key_iova + DIST_PARAM_IOVA_SIZE); - - spec = (const struct rte_flow_item_ipv4 *)pattern[0]->spec; - memcpy(key_iova, (const void *)&spec->hdr.next_proto_id, - sizeof(uint8_t)); - memcpy(mask_iova, pattern[0]->mask, sizeof(uint8_t)); - flow->rule.key_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(key_iova)); flow->rule.mask_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(mask_iova)); - flow->rule.key_size = sizeof(uint8_t); + flow->rule.key_size = key_size; vf_conf = (const struct rte_flow_action_vf *)(actions[0]->conf); if (vf_conf->id == 0 || vf_conf->id > dpdmux_dev->num_ifs) { From patchwork Tue Aug 27 07:07:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Saxena X-Patchwork-Id: 172268 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp5400062ily; Tue, 27 Aug 2019 00:13:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfdlO/LjJYgbNjAxX/Yl2gpNd/SNl9kWmIxY0HBIWy+wQiVlKsAO38T9KOw363GpbqhwDf X-Received: by 2002:a50:ba81:: with SMTP id x1mr22263255ede.257.1566890021030; Tue, 27 Aug 2019 00:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566890021; cv=none; d=google.com; s=arc-20160816; b=KDl9ObG7FmamulYHWaCaw1fDQ7AEqi7dDMAIu1QtrqpARbLr1Gl6zNlkdtvxwG17Pp 7tZebpPcDdbI/u+ESDnwoxJOKCMNNtLZdfmABGgc2VVLvPHHNMrTCOhBKMsUAI5iFcEc bU077O6ZEdB96ooNpVTxXaYIEAjLnaylFDTix9C8Yfj2So1NjVoX1OqbKtmS0hZXWx/5 TObzfVKGAEhevt60DUtHClDVdySZi4Ke9XjRIKPMv66jCa+/88BeeYTc8tJdL9xrLIfw f2EYZ240sLafbjfq/PcpkwXqFzAoktQqa8FqulQMaNk9CSfg55dehI7thNGE0eF/HRMs w0XQ== 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=IVGEE/uHG0aBqpwR/fdFEGNJGzPcQOSUx1yVRHtdRT0=; b=0pXzXqlEb0fxiltvlb6Q042XhiguozzgXbgACs+bsWQ1EJ7Yq51NZJgDKvv5IVNDNi lHFyCTG6Tqv/JlkBg3W5kB1hnuuV7+nKJj5m0LVU76KWnIBGc/d/Y5xkTVs0qqhK9875 m9qp1vYTgzuUC5XTdNIUkmeK/Pg1B3/Yxzas7Cbzh3Lw+F9nJJjlfTtz/CzvCdG3Ux+4 wCzmHpYxq9k2j/czovuV3XFhN6Xg1aIIZ7OxqsoYKrTOO99+cCAON44e2W4oAIkceR2X NBk9KGr+oqbPm9kjJpX0ggfAGSf+AJ56ikfsdyqQMRy+2q9KHDzjhq3U1UoZDyyz+LUK rbpQ== 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 l23si7360277edv.296.2019.08.27.00.13.40; Tue, 27 Aug 2019 00:13:41 -0700 (PDT) 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 B24E91C1DB; Tue, 27 Aug 2019 09:10:37 +0200 (CEST) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by dpdk.org (Postfix) with ESMTP id 2598F1C034 for ; Tue, 27 Aug 2019 09:09:34 +0200 (CEST) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0B4A21A020A; Tue, 27 Aug 2019 09:09:34 +0200 (CEST) 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 C688F1A021C; Tue, 27 Aug 2019 09:09:31 +0200 (CEST) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B427B402EB; Tue, 27 Aug 2019 15:09:28 +0800 (SGT) From: Sachin Saxena To: dev@dpdk.org Cc: thomas@monjalon.net, Hemant Agrawal Date: Tue, 27 Aug 2019 12:37:27 +0530 Message-Id: <20190827070730.11206-28-sachin.saxena@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190827070730.11206-1-sachin.saxena@nxp.com> References: <20190827070730.11206-1-sachin.saxena@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v1 27/30] bus/fslmc: support multi vfio group 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: Hemant Agrawal DPAA2 support VFIO device passthrough in VM. However in this case, each device is associated with different vfio group. This code required different container id for each group. On using the same container fd the second time, ioctl calls are returning error. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/fslmc_bus.c | 7 +- drivers/bus/fslmc/fslmc_vfio.c | 160 ++++++++++++++++++++++++++------- drivers/bus/fslmc/fslmc_vfio.h | 3 + 3 files changed, 133 insertions(+), 37 deletions(-) -- 2.17.1 diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index 9226d5b62..eff15f25d 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright 2016,2018 NXP + * Copyright 2016,2018-2019 NXP * */ @@ -325,8 +325,7 @@ rte_fslmc_scan(void) goto scan_fail; /* Scan devices on the group */ - snprintf(fslmc_dirpath, sizeof(fslmc_dirpath), "%s/%d/devices", - VFIO_IOMMU_GROUP_PATH, groupid); + sprintf(fslmc_dirpath, "%s/%s", SYSFS_FSL_MC_DEVICES, fslmc_container); dir = opendir(fslmc_dirpath); if (!dir) { DPAA2_BUS_ERR("Unable to open VFIO group directory"); @@ -334,7 +333,7 @@ rte_fslmc_scan(void) } while ((entry = readdir(dir)) != NULL) { - if (entry->d_name[0] == '.' || entry->d_type != DT_LNK) + if (entry->d_name[0] == '.' || entry->d_type != DT_DIR) continue; ret = scan_one_fslmc_device(entry->d_name); diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 60c51d80e..970969d2b 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -40,16 +40,13 @@ #include "portal/dpaa2_hw_pvt.h" #include "portal/dpaa2_hw_dpio.h" -/** Pathname of FSL-MC devices directory. */ -#define SYSFS_FSL_MC_DEVICES "/sys/bus/fsl-mc/devices" - #define FSLMC_CONTAINER_MAX_LEN 8 /**< Of the format dprc.XX */ /* Number of VFIO containers & groups with in */ static struct fslmc_vfio_group vfio_group; static struct fslmc_vfio_container vfio_container; static int container_device_fd; -static char *fslmc_container; +char *fslmc_container; static int fslmc_iommu_type; static uint32_t *msi_intr_vaddr; void *(*rte_mcp_ptr_list); @@ -435,28 +432,136 @@ int rte_fslmc_vfio_dmamap(void) return 0; } -static int64_t vfio_map_mcp_obj(struct fslmc_vfio_group *group, char *mcp_obj) +static int +fslmc_vfio_setup_device(const char *sysfs_base, const char *dev_addr, + int *vfio_dev_fd, struct vfio_device_info *device_info) +{ + struct vfio_group_status group_status = { + .argsz = sizeof(group_status) + }; + int vfio_group_fd, vfio_container_fd, iommu_group_no, ret; + + /* get group number */ + ret = rte_vfio_get_group_num(sysfs_base, dev_addr, &iommu_group_no); + if (ret < 0) + return -1; + + /* get the actual group fd */ + vfio_group_fd = rte_vfio_get_group_fd(iommu_group_no); + if (vfio_group_fd < 0) + return -1; + + /* if group_fd == 0, that means the device isn't managed by VFIO */ + if (vfio_group_fd == 0) { + RTE_LOG(WARNING, EAL, " %s not managed by VFIO driver, skipping\n", + dev_addr); + return 1; + } + + /* Opens main vfio file descriptor which represents the "container" */ + vfio_container_fd = rte_vfio_get_container_fd(); + if (vfio_container_fd < 0) { + DPAA2_BUS_ERR("Failed to open VFIO container"); + return -errno; + } + + /* check if the group is viable */ + ret = ioctl(vfio_group_fd, VFIO_GROUP_GET_STATUS, &group_status); + if (ret) { + DPAA2_BUS_ERR(" %s cannot get group status, " + "error %i (%s)\n", dev_addr, + errno, strerror(errno)); + close(vfio_group_fd); + rte_vfio_clear_group(vfio_group_fd); + return -1; + } else if (!(group_status.flags & VFIO_GROUP_FLAGS_VIABLE)) { + DPAA2_BUS_ERR(" %s VFIO group is not viable!\n", dev_addr); + close(vfio_group_fd); + rte_vfio_clear_group(vfio_group_fd); + return -1; + } + /* At this point, we know that this group is viable (meaning, + * all devices are either bound to VFIO or not bound to anything) + */ + + /* check if group does not have a container yet */ + if (!(group_status.flags & VFIO_GROUP_FLAGS_CONTAINER_SET)) { + + /* add group to a container */ + ret = ioctl(vfio_group_fd, VFIO_GROUP_SET_CONTAINER, + &vfio_container_fd); + if (ret) { + DPAA2_BUS_ERR(" %s cannot add VFIO group to container, " + "error %i (%s)\n", dev_addr, + errno, strerror(errno)); + close(vfio_group_fd); + close(vfio_container_fd); + rte_vfio_clear_group(vfio_group_fd); + return -1; + } + + /* + * set an IOMMU type for container + * + */ + if (ioctl(vfio_container_fd, VFIO_CHECK_EXTENSION, + fslmc_iommu_type)) { + ret = ioctl(vfio_container_fd, VFIO_SET_IOMMU, + fslmc_iommu_type); + if (ret) { + DPAA2_BUS_ERR("Failed to setup VFIO iommu"); + close(vfio_group_fd); + close(vfio_container_fd); + return -errno; + } + } else { + DPAA2_BUS_ERR("No supported IOMMU available"); + close(vfio_group_fd); + close(vfio_container_fd); + return -EINVAL; + } + } + + /* get a file descriptor for the device */ + *vfio_dev_fd = ioctl(vfio_group_fd, VFIO_GROUP_GET_DEVICE_FD, dev_addr); + if (*vfio_dev_fd < 0) { + /* if we cannot get a device fd, this implies a problem with + * the VFIO group or the container not having IOMMU configured. + */ + + DPAA2_BUS_WARN("Getting a vfio_dev_fd for %s failed", dev_addr); + close(vfio_group_fd); + close(vfio_container_fd); + rte_vfio_clear_group(vfio_group_fd); + return -1; + } + + /* test and setup the device */ + ret = ioctl(*vfio_dev_fd, VFIO_DEVICE_GET_INFO, device_info); + if (ret) { + DPAA2_BUS_ERR(" %s cannot get device info, error %i (%s)", + dev_addr, errno, strerror(errno)); + close(*vfio_dev_fd); + close(vfio_group_fd); + close(vfio_container_fd); + rte_vfio_clear_group(vfio_group_fd); + return -1; + } + + return 0; +} + +static intptr_t vfio_map_mcp_obj(const char *mcp_obj) { intptr_t v_addr = (intptr_t)MAP_FAILED; int32_t ret, mc_fd; + struct vfio_group_status status = { .argsz = sizeof(status) }; struct vfio_device_info d_info = { .argsz = sizeof(d_info) }; struct vfio_region_info reg_info = { .argsz = sizeof(reg_info) }; - /* getting the mcp object's fd*/ - mc_fd = ioctl(group->fd, VFIO_GROUP_GET_DEVICE_FD, mcp_obj); - if (mc_fd < 0) { - DPAA2_BUS_ERR("Error in VFIO get dev %s fd from group %d", - mcp_obj, group->fd); - return v_addr; - } - - /* getting device info*/ - ret = ioctl(mc_fd, VFIO_DEVICE_GET_INFO, &d_info); - if (ret < 0) { - DPAA2_BUS_ERR("Error in VFIO getting DEVICE_INFO"); - goto MC_FAILURE; - } + fslmc_vfio_setup_device(SYSFS_FSL_MC_DEVICES, mcp_obj, + &mc_fd, &d_info); /* getting device region info*/ ret = ioctl(mc_fd, VFIO_DEVICE_GET_REGION_INFO, ®_info); @@ -589,19 +694,8 @@ fslmc_process_iodevices(struct rte_dpaa2_device *dev) struct vfio_device_info device_info = { .argsz = sizeof(device_info) }; struct rte_dpaa2_object *object = NULL; - dev_fd = ioctl(vfio_group.fd, VFIO_GROUP_GET_DEVICE_FD, - dev->device.name); - if (dev_fd <= 0) { - DPAA2_BUS_ERR("Unable to obtain device FD for device:%s", - dev->device.name); - return -1; - } - - if (ioctl(dev_fd, VFIO_DEVICE_GET_INFO, &device_info)) { - DPAA2_BUS_ERR("Unable to obtain information for device:%s", - dev->device.name); - return -1; - } + fslmc_vfio_setup_device(SYSFS_FSL_MC_DEVICES, dev->device.name, + &dev_fd, &device_info); switch (dev->dev_type) { case DPAA2_ETH: @@ -654,7 +748,7 @@ fslmc_process_mcp(struct rte_dpaa2_device *dev) goto cleanup; } - v_addr = vfio_map_mcp_obj(&vfio_group, dev_name); + v_addr = vfio_map_mcp_obj(dev->device.name); if (v_addr == (intptr_t)MAP_FAILED) { DPAA2_BUS_ERR("Error mapping region (errno = %d)", errno); ret = -1; diff --git a/drivers/bus/fslmc/fslmc_vfio.h b/drivers/bus/fslmc/fslmc_vfio.h index e877255ea..c98812129 100644 --- a/drivers/bus/fslmc/fslmc_vfio.h +++ b/drivers/bus/fslmc/fslmc_vfio.h @@ -10,6 +10,8 @@ #include +/* Pathname of FSL-MC devices directory. */ +#define SYSFS_FSL_MC_DEVICES "/sys/bus/fsl-mc/devices" #define DPAA2_MC_DPNI_DEVID 7 #define DPAA2_MC_DPSECI_DEVID 3 #define DPAA2_MC_DPCON_DEVID 5 @@ -38,6 +40,7 @@ typedef struct fslmc_vfio_container { struct fslmc_vfio_group *group; } fslmc_vfio_container; +extern char *fslmc_container; int rte_dpaa2_intr_enable(struct rte_intr_handle *intr_handle, int index); int rte_dpaa2_intr_disable(struct rte_intr_handle *intr_handle, int index);