From patchwork Mon Jul 19 13:59:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 479840 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4154686jao; Mon, 19 Jul 2021 07:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh+T1zxIA7ukmZLvjtNSZjWV0jrnjm6+WhPa0UpT5bRSSrDVxuAxI2h/hCDurWxhDwk+iS X-Received: by 2002:a17:906:f743:: with SMTP id jp3mr26869456ejb.370.1626703387587; Mon, 19 Jul 2021 07:03:07 -0700 (PDT) Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id t10si20352409eju.92.2021.07.19.07.03.07; Mon, 19 Jul 2021 07:03:07 -0700 (PDT) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; dkim=fail header.i=@nxp.com header.s=selector2 header.b=qqUcnw5+; arc=fail (signature failed); spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B7C09411A3; Mon, 19 Jul 2021 16:02:38 +0200 (CEST) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00078.outbound.protection.outlook.com [40.107.0.78]) by mails.dpdk.org (Postfix) with ESMTP id 116144014E for ; Mon, 19 Jul 2021 16:02:37 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UfTRoE8RoRyiqklzKOZeQOQD1IPXLZsv9PgqHdhGxQif1AAbf2CDVmfmh2ayqdXXj2be3FLqiSDr7taXaUOVIFEZp3AXgjIl1PPtEBfQlZfJGyJRPsyXgMbOO+gSRVMil6iUty3OhKIEogNQewt2z5SRxIGWlGCdU2fK27eGAl1PtLTIUjDcTRJqdvE5YkDnf/lQhtA1BKixhDI9rBEenBg65iFmhzje/DLyAmVneoCl+P1khi4Vat3PmOUMIwZUgLBJC64BEKblzve2GusHcqZtRVyR9hJDpE6c5QMwPtin63UJeg7mFP8iegjIbADjQqwkn/o+wHAhtL97mOr6GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fVTh9SGQD6IyFRR5I6qvdtBfeVqXBkT9iT9HR0RzIc4=; b=YKVu8hJR0wd0Yz4sk0Yq4cR5xwW0DgrH33VrRM21PqlyGqgNg6Dclobofz0lBKikNT+fi+JXa9/eg5aqdGMigxOraOAPYqY0H1OMBL3CazblHTk6e/ARlP766e0iUqCTWkgjvJU91huys7kFmGXTEy31ZDH/TWGZwzhbRwCp3pgayALOWvrnTgV4xFg1e3ZgCEjyuCSBkulqwlSMMey9x/WyqPWDetNsXhSAw8CnQYX5fQtX8MGdVqe4ttV2E+a8SU3zSHKgEyc8Lgtz5OykYtGxigTamkAcrz+jA5acS6pJNaUlXAAHWl2pl8QO681EXfi1WA2ZYuEiiLuKkfQgQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fVTh9SGQD6IyFRR5I6qvdtBfeVqXBkT9iT9HR0RzIc4=; b=qqUcnw5+PsZwTJBEzJRDgzxlN8av0XqQDo3u721gMRFmi8WdmDS4cl5XtbBSZtNPOFdco3iyU+cWEUkWY22anqt5GCGdRI+U2Abxfa5qiRYtDliLBJ8GZhCPqYkD4drnf+k+lq11Lnh71V41+cXBC+lU3JRerAycEudmstETbEY= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=nxp.com; Received: from DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) by DU2PR04MB8536.eurprd04.prod.outlook.com (2603:10a6:10:2d7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.25; Mon, 19 Jul 2021 14:02:36 +0000 Received: from DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::f483:9bb1:cde3:8a28]) by DU2PR04MB8630.eurprd04.prod.outlook.com ([fe80::f483:9bb1:cde3:8a28%6]) with mapi id 15.20.4331.032; Mon, 19 Jul 2021 14:02:36 +0000 From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Nipun Gupta Date: Mon, 19 Jul 2021 19:29:15 +0530 Message-Id: <20210719135917.26241-6-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719135917.26241-1-hemant.agrawal@nxp.com> References: <20210719135917.26241-1-hemant.agrawal@nxp.com> X-ClientProxiedBy: SG2PR02CA0038.apcprd02.prod.outlook.com (2603:1096:3:18::26) To DU2PR04MB8630.eurprd04.prod.outlook.com (2603:10a6:10:2dd::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from dpdk-xeon.ap.freescale.net (92.120.0.67) by SG2PR02CA0038.apcprd02.prod.outlook.com (2603:1096:3:18::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 14:02:35 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9e28ff57-bf82-43a4-d688-08d94abddcbc X-MS-TrafficTypeDiagnostic: DU2PR04MB8536: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gYgrxlaD8mFBS1Nh41NpHCCLCcB5d6i1Mrv391S4ZzvkO5vFDnQyfEm9mxqOujLpHMW5IJUV/BwpbvT4+LKyUPiMtT9ZltkPwAHLI4g6jKuOOEQKYpOdpooLI2BA22K57rFV85IM7ieXum/GPMnKe/R0HKzjna4uP8Wj3KHmsj5Qeljq/wl5Xe5ZSBdV3D1I0vbOpMEWzIkKfu70KS19WY4jPvQx4CVloRQT4UJVAVlRsIMz4+m5sD3K1YQ7pzsSEXZzFpqAKDJSr9cvnQRFeRwF87cKb3/d/TABKYjk/7lG/8oWynBPkIY01CYcqBN3aPdS2aiWJblQlt0ftJ4Qht6SdtSMJdu9ZjSG/3TGVIw9xxKDPmWaLb6GXjbQ2ZBE44st2Kzpk3seYb7s3KlDvnif5caMEyxmUG3ma77fK0+Mgnz0Toixi6g5mGsqi4ivjC0qj22t3r0ZGIML3Up5+pY+XmL6pv6/6EeS5yNp3tUqpuW1WmmuD6QEqO2LHq61lmkmtfl82b3URIzFcMkYwBPFqWVhcgJt/Wdb7IosQ7oa7o3JTsyIwyoMwQhRI44okzZFokZWeKjNSGpCHmN33ADzckbSSyYX5wPb7cFkLMDKCaV3UvsU/N8HKMySTdoScNVh4c1aqj5R0Qpx9IKGAFrUBjvP07iB0CQODnd3mKeh1WJP+DNHYDne7/ZNxQw4A54lkk1R0ABFVQJi6pC/Wg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DU2PR04MB8630.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(376002)(366004)(39860400002)(346002)(136003)(26005)(186003)(6512007)(36756003)(66946007)(66556008)(1076003)(83380400001)(66476007)(6506007)(44832011)(8676002)(2616005)(8936002)(478600001)(38350700002)(38100700002)(6666004)(86362001)(52116002)(316002)(6486002)(5660300002)(4326008)(6916009)(2906002)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: h97YSZVi0jT+M7MsN1gAeSmf/4Sf9GcOkf7oW40NcWmT1BPUEDKB6yWNct+gapxtEyOkew6go4lOBi7q4tEhq4f7tkix3ILAkVAlomm/8fFlruwOkcQpyNj/H/AEpyguR4Ztciso9TCBILtxdnWXQBDd1uWh1YMfAGhpoeeeVp0OLPi905A63P9sl/NTTpIP0wFgMxA1O6HeWZnEvEFrRE6ZFGH4K85qNl6w/I+SioFEhQi9oDoFO44vB2jFuK58Ayv8tshHxMZGMQ27sZ94n9rNC2+U9SYdZoEGGXG3NT5eOksEtONakwkZ4NtOr51thUcO7M5T8knxVcGameBgFtq48qg7wzFWFU4peYL5ctGCBnGgR1YKAW1dU/2k46jDhm0TydcixgtXL/KQstG9FCI5ZbfDoFw+fHaYy52OFSbxLfoDpZq+232X9Yu71aEsCbp/EjUX1teeV+hdnGAr6mjUZ/1UArvbn3IbkVulNI9ZG1heqq347+GuG5d25/iqPJGjtfp1x6vA6HFrh07bqr1/lwwQb1t3shaU7jXdEvWM29Z9UryzMxy4KNk6zH0i00/VhXSi31NapUVcCo5qvBx/CcHVZdeeGvmJQXOyEQI1EPEpMgOKVCmjts3qk1MPCNmi1V7WzuDhdwYKKOXRwQuBNfNYbqg2p/6xciR0b1tXtLoW4Xk2DwFtiHHt8kDBI9MQucOZuEeJ3avu6qtBeTE90mP7u6Ng4PkVZreKQpNcWlzsDdJqLL31X/kaY265ECbRuXdjSmSjGT90STlpih29pavY5qJ9lRIPAmXWojw7oISlY85gw8F25W5PvEMJl1IJwSf9qfyHsC0gLmxYR6Y3jNGKselcMJGMo8wpfd/UC/YKoC2R3sLSkfrl4Oo7Q5lZWHNm05od88qx/O//f23oZS5TO+TmB9eAEDuhhxxSyMCYMQo6m1A6t7t+7wsn7TlPsX3HcBLC1c3IuOI6RPh5RjlfGe8cvVYizngsugkmtgya0KvF9m9j4PJbJm5+U9N36nSD3VdM9fVJua0dSwisSmj+XIC0F2P/xwuhFWFFYMpQpr6iGtmDzNi0rRwlWgs9m8WhEeS2OAM/HP3GIZWg8dMqBH50K6NB7K5qX+bhXnoQQSxXOS4f6JQhLTjOfmEhdI4EAaO9sgGmAYRUXqqbPaZ9jCc7SnJ8eI+3DYNC45mbroZa+DHrqIaqXE74iCrpoG5UN5WBJjdTMvIsaO/0CsmgxH5bzlQCnzfGjJRDtXstHnd1LmKVjNg8nNGgvGOw2OFTYfknRemaxUNGxofp48JfA0jYstc4MhDCdrCs8DtsFHC6NGS2tnAa+qK7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e28ff57-bf82-43a4-d688-08d94abddcbc X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8630.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 14:02:36.4214 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2yHtYrRwz/nQCuImenzjSjq8YWiIIIvSyH0j6y02ZH9AL7YmVD0jKsGI6QJyCjCKyhgGOsgRdbFcWnXbQ4Hc9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8536 Subject: [dpdk-dev] [PATCH 5/7] net/dpaa2: add per thread init PMD API X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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 DPAA2 hardware require a hardware portal context. If a thread doing DPAA2 i/o do not have portal, it will allocate it on run-time. This may cause a delay in the datapath at run-time. To avoid it, it is better to allocate a hw context portal at the start of thread expected to do i/o with DPAA2 hardware. This patch makes necessary changes for the same and creates a pmd API to allocate a hw context portal for a thread. Signed-off-by: Nipun Gupta --- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 10 +++++----- drivers/net/dpaa2/dpaa2_ethdev.c | 16 ++++++++++++++++ drivers/net/dpaa2/rte_pmd_dpaa2.h | 10 ++++++++++ drivers/net/dpaa2/version.map | 2 ++ 4 files changed, 33 insertions(+), 5 deletions(-) -- 2.17.1 Acked-by: Hemant Agrawal diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index c224a883ae..1a1e437ed1 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -20,7 +20,8 @@ #include #include #include -#include +#include +#include #include #include @@ -168,7 +169,7 @@ dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id, int cpu_id) fclose(file); } -static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int cpu_id) +static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev) { struct epoll_event epoll_ev; int eventfd, dpio_epoll_fd, ret; @@ -205,8 +206,6 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int cpu_id) } dpio_dev->epoll_fd = dpio_epoll_fd; - dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, cpu_id); - return 0; } @@ -242,10 +241,11 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id) } #ifdef RTE_EVENT_DPAA2 - if (dpaa2_dpio_intr_init(dpio_dev, cpu_id)) { + if (dpaa2_dpio_intr_init(dpio_dev)) { DPAA2_BUS_ERR("Interrupt registration failed for dpio"); return -1; } + dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, cpu_id); #endif return 0; diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 8b803b8542..d892819a7e 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -2382,6 +2382,22 @@ dpaa2_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *ops) return 0; } +void +rte_pmd_dpaa2_thread_init(void) +{ + int ret; + + if (unlikely(!DPAA2_PER_LCORE_DPIO)) { + ret = dpaa2_affine_qbman_swp(); + if (ret) { + DPAA2_PMD_ERR( + "Failed to allocate IO portal, tid: %d\n", + rte_gettid()); + return; + } + } +} + static struct eth_dev_ops dpaa2_ethdev_ops = { .dev_configure = dpaa2_eth_dev_configure, .dev_start = dpaa2_dev_start, diff --git a/drivers/net/dpaa2/rte_pmd_dpaa2.h b/drivers/net/dpaa2/rte_pmd_dpaa2.h index 7204a8f951..84ac9d38d1 100644 --- a/drivers/net/dpaa2/rte_pmd_dpaa2.h +++ b/drivers/net/dpaa2/rte_pmd_dpaa2.h @@ -84,4 +84,14 @@ rte_pmd_dpaa2_set_custom_hash(uint16_t port_id, uint16_t offset, uint8_t size); +/** + * @warning + * @b EXPERIMENTAL: this API may change, or be removed, without prior notice + * + * Do thread specific initialization + */ +__rte_experimental +void +rte_pmd_dpaa2_thread_init(void); + #endif /* _RTE_PMD_DPAA2_H */ diff --git a/drivers/net/dpaa2/version.map b/drivers/net/dpaa2/version.map index b50da13bcb..49f69dacd2 100644 --- a/drivers/net/dpaa2/version.map +++ b/drivers/net/dpaa2/version.map @@ -6,6 +6,8 @@ EXPERIMENTAL { # added in 21.05 rte_pmd_dpaa2_mux_rx_frame_len; + # added in 21.08 + rte_pmd_dpaa2_thread_init; }; INTERNAL {