From patchwork Tue Jan 9 13:22:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 123944 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4019212qgn; Tue, 9 Jan 2018 05:25:03 -0800 (PST) X-Google-Smtp-Source: ACJfBou/6oc5W6kr1ZQSuCJPMyNSrXayYJ8k5BKAkIXJyKISdogdBaGpBq+bnkNHaUXY82Yxjzqp X-Received: by 10.223.141.206 with SMTP id o72mr4960116wrb.0.1515504303440; Tue, 09 Jan 2018 05:25:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515504303; cv=none; d=google.com; s=arc-20160816; b=GqM61UDFDIL1bWRS+DGCL53gynEhUo9FSZiECX5fdVZq9DdJkTDxj7GRCDwwvUobqx rPxMfSi42/hVAP6+vmLxzfX2kamJSrqzXkoTAb+zVucnsbC9GnB1pQMW5PamVG0fFxDz coPz3DJzHf7tRDb6q5uBrEyomLneyL4cJAajiXqRZDpddr3DtOSpxBZ3sFSQEGI2TbPv bFpz/RuE6GuuWMzBv2D0M3HBhRXvKJSFw3cY9Uy8D7+9VeRZ2VmYhzmjIbDxuX+eq6Q7 +67ZVoNu+OA5jsYS/wsgeXzYGZWNUGmjC1n2snDcuVhsKb+B1k0CCeJk9hs6CIk56rDg opkw== 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=nejaxaZjk9icBSGc62A0r/Uaa/k6pNESHDv2P43NeIRcucZQxP8lwTtib/s+kJ6a5x QthyTJFa8v7xkIGe4dYteMv3MmVL0KmkbR3hFbRvMgjlCY3zPvXysgcauLapdL//ifD0 dDVmVjvvflVWKygEszBuSKvYTTeeCP6VrZCP5rJ5mWZ0oUJy0999PfVsXMMBgB4IXYxz lJvtslNQYTkacsESsdymPkBpGyLjvRxyTPUmvOMyj+8De+EgWU87WQwyV2USZT0Z90Ac S02EkbFQO8i5ZnRaGSJf8orBG4lSJJwp3KkhWnDCD02NyPchH2Wox1/J3CSVOP/N8YGC VkpQ== 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 89si10668965wrg.320.2018.01.09.05.25.03; Tue, 09 Jan 2018 05:25:03 -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 9CDB31B1D6; Tue, 9 Jan 2018 14:24:31 +0100 (CET) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0074.outbound.protection.outlook.com [104.47.42.74]) by dpdk.org (Postfix) with ESMTP id 39A451B1C3 for ; Tue, 9 Jan 2018 14:24:28 +0100 (CET) Received: from CY1PR03CA0016.namprd03.prod.outlook.com (10.174.128.26) by CO2PR03MB2358.namprd03.prod.outlook.com (10.166.93.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Tue, 9 Jan 2018 13:24:27 +0000 Received: from BN1AFFO11FD040.protection.gbl (2a01:111:f400:7c10::112) by CY1PR03CA0016.outlook.office365.com (2603:10b6:600::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Tue, 9 Jan 2018 13:24:27 +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 BN1AFFO11FD040.mail.protection.outlook.com (10.58.52.251) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 9 Jan 2018 13:23:54 +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 w09DOAVn017638; Tue, 9 Jan 2018 06:24:22 -0700 From: Hemant Agrawal To: CC: , Date: Tue, 9 Jan 2018 18:52:53 +0530 Message-ID: <1515504186-13587-6-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515504186-13587-1-git-send-email-hemant.agrawal@nxp.com> References: <1513166759-13466-1-git-send-email-hemant.agrawal@nxp.com> <1515504186-13587-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131599778359801265; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(376002)(396003)(346002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(85426001)(50226002)(8676002)(81156014)(81166006)(8936002)(296002)(16586007)(54906003)(104016004)(316002)(2906002)(8656006)(6916009)(4326008)(6666003)(2950100002)(86362001)(106466001)(105606002)(2351001)(53936002)(5660300001)(77096006)(68736007)(97736004)(36756003)(51416003)(305945005)(50466002)(59450400001)(356003)(48376002)(47776003)(498600001)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2358; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD040; 1:f/qO+pdilLJZYZx/0hAdt3N31Yjv9dnE7ALyUGnw/x4W8jj/wZuduGJVQsRPmIieFKCGzLoOdqtIQxh+OKtZlu5VoGZQlEYGrpYTRpNTJKeZPN7MHHfomQQpCRgZhdlj MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7123d2bb-b595-46eb-f5b1-08d557643c1e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:CO2PR03MB2358; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2358; 3:tte5kcksg1TJrzWGfpAL/Wc/UGr8oBrnAHQbvZUgS1cJpPNH+rQOGOpOjaEJFBJdPA7+Cpaumkhtp39KbSjcCvESZcwMSCXIcrWNru/9es6iMMksnnxVUlEQ1ECsEGGhcW6v3YoJMKqEZFHtUo8D2kuOwKRVMnb8zj3fvJISxu0l/dY3qI400xdr50v23qr2702jDwXeAncHiQt6NYLXPw7fOfbDC3p9B/DNhRDpRffK8mSPLOcWQyl4NMZWI6AZfan3YxqW1vzLplk3QN5p1iH8nMoDwQsOs/s2KR2XumXW+ztB67S80VB2CEdGY6WEdGuRx+Ks9+XWOCuzWxBq20P0pKNdzk+xkY5YccC07vc=; 25:7MusNW96cjuHBBS1MmiAstxIws5J3U3zMCcLjbQieatkqms5rDefa32Cs3Lq6EoKTufvJfSf1XcypQCTSmv2of7B0QyT8472PZQK4WZiuF3poXyvMnQRG3G2Tcpd2YE5hDlBxlaV5h6Fub6PuJW9s/Df7jYiC7fZJGZc4bXMh0Z2oAOy8YolVwRnbdVE0NWEZvCfcv4gNs5xRBoEVaKigXtjVtnv38oVQQRySI1iNL+3J30s7BRbsQJYbKQQgiGVdQKdQkekdZyjPDJqaD4kf78eEmuw0FUhc3vmKVQDVf1x9oM4dH7kKSS9cLjgm2bqxGpjgnSSU641j1tiSofJZA== X-MS-TrafficTypeDiagnostic: CO2PR03MB2358: X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2358; 31:ApAvXFrfn4c4ipMuth2hviKpKE+Hc4o+gVPMvPDQD4vQYoJS5BSH0LlvGulAPMGl9jr51jL1rI4bABjrQ3TT6UrDJ/1GnyQL5lk1P4p5nN9xh2LpP0AKVFgevTkrecwC8uiaZaCugirHnxl+3c++2yoo/XWdFlk30+bdRGIo3C6SbzyLd+hOSCB0E6KbtTMYW6mNWjfeF+KZ6TKcr7ILDRANC2mqG2m1Up6SvYBE7DQ=; 4:Kd7g3kZpvszBlhIPTCpw+75G1yFBlDr35Unf+/oMaadfueujkX5j5XmH6EiVUV0GIMVMwKNsR8C7+yz5G4RJP69/Yk222V+YJ1KMBBAIKnVHTE0L1qQ1i7zl1O3gWJQ9bC7kceVtNYUhcUW14kucWmL6bGDqVqcCQIUQtvTBfszv7Un0qT38lWn1qBEUhHeBNYP+LLENtBQytyzqonaFOpd+THSnrpV4EDlJzGHx6lFClZThRm8cak5r3CJb/6MZuqRRCUnzf2dI5mYVYBr+5aoHEj5/k6cYLD89gf7FtZ5fJTIoPb3dg14qdmjvZxWxkaKW60jy/y5cT9glKKXLdw== 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)(93006095)(93001095)(3002001)(3231023)(944510075)(944921075)(946801075)(946901075)(10201501046)(6055026)(6096035)(20161123565025)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123556025)(20161123561025)(20161123563025)(20161123559100)(201708071742011); SRVR:CO2PR03MB2358; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CO2PR03MB2358; X-Forefront-PRVS: 0547116B72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2358; 23:B/fNUZOPCvOLCqOK1a8GoI6jVOIGB15qb3BNcxTGr?= Bl8o7lVBQbGLJdV6r+IYzWIQse9VE65o1/E9oLa/onGdVuMZfs5wVIS96mah6C2C5DvSiix4ek7sEQeZyOHVte6TN6aIfJGEMh6ctbXrkxknGebP+DOK4YkyvgDztL3PnIaF9pVkFhEK1OX+JzIU0hLEO4gcUltMexex/MO7d22TxncqX9cPoOinE57y/ggn+4Clhn/7UTnkymReRoUe5zOyFx7PBQpjZM0GTqRzdDwkB3xp+14zf8BJ4YfwsXrm/KsZj55GbSsnNe0eQJ1vWqGE/UtODYlNCICCYOYmCf6nvLV/Rh4zvdGrNHbtCZEdsjBT4En+CBdKnJUnRu5ygz35rzBRr70vzvaC5Ukr5iw/WXY4kd9q6Vx6zyfFolYbJIGedS6jioleTsCrfAlIE2P37pzfRLQIq2iHkY2kn16OOGOGPXntNn46Ghk6bhxM4NpGXnZ85FoVlwsRKOju73voTOcLJRCO0G4S6j8Jqx/B2ObasEqDOf68+cn25LY2Gi+pzEp9nwQiGtX+Sb4rU5MzIeDoSomXGcVbzXX19nhRiayGvdZ2pCbs/K+rUOHUYdP+jYuRkc05z+3euWObupzGZOx3hE4KALE5W/tWvFTNaZnUcZ+XnHbJPoE0c3kzIy5RYugg7dsYor/nncHuVMG4Etna0E8Ibazu5hMACy78Qiva7/00JYTv7bLpS2X6lpkV+REabbJmQyeSNlkoR01kqZMevcrQhmbueazzyBaELWOeE7SFt7snQffYVsrTwdzE6rrZGLD8nXJsYUuCV4ZzOlBpZXPjeZyjk6nEtHi9F/V06HiI5t4QZUFIoFFZxhPTWnPAJgobRXDtshVi4vLndTecWlDg7D5lyZ4292246Kh+XiywisT2edGvzmLIYSKD1tY7ChaqrubpUfCBMA9+1mx/KtOeT1JpX/96+QjcppCw7TyavsnUMsWE5zIMingkqo7oSMz+BuxV59mkYlsCGEmcnM7vjzKuJTEObF1WlhuV0eP+H8lELzIDWZaUvD78rI45tkO8BpYrkFfYcdZrOIZ7bBhvvBNzxr0yMqbb5SM8aYBvAL57NZbf6Al9ko= X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2358; 6:x0fvQcz9lRXiUrpSo5d/JMhgQc4DTz7WkYvUQt0QQvYg7u0cXsYDStL1SEfdY45jJv0jJuwQGo84d4fROtiNNwcEaE2HCYsjYxC7ibUQTyP3xZFF/CqIFxLv+DU/04zMuc97LaQvhzWyiL6uEiIPY28KmlJ/DdJa0n6r4o7Nig4fhFtNO5ZsD6Y1kneGKDCaTKE6k38TU69x+S0bwWFkHsCxg5SWWwoCq7dyfYNYmTYnB2tewDUKB/U356j4nHnx4VEOOhBkRK7v06aQrj4Vtsen9m5eqPIa3+j5xnZFDNuhcmGFkOYPhK3KCvJczqm+TH4jNVTdJaxv/0A8FyF00deyId+U9+AP0x/LFD5JzSc=; 5:ftRS+MtcNdziTEyvSS4r4we96qYhLq8pgWJEmccl+Dpsl+2W3wC3ADuYccdl5zP+WQiGrqjw50TusNFe681fc3qYUzXxbOadTLvD9h/1YwugQsQIzbnelqg8AUuW2OIocBII7alyDfuiNX47X2U+FiiyWwKBoFt+ZL1MfT7kmdk=; 24:evP0JmGJ2h7dYKOA0QaORRh5ICTCV0VxwZoaBpSJ8UrPfQQAI97GueXdzIDaZdeqtE71DU64xBddsK8kE7O/QalX86e3MKrSClB7ARlZdoA=; 7:yk8fWGQ7H8f2RXoz4ur1qRxofc9K88qmztK0vUZ2eZDx/JKnAN2yt2RQrG4/ycTrIH5QJ7KobyG7MQIK18jF9LLAZL0Qc2R3/gNe7kzByiLqlSyJXDb6VkpVtJyD/YiE0n4tAjLTShU6OvNt3RqmN/tIRsfnEw5GHTz9hJ8a8II9tpX1diSOQIPEv2enFPQLI0pGMT0eJIqPFSvbrcCp3L6EpzMsQSIVnZecor9tqMeqiMgAQ/AOvxuyyqaYt7m4 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2018 13:23:54.4357 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7123d2bb-b595-46eb-f5b1-08d557643c1e 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: CO2PR03MB2358 Subject: [dpdk-dev] [PATCH v2 05/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 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;