From patchwork Wed Jan 10 10:46:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 124063 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5179244qgn; Wed, 10 Jan 2018 03:56:00 -0800 (PST) X-Google-Smtp-Source: ACJfBotXvKN/CMcgMk92UH62gqlcj950tBsVFeo7DIcYV1B+HpSyg8BdXAO8fV56wmSoETqtA0Ye X-Received: by 10.28.1.210 with SMTP id 201mr789752wmb.120.1515585360386; Wed, 10 Jan 2018 03:56:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515585360; cv=none; d=google.com; s=arc-20160816; b=LYP0Y+bXrWgeuN6vtS8Rik8NALF+t8gvjsjmrXMkhvXCneDHr2zzzO0BUROHsvNyPQ dSJ6ZChJBeVbwpKz3GZeeBOyp7Lat0hgqb25F7MiEkKYEE3vKESzdrQHUmqLEiZGvyjO GPOMCm75HX9nvFJ7eM9j7AI3IHoLJSHrR6symEQFD4jiTy3km2QrJ+YATtZ2aFFG5/Py 3Oce1xU/RQk/sZViiaJ7Fv2LNN9V2AGhCdNMT8vGG1h9aSyup5ZSr86Q3wpjtHnKyCVD LFCswW6DQV9+Amf6qi0WS4W4CGzNb68Ep5XkRWQtpZaqKRacnVGaFKF6Rq3H7HjyU3Fx BZDA== 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=BSL9h33nNjMyt/qHpLIJSgzSuHgnVrFXDYDeDD1WQ0o=; b=HTx9qolz3U7PiXz0ILAtRJ1RWYGTzX3T0Hun5BYKEAvZ8R9pAchYu3zy3IKiGHTFlN yibO2g7LoafZVIZaLDT9wqp2aHF1OdCIKKYBOIRw90w6xG8GTAxkYqxOZuXP7ZTLkKBn Fy74EcJQfmrN3EFeBIqXL5ZuXuV8VG6GWO3ZDI8wDFdvYQSUa66b4jwbKhHczYEWh+W8 ydHAkNmx+eKXSQ7g0GevwVpGBPkmYikmycrT/xfU7aQahPa4g2FIqEFwTdZng+Lrq3c7 7QTYh6MXyKUb5bXAWKtt+wc4TXdvz3PfZN2VdHHEFxgi2kMm1pVj0XyLldKJgZ9XHONB lyLg== 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 e139si11142306wma.128.2018.01.10.03.56.00; Wed, 10 Jan 2018 03:56:00 -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 E09D91B2B4; Wed, 10 Jan 2018 12:51:17 +0100 (CET) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0052.outbound.protection.outlook.com [104.47.41.52]) by dpdk.org (Postfix) with ESMTP id CF4E01B1A3 for ; Wed, 10 Jan 2018 11:48:04 +0100 (CET) Received: from BN6PR03CA0060.namprd03.prod.outlook.com (10.173.137.22) by DM5PR03MB2700.namprd03.prod.outlook.com (10.168.197.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Wed, 10 Jan 2018 10:48:02 +0000 Received: from BL2FFO11FD009.protection.gbl (2a01:111:f400:7c09::177) by BN6PR03CA0060.outlook.office365.com (2603:10b6:404:4c::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Wed, 10 Jan 2018 10:48:02 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.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 BL2FFO11FD009.mail.protection.outlook.com (10.173.161.15) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Wed, 10 Jan 2018 10:47:31 +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 w0AAljSO007124; Wed, 10 Jan 2018 03:48:00 -0700 From: Hemant Agrawal To: CC: , Date: Wed, 10 Jan 2018 16:16:28 +0530 Message-ID: <1515581201-29784-7-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515581201-29784-1-git-send-email-hemant.agrawal@nxp.com> References: <1515504186-13587-1-git-send-email-hemant.agrawal@nxp.com> <1515581201-29784-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131600548513659471; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39380400002)(346002)(376002)(396003)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(104016004)(6666003)(6916009)(2950100002)(36756003)(59450400001)(47776003)(8656006)(50226002)(85426001)(86362001)(5660300001)(54906003)(16586007)(305945005)(356003)(68736007)(81156014)(81166006)(8676002)(105606002)(97736004)(296002)(106466001)(316002)(53936002)(8936002)(76176011)(4326008)(48376002)(51416003)(498600001)(2351001)(50466002)(77096006)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2700; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD009; 1:tRwdkpxmwOu6KvexDECxGuMycfJiL6uKWF+ERl2D3xuTJG8hE+8h0PuQUbDia+MNoUVGaKhPpWXP2+p/PhoktJpR0AIpDWvmNryPJR2usRXgt/uahbyEeS3pk1BMO9wK MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9c6a201d-c791-43c9-3a4f-08d558178cde X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:DM5PR03MB2700; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2700; 3:9mroVzIjswa/Bvv49e2Vof5D/sXMxN8X5dmFzsrs6K7kViJTL59yEucAKAWxJslVw6KBFyLH+vEmZwjsylYd4HfAOZk9E07KWHQnT3TshM7yn/GZlId1pYg5kPW8I7EO5j46cAmPzk+tLYvbx+XVTHPFD2PmMA9ngtLRWieeBPRLEdWnXdc8uv/DM58G1MPUTmFrGanxQu9oLImsNmzrVep2SZZqB/9co5rmj+Co9ERFvRSo2VEH37iK5Yxz8gH2CeUCIZinqpdcVLwziPqv3MJjd6PWVOVwBD1/28xbAD0sQepG3rDTl0GjYVc54veIIGiuLO1OWJKrjdalE0VUg2Z0fkI5ceG93zX3UpSd0Ho=; 25:jY7FAT9SNDRfvlq4D/o7M+R2aeHY3KNfvDN+Vf85Mx/NK3vuQb2F82vgpCi8lOrkRR93H2z+JiaoX/Xv4pBJ71+SkAQWb4Subi9gGj5kYFqdr3vCU5UYw2WeEPrh8KrsiEK1E7XeolpyCemOmr4+cb17YZXdDLQrN++IQwYUx07vzZ0XhkJhyqKobvLkBW8lKSsDieHOQ8dum0njkUfvM6o1XMm7ngC4lS/EDjHlv/s//SfEiB0HcY7hYNpUvYctxbBQ7nPypA/COzcdmtK2Akki6DJcD+bWQcJrU5QT7UYi0k+g/KkEQ69Qt/+NHULWPkJ1xOgbGiTGVaavRt2dlw== X-MS-TrafficTypeDiagnostic: DM5PR03MB2700: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2700; 31:AxJXbduLMvcY+0HQnTZgBmVvivBPrQEQ4UaKkZxltLHpjtxsd8eqokf7gJSo2Lhv3JK8Wk6DkZBWJb1sYQDcqjh7UpBBUJRTvDkZ+L6aiLfdGkwH0Ml8W1vzD/Yr6fqCId6JAAo9KGdzztIkO69J35s8KQdf7WPUFvbK2bu5P0LVdGPxvrNXJ1vAKG3lWjiGb165JDDJTy9zcRe+05SLRG2Kw1CDz443aAXWy+z9CjU=; 4:uWf+LewBD7zdsUt9OTDf8RTbrZmOnqC6uEkWTfufpo8kHX9E4cL1UCsRFtFd1ShVR+eL8sm4CPXJutiAohCsWVxfTrasL7+3ZSxppmmxkIShJpD1naTUBHpHKMYUVM/rz/HhVcAhqKThD57Xp5qSzIeQpR7xX+t+HPnIB4Ro7Zg3R145pc93H9cHWfZYvnV69VQjnlTowYnNczYpKLxCb0p93MH2wDgbM60elukbSIQahfAlYW+VwYt3d8tb9UWJo4PBLACWbiHa2KQHf1zkdDPrlclJXlZId/0oJyLpQIUQdOVBZyq/zo403/MqRgChods5e17pcykLO7jWIpcWYg== 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)(8121501046)(5005006)(3231023)(944510075)(944921075)(946801075)(946901075)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123559100)(20161123561025)(20161123565025)(20161123563025)(20161123556025)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(201708071742011); SRVR:DM5PR03MB2700; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM5PR03MB2700; X-Forefront-PRVS: 0548586081 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2700; 23:BnqsUYOLfeYybKqgyWV/OlbB3HDLnQ6WO6P6U+h9p?= Xvew+HhseAthP8ArYQUmVCE6uc/7/6nm63wsRd2H3C0HfYHKi+lxwAJcCpMH6x07u3dPRyYGrzxvBzHGxAsziOEKQOHr1vcO4+7WKHS1Gs0buSTY5N3scVoM8GgbrwdCtpmULVRcJJOW0c57XzPWcum4vm/lTzpFB0lizAD4i4lZqjWP1ZWT7ZJndLGaaDquqHXEVZYrXYk+xky3nCYyjY/lKf4ZKvjmSXy7/kI6s2Qy9/x1XpVNFm2weEBzp7XKYPk2TCZwrBxcRXr/OBKYWt5KwAGby4z3qzlKTvq8IwAb8aHC45873PHdqXElbOVaVZn3dEnKSScoP2KnckNfNitpRerPENFkWsQzqJGzV/Ixn/qWLGhnSJGyz6CSKwQNQKpeQsH3zX9QYA2C9LngkPqzVUz46X/KVn0I8BnEtXQHjRpNPCKXkazxWtiof4n1ERby4EhBw5WQVv0g0iMy6E2QJgLw8+2/Uhf0Z+AemAPqwCmOxEDc6nu6CUeV3+DRN+tn1vJ9rdVwAW6uvVYLDebZm3Il0ooXCNFdRuX3GCQ4JWOdMxpxNkKG0F0ln5STIXg/RvIrSFPKwsEhC/V+hhhjWGZGNeCFAP5d99mAbs2IISrmOyZfgyZA1BtcODcqVBbcHsG5+clz+Uw274bKcWIFaQoV7+EbOY3Zhg7T9tc95EXhHQ63nxt6ig2U9DX4R1YzFXUOy2Zq2NIfmPVuKHFa862EHtWcixTuN6NRjica3o4Ty5HxxL/rLGOLMJ+CAOE4cln/zl2/PyocuG9taKKwIC7j3HesrxKJfQqoM700/n+AWfie3M/dWhc+FLsvLo+/tqlZ/GkAfRYqcoV2uJhYyRtG6FeG3nMDMDX77MAM8qaRmgC4hkbqx7sVRDiJcs0BCsrn5DR4j5I+nWZe1lxpxY6oTVbJCFgyv6HzKSC2t9pUW2Fbu9jBPOJVcpiO0F69D8RNBkxaA9v0YItBqCe/fHn6/Thw3kONhImdb/sUfVyY0BnjZAtkjXMhWo8MlEmrybr4CqPnO+WlkY9V2zult+Rcwm2QMD72Q2+AHKllIIIX+s21R/QokPCNhVqebA= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2700; 6:rgNNKCgSaLC/KxRVtJ6MZ6Y1TB3WAvhCUE8Zkjp6vtprarjGpNHRmRbwimF61++RLjm1LShgY0dmjPZm8DTWXoB0sTUX3w7/Nj/AhqieoRSCDOfhc8Ev2he2FaGSluJEwZ3kD4uUGUyfzJLGvU3l7Z8gfukM4J3pJ6rBln9CJlq9sPsfCH6C9VCXKk9K1XP/S293egAuu8tNeyQXHCGtydV7NvXHts0N39eFxlqhFgrN2tFHBd5OmmN3Ldat65YbUwE8uUxPYeL08j1N40g0OcP3xHRhGSuPTP6M5yABoywtXo9HdldHLC2B70zen9SA3YnKvajsiUxxnHAYRamwrcU2sMmHILZKHGQeCV4ZJlI=; 5:lI3/yELhi/h/N1Xyf6n639gGuhhTaOTGGDLI6/eCuUcOckEH3FX6/cGzsfcgUp0JegR1GRPntIQMLT5Qk9PcpE92uwx6TSaRMzHSn7BigoMJETpNF82wxzEc5MfejhwaHF37oO1fmY8xI2y55TBh459In5qOiqb9jXhaVJITN/I=; 24:8LcMinOu/t5a9Lk6rDsFKKKxI2kVTXyc+NF/CCQufpeIyv3H1yclSetEzboGVYbV7CfJGX0GBvHtDTuDI606BkPl+7nPhzv4uPEsRNHQ9pw=; 7:4iCBUE+dnUOth3KWejZwcsRdRipsCtX3GFOxtKGbztuifUUIbvjept312/xuPdZq+IutamVii8JgCgdGqQm47uDhA0Y3THpQ6RDirtfFa/C8Sb0w1DlkJcA3aWaekMsfvqBDlwv9ao/M1Upg2+Ro1MVf9tqWaKQEuoXxxKizF3zdRQe0Zm3Z7BFIUoSnCoaxAev9MZDZOCxaf3hpyWsvjb3eO4ChGSD4q3J7OD7YNAQ7W+Ns8a2T6bK/WsbtW+e1 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2018 10:47:31.1943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c6a201d-c791-43c9-3a4f-08d558178cde 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: DM5PR03MB2700 Subject: [dpdk-dev] [PATCH v3 06/19] 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 5a2ea4f..5d94af5 100644 --- a/drivers/net/dpaa/dpaa_ethdev.c +++ b/drivers/net/dpaa/dpaa_ethdev.c @@ -47,6 +47,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; @@ -421,12 +424,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(); @@ -462,7 +466,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; } @@ -698,11 +718,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(); @@ -732,12 +762,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; @@ -819,6 +861,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(); @@ -855,10 +898,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; @@ -913,6 +977,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; @@ -951,6 +1016,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(); @@ -968,6 +1034,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 548ccff..f00a77a 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -34,10 +34,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) @@ -53,6 +51,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 @@ -102,6 +101,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;