From patchwork Wed Dec 13 12:05:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 121744 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5383339qgn; Wed, 13 Dec 2017 04:08:05 -0800 (PST) X-Google-Smtp-Source: ACJfBov2BhAiweU43XoMQKP5DCZM0axeDCR8uANF+FouB16/lAkphNYwRSPfgNMk7ZhH11e5Oj1M X-Received: by 10.223.133.198 with SMTP id 6mr2091282wru.199.1513166885577; Wed, 13 Dec 2017 04:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513166885; cv=none; d=google.com; s=arc-20160816; b=CpPSuPLHWe65LBYSJIqzpZtR4Su/SKFSWvEMlTToE0XKLkV4nMXc7MLgyXGwVdk4bH mWnBma6cemydYKLX5sDX4TOqBTy7Aj6lmMZJR6ILB+ibO+Y/Jld4u15X7B/GbJubW0ed qx5rzFxlYOeMRoRtXnJWfLDlraXN1uYg77M1fItuF0VOovMmGrXbTHp6M//iQUzrdh+p ucB+q0/FYFis3JWQV5Ql7KTbLreCtIPPPlV/XSpDET7bGlZzASzTBqsUe09EzUzloNdp PXApa47QknW8SoS/3eOsrTSjMUNqX2FOongzR/p/T6pM0ZuHcSNmBub73dyTUK1b3Y/e SyEQ== 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:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=wjOE1DQcz5ZyDrJ3oIpAwporrP1ZcWMPXp1WPe8rSI0=; b=cVMSzfXvKSD3/5Fd+XckNZXO5kA3IKoAigs+zOctGXJdeMb4YqjvvK3EyGXizqT3XW VORQkQqP94gia3rdFwIQc3V6llU2OSC3Dw+sfI+dgQ4zGwc84qzOKe5lchR7lOd8T03D IDnO8rlIbM6pS+b4HSo3/PqAhrGcnHl9uMNZsBAGvYhTMHnuosSarWLyoHiE2USLAWFw UrF+KvQVVMqoJ3cFapwGQ2X7JS7VAAQkFjXSwEWxFxkK0vlUqfih4DU832/4SWtj072L vNm0fabOjHHY1T2/4bT+QkH3HuCIKaKuQM+ozCwOcdo4CUaR968BXOpgHUA4tQ804YOa tnSA== 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 o126si1361206wmg.247.2017.12.13.04.08.05; Wed, 13 Dec 2017 04:08:05 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7EE1E1B159; Wed, 13 Dec 2017 13:07:13 +0100 (CET) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0049.outbound.protection.outlook.com [104.47.38.49]) by dpdk.org (Postfix) with ESMTP id B01831AEF5 for ; Wed, 13 Dec 2017 13:07:09 +0100 (CET) Received: from BN6PR03CA0088.namprd03.prod.outlook.com (10.164.122.154) by MWHPR03MB2704.namprd03.prod.outlook.com (10.168.207.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Wed, 13 Dec 2017 12:07:08 +0000 Received: from BN1AFFO11FD008.protection.gbl (2a01:111:f400:7c10::112) by BN6PR03CA0088.outlook.office365.com (2603:10b6:405:6f::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Wed, 13 Dec 2017 12:07:08 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; intel.com; dkim=none (message not signed) header.d=none; intel.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD008.mail.protection.outlook.com (10.58.52.68) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.282.5 via Frontend Transport; Wed, 13 Dec 2017 12:07:01 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vBDC6t9Q008652; Wed, 13 Dec 2017 05:07:06 -0700 From: Hemant Agrawal To: CC: Date: Wed, 13 Dec 2017 17:35:47 +0530 Message-ID: <1513166759-13466-7-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513166759-13466-1-git-send-email-hemant.agrawal@nxp.com> References: <1513166759-13466-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131576404216294117; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(39380400002)(376002)(39860400002)(346002)(2980300002)(1109001)(1110001)(339900001)(3190300001)(189003)(199004)(2351001)(77096006)(106466001)(36756003)(2906002)(105606002)(53936002)(76176011)(86362001)(50226002)(8936002)(50466002)(48376002)(59450400001)(47776003)(305945005)(16586007)(85426001)(5660300001)(81166006)(81156014)(356003)(68736007)(498600001)(51416003)(6666003)(97736004)(316002)(8676002)(2950100002)(104016004)(4326008)(6916009); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2704; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD008; 1:d0j6LwrFug3phdgTT1HSD85e0CpdaafwNprHVm2+ovniOFU0x4A8iCsrMtxSSNWwsVm3zoOau1say6w4dMDFigii/dA2b9GiNYkMx4xgh5KyZ8F/RUlMgshGxc++qW9Y MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 745d40a8-0179-479c-aae5-08d542220499 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:MWHPR03MB2704; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 3:/nLrU2hDtY9wZ7t9TmsADT2RplUCToCeyOcGYUhGSVDEiIp3twozLU9U94qO2QGGvDji8vNKOTadSXPXI5AiB5UbsWqTeSBpxhzMNiWwddU0RCzosis7BLUs7Y9/f2tdDFU5NF6A725I0jJ2fumu50V5O22X7H4ieUpxaBHcr4Z6iaAyR0pI2BUpbdSjxF8/nCsgpCDJtaPFNgNsho7la6pvXVpuFR5gf7xh5wMdJBcC6WXQCH1zcmK9kjxdFD2Xn26Bt1mTx0v2aPk3QUS6sRt7b95H//Y4Zg02yUtUGQ99tpThUgQGtxgPATBNfC6umZqy9sBwECMG9w+pdWnVqCgFxxPtd+5GLHaeHCsK2+o=; 25:kkXc3CDM9toxNMuUVTikiuURJyxPpEXTljia8rawwcWKHxl5zkUoz7dOq8b/LIvFFWsG567pvGpoeCob0Oks1L0HV1Mc7ImVBOSDDGaWOwyVbi6rGgXpnpu81U/m4yBN8ejaX5iF2JkLOUVRv1zubDnCc7An9d75Zk6rkZR6LpgEJYDAysUSpiVPysi3TCVEbY/QErVMrJzxzlVWbqM6+QRzBNQDL3VV/dZCrFAoh78nCaIHszLSELKOo9zt6W+iQPX0vi/wIrB2hviNJN6/u2YbBfgv8M7rrDqmWF9v8TO2/rnoUeEcbhGCndym73byqLxKxQ/gmBTWmgWSSAL5YRghqFOQwAnb8BOe7mGOHF8= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR03MB2704: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 31:jLii7r0xY6cBy0C65AsgZSDhV/GodSEbPRlpwp0JRzoLsmfdlGW1vcRV1SY31vlQTfEvA7TD/IWiqHVDxgwnM604q81/i1jLsJlf93a3zgaUgNI0XX0FdTo2/o8muW50hNDtxPLaO8BpC6LxDm6DVjeZ9l9E74KNTDaTeblCoPMMQk5OkPfxOMI2ThMwt5uAQA+jQ4m4PjT/fVRj/vU8tns0TqZK8YZIatppOB3c+bk=; 4:IZiNaZ3/wedUSvt7XKgd0BGACL2zcxc2svplhydom36vX1ZwRrdSh6IaXqNVDsCH2xn/AwGD1jVurecS4TH9OJll/zExJCeRtLhhhY/HL+ZRJhRLZSoPD79vJEjOuhYlJGfYLT4Nqs1wRyKr4+8dGyFr4u8daS9K9FiwZI1mGmobcogD2BCn7zVPo/T+71FS7ndQUhPQzTIQ9t7OIrhGx88CrBMtvEZZvdg7bz8xE6ixNiuLbtA115l3dTW2YOR66FHMhd3iy8Q2D1yu0jKtG7uEYkww7dTOkOq6v4Kb5oKYM7fkYvkB1tZlYPT02iAqzTV58PNiF2/irnacqb++Ow== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123561025)(20161123559100)(20161123556025)(20161123565025)(20161123563025)(201708071742011); SRVR:MWHPR03MB2704; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2704; X-Forefront-PRVS: 052017CAF1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2704; 23:UKIrdaP36bjsV9r0ZS2huoLjE5+TYt2pNGsfgi7Fs?= leLq1K8PO/an9BKtn3MOHMqGEX6Kp6Wi0NZhvmbY/lAS8An4aPbOInitD9gUbV9GZ+19ULwbnDFYXOo4QO1j/qfbmZoI07LQ9Ou6Ecu+knnTRdnK/sm4LJA0a7kOGAxLlmFx50zSBwnGCZ0mC4TnIfBA78tuSF8EekqWGXCSKPqL8W3X55sPOWqvk2rbzmCSQjtCjNE/CfsNNw9+pNiTAFtpIdw09sVZRXepEG2KDIZxZf7nlr4g3qdo7MJJWBMvaNrD1VnDNBGe5qF7Qn3IV9vuD8eO03Mr8N6gdSU8yblcd1kqlvRLDLyFaTnAOR2ZDZeu/fdf5ConA3H4Lx4wxqCRUJKQjPYkMbnEoX2DOiOq5IAfYi69g5Cc0KKJnJ5vRWr7K91GQFwDdQSFMYlYqt06reQ6b0dYvIbgRullUwrX2Q8KzUZCQFfGRRuikmaE8bC2SCfy7NEMo6dfMW10xwH9k11cDNmXa4G6MFUVf6L9qgLXVp9VXeQIkH462UwolF9YGfWzZqJEoPFeZq4Z57TEnwlZ0JGa0rCz0DBydjhOQcYG16yCekJ7e2MYXawPdy52GsZKYuJo+bMC6gfo4EpKxf9yT0aJzu78Ahl7t+djAs0CUNfP/uh//2s6b6vCi2r1gdDym5wPLa4aVAieeNfxb/lIVfq3J70jGgGsGKiTC7hkvlrqdGYSwinHdU5PMJ9qbAvxNoDyyp+np7h9AFafRehcjKidVUG5rKS3d3YeygYMGrndpKbYVvRW0c8CHcDndK3Y5CKrrseVkFFJPU/1cr1Amg2Digx90tyJqyqZhzQBMb6hDCRbZ2djv0t6DRJao4RV6ehZfah9e0CnfajCApwKSWX+KAl0vE0XcfLRmHgXzXwacOf51wVwdBdqf77rnxC7+3Yi1CYQkBfa3UKO0/q4+qpY6/zvYPyFy7og5LAiP6wfIaopae5wYhq/pAOwPg2/Ekj+Xp0OkCRmDY61JrLDwhLA3ID3qQt0HURpK4xvcyi6SaDB8VI42Wx7DQFbwKI65zS1ShE0O0IpHmw X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2704; 6:jiZ8zu/pvW1JAwWJ07ubEE3RJijoToHNS4kCEijj/xTMK8Eeq48+7I+fX79Zzq2+s2RVLgef3KkSVNE9ohE/hovM1VGUS28lmvnfHfsXlvidZuSYdwqcyA+QAgXHOcJxuwdg/cPV99evUwynqcYZEF/2qc8hEKC3B+AFzUj/3h5srs4TdXYsnuMm7Fx4XWvO0lfvsw7TprhQSxWX1Zivx+RpEaD2+uKj0Izte8p2SVvg4FwhCDxLJFXHxgKVUobGo6j+9uJZQ5hbDfqophzTmX+EG7Xk6Vuo/yNDhORCyt4EQ1DOLIIq830AvUwuixOCEKgoiRoRP+DG1zim9hjSUMWwhJ+CJjJEW75a7H4osqM=; 5:/LFPSS+bUkJQFyftOcMQ+q1tzrg5S3eI7gc8xB0JSUM8Kna7Nud3oDtJM84hOXUsIZYM4a3+HesjwqSobr9e2AzvreY9tUiY/zlCrrPNOe9z7PCdxoXw2ztFvlG5tyrG4V85qM+RbfRM5suwQcB4wtD8TSORu3V15+BWC6kobdw=; 24:u0pXxb2cHhO2+K3vy5FASJeEP+1kmowfk1gz398f9I2TH/70fCL6BrGkJZ9U8JTmRouQ/XRPkHLqwnx/s+tUsoN5MkdFOK++LlfhCANIjy4=; 7:LCwDJTBCYCFuqL5ED7InDkxS7oRC68dmSB4DupnvrEBUwUHcXAmyKqJF+rgGQ8CJp2n5rTxbgEV5jf3l/o6l3Km64eGax4lzXy6BtMTtb/gFg1I8Qr5Wvf2EEEyf8CUo+x0pHiJyd737kMcy0btEx4FowAlgDQB6drL9GAl1l134lA1E58reaNwQf+Alre6h9hy2DP/KdIFPmG0smGeT+WEDzkZu3UwTXHLXY/fx7c7xVNgMXmgMq04TRjm3f00x SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2017 12:07:01.4578 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 745d40a8-0179-479c-aae5-08d542220499 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2704 Subject: [dpdk-dev] [PATCH 06/18] net/dpaa: add frame count based tail drop with CGR 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" Replace the byte based tail queue congestion support with frame count based congestion groups. It can easily map to number of RX descriptors for a queue. Signed-off-by: Hemant Agrawal --- drivers/bus/dpaa/rte_bus_dpaa_version.map | 5 ++ drivers/net/dpaa/dpaa_ethdev.c | 98 +++++++++++++++++++++++++++---- drivers/net/dpaa/dpaa_ethdev.h | 8 +-- 3 files changed, 97 insertions(+), 14 deletions(-) -- 2.7.4 diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map index eeeb458..f412362 100644 --- a/drivers/bus/dpaa/rte_bus_dpaa_version.map +++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map @@ -69,6 +69,11 @@ DPDK_18.02 { global: dpaa_svr_family; + qman_alloc_cgrid_range; + qman_create_cgr; + qman_delete_cgr; + qman_modify_cgr; + qman_release_cgrid_range; local: *; } DPDK_17.11; diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c index adcc219..6482998 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -73,6 +73,9 @@ /* Keep track of whether QMAN and BMAN have been globally initialized */ static int is_global_init; +/* Per FQ Taildrop in frame count */ +static unsigned int td_threshold = CGR_RX_PERFQ_THRESH; + struct rte_dpaa_xstats_name_off { char name[RTE_ETH_XSTATS_NAME_SIZE]; uint32_t offset; @@ -447,12 +450,13 @@ static void dpaa_eth_multicast_disable(struct rte_eth_dev *dev) static int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, - uint16_t nb_desc __rte_unused, + uint16_t nb_desc, unsigned int socket_id __rte_unused, const struct rte_eth_rxconf *rx_conf __rte_unused, struct rte_mempool *mp) { struct dpaa_if *dpaa_intf = dev->data->dev_private; + struct qman_fq *rxq = &dpaa_intf->rx_queues[queue_idx]; PMD_INIT_FUNC_TRACE(); @@ -488,7 +492,23 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, dpaa_intf->name, fd_offset, fman_if_get_fdoff(dpaa_intf->fif)); } - dev->data->rx_queues[queue_idx] = &dpaa_intf->rx_queues[queue_idx]; + + dev->data->rx_queues[queue_idx] = rxq; + + /* configure the CGR size as per the desc size */ + if (dpaa_intf->cgr_rx) { + struct qm_mcc_initcgr cgr_opts = {0}; + int ret; + + /* Enable tail drop with cgr on this queue */ + qm_cgr_cs_thres_set64(&cgr_opts.cgr.cs_thres, nb_desc, 0); + ret = qman_modify_cgr(dpaa_intf->cgr_rx, 0, &cgr_opts); + if (ret) { + DPAA_PMD_WARN( + "rx taildrop modify fail on fqid %d (ret=%d)", + rxq->fqid, ret); + } + } return 0; } @@ -724,11 +744,21 @@ static int dpaa_fc_set_default(struct dpaa_if *dpaa_intf) } /* Initialise an Rx FQ */ -static int dpaa_rx_queue_init(struct qman_fq *fq, +static int dpaa_rx_queue_init(struct qman_fq *fq, struct qman_cgr *cgr_rx, uint32_t fqid) { struct qm_mcc_initfq opts = {0}; int ret; + u32 flags = 0; + struct qm_mcc_initcgr cgr_opts = { + .we_mask = QM_CGR_WE_CS_THRES | + QM_CGR_WE_CSTD_EN | + QM_CGR_WE_MODE, + .cgr = { + .cstd_en = QM_CGR_EN, + .mode = QMAN_CGR_MODE_FRAME + } + }; PMD_INIT_FUNC_TRACE(); @@ -758,12 +788,24 @@ static int dpaa_rx_queue_init(struct qman_fq *fq, opts.fqd.context_a.stashing.data_cl = DPAA_IF_RX_DATA_STASH; opts.fqd.context_a.stashing.context_cl = DPAA_IF_RX_CONTEXT_STASH; - /*Enable tail drop */ - opts.we_mask = opts.we_mask | QM_INITFQ_WE_TDTHRESH; - opts.fqd.fq_ctrl = opts.fqd.fq_ctrl | QM_FQCTRL_TDE; - qm_fqd_taildrop_set(&opts.fqd.td, CONG_THRESHOLD_RX_Q, 1); - - ret = qman_init_fq(fq, 0, &opts); + if (cgr_rx) { + /* Enable tail drop with cgr on this queue */ + qm_cgr_cs_thres_set64(&cgr_opts.cgr.cs_thres, td_threshold, 0); + cgr_rx->cb = NULL; + ret = qman_create_cgr(cgr_rx, QMAN_CGR_FLAG_USE_INIT, + &cgr_opts); + if (ret) { + DPAA_PMD_WARN( + "rx taildrop init fail on rx fqid %d (ret=%d)", + fqid, ret); + goto without_cgr; + } + opts.we_mask |= QM_INITFQ_WE_CGID; + opts.fqd.cgid = cgr_rx->cgrid; + opts.fqd.fq_ctrl |= QM_FQCTRL_CGE; + } +without_cgr: + ret = qman_init_fq(fq, flags, &opts); if (ret) DPAA_PMD_ERR("init rx fqid %d failed with ret: %d", fqid, ret); return ret; @@ -845,6 +887,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) struct fm_eth_port_cfg *cfg; struct fman_if *fman_intf; struct fman_if_bpool *bp, *tmp_bp; + uint32_t cgrid[DPAA_MAX_NUM_PCD_QUEUES]; PMD_INIT_FUNC_TRACE(); @@ -881,10 +924,31 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) dpaa_intf->rx_queues = rte_zmalloc(NULL, sizeof(struct qman_fq) * num_rx_fqs, MAX_CACHELINE); + + /* If congestion control is enabled globally*/ + if (td_threshold) { + dpaa_intf->cgr_rx = rte_zmalloc(NULL, + sizeof(struct qman_cgr) * num_rx_fqs, MAX_CACHELINE); + + ret = qman_alloc_cgrid_range(&cgrid[0], num_rx_fqs, 1, 0); + if (ret != num_rx_fqs) { + DPAA_PMD_WARN("insufficient CGRIDs available"); + return -EINVAL; + } + } else { + dpaa_intf->cgr_rx = NULL; + } + for (loop = 0; loop < num_rx_fqs; loop++) { fqid = DPAA_PCD_FQID_START + dpaa_intf->ifid * DPAA_PCD_FQID_MULTIPLIER + loop; - ret = dpaa_rx_queue_init(&dpaa_intf->rx_queues[loop], fqid); + + if (dpaa_intf->cgr_rx) + dpaa_intf->cgr_rx[loop].cgrid = cgrid[loop]; + + ret = dpaa_rx_queue_init(&dpaa_intf->rx_queues[loop], + dpaa_intf->cgr_rx ? &dpaa_intf->cgr_rx[loop] : NULL, + fqid); if (ret) return ret; dpaa_intf->rx_queues[loop].dpaa_intf = dpaa_intf; @@ -939,6 +1003,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) DPAA_PMD_ERR("Failed to allocate %d bytes needed to " "store MAC addresses", ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER); + rte_free(dpaa_intf->cgr_rx); rte_free(dpaa_intf->rx_queues); rte_free(dpaa_intf->tx_queues); dpaa_intf->rx_queues = NULL; @@ -977,6 +1042,7 @@ static int dpaa_dev_uninit(struct rte_eth_dev *dev) { struct dpaa_if *dpaa_intf = dev->data->dev_private; + int loop; PMD_INIT_FUNC_TRACE(); @@ -994,6 +1060,18 @@ dpaa_dev_uninit(struct rte_eth_dev *dev) if (dpaa_intf->fc_conf) rte_free(dpaa_intf->fc_conf); + /* Release RX congestion Groups */ + if (dpaa_intf->cgr_rx) { + for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++) + qman_delete_cgr(&dpaa_intf->cgr_rx[loop]); + + qman_release_cgrid_range(dpaa_intf->cgr_rx[loop].cgrid, + dpaa_intf->nb_rx_queues); + } + + rte_free(dpaa_intf->cgr_rx); + dpaa_intf->cgr_rx = NULL; + rte_free(dpaa_intf->rx_queues); dpaa_intf->rx_queues = NULL; diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index ef726d3..b26e411 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -60,10 +60,8 @@ #define DPAA_MIN_RX_BUF_SIZE 512 #define DPAA_MAX_RX_PKT_LEN 10240 -/* RX queue tail drop threshold - * currently considering 32 KB packets. - */ -#define CONG_THRESHOLD_RX_Q (32 * 1024) +/* RX queue tail drop threshold (CGR Based) in frame count */ +#define CGR_RX_PERFQ_THRESH 256 /*max mac filter for memac(8) including primary mac addr*/ #define DPAA_MAX_MAC_FILTER (MEMAC_NUM_OF_PADDRS + 1) @@ -79,6 +77,7 @@ #define DPAA_PCD_FQID_START 0x400 #define DPAA_PCD_FQID_MULTIPLIER 0x100 #define DPAA_DEFAULT_NUM_PCD_QUEUES 1 +#define DPAA_MAX_NUM_PCD_QUEUES 32 #define DPAA_IF_TX_PRIORITY 3 #define DPAA_IF_RX_PRIORITY 4 @@ -128,6 +127,7 @@ struct dpaa_if { char *name; const struct fm_eth_port_cfg *cfg; struct qman_fq *rx_queues; + struct qman_cgr *cgr_rx; struct qman_fq *tx_queues; struct qman_fq debug_queues[2]; uint16_t nb_rx_queues;