From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0044.outbound.protection.outlook.com [104.47.33.44]) by dpdk.org (Postfix) with ESMTP id CFD0C7D30 for ; Tue, 2 Jan 2018 13:54:47 +0100 (CET) Received: from BLUPR0301CA0013.namprd03.prod.outlook.com (10.162.113.151) by BN3PR03MB2356.namprd03.prod.outlook.com (10.166.74.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Tue, 2 Jan 2018 12:54:46 +0000 Received: from BN1BFFO11FD046.protection.gbl (2a01:111:f400:7c10::1:135) by BLUPR0301CA0013.outlook.office365.com (2a01:111:e400:5259::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Tue, 2 Jan 2018 12:54:46 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.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 BN1BFFO11FD046.mail.protection.outlook.com (10.58.145.1) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 2 Jan 2018 12:54:21 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w02CshQc008111; Tue, 2 Jan 2018 05:54:44 -0700 From: Shreyansh Jain To: CC: , Shreyansh Jain Date: Tue, 2 Jan 2018 18:38:38 +0530 Message-ID: <20180102130838.3630-1-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.14.1 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131593712621506636; (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)(396003)(376002)(346002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(59450400001)(47776003)(5660300001)(53936002)(81166006)(498600001)(68736007)(4326008)(85426001)(81156014)(51416003)(77096006)(2906002)(8936002)(6666003)(50226002)(8676002)(16586007)(48376002)(2351001)(316002)(105606002)(106466001)(36756003)(86362001)(104016004)(97736004)(54906003)(50466002)(1076002)(8656006)(6916009)(305945005)(356003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2356; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD046; 1:+OW8AEddqCxnnqLpGHKmrYxdQq3F0Fy4Ck+XD4M4Dconl9BJi81tjMtRcTgM3i+aDg37w4TPRsjfMEuZtOHnxmPCtDjJ7C6IS+2O5jvR1+uwzV7XciNKwbgupDkQrVM2 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fdc7b6b2-edca-4d6f-6eef-08d551dff1ef X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:BN3PR03MB2356; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2356; 3:ttXiXoNUYGkReLG6w69mrWlnxm2qxHKwf1vwFPCClksnEtnOdzRjxnBISFqMluRoU7L7tc3ym8xJau6QP9GO5wjyQoKxh08nM2bjhSBzlZ2c0Y0YDavPAXEY+WZKShOtTCDJLkzOnt4kbKpMK0KpacjuLYetbkLMhT/NNEPzw0ZEE3azq3LEq6jbg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HY3Nsa4sLLvHTiDMdrtsEa9MmqtQXohpl4TRd2evQdyGjyxmF4rp9MT6u3tfulX+P2NtuaHh9mPQ5 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231023)(944510075)(944921075)(946801075)(946901075)(6055026)(6096035)(20161123565025)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123561025)(20161123563025)(20161123559100)(201708071742011); SRVR:BN3PR03MB2356; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN3PR03MB2356; X-Forefront-PRVS: 0540846A1D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2356; 23:WiAL83KE49KNBpTUs/4EIw5lBq1PE8BVXvGWu2hg8?= =?us-ascii?Q?ouJ+mVk8iREJbyJkYmiiK630+7HxxnA6GJOURzoy9vu52swo/PkVf6s8zjV6?= =?us-ascii?Q?JGIrWv3oY9b8y8JXGzBs28qcO/ZjWwNSjSd7g7ai1EHs2/BL6Iueso67dVFM?= =?us-ascii?Q?YzTBIz4Ew1PczlEauHn+a7A6x6t4+lGPpbnPSeDvXm5I8ZwPcjQknK4CXUBJ?= =?us-ascii?Q?6EEzDhzImMTGd/WhEjWf9E4tW8KhuPIl7aLQuAt57UANZdX3HOP6KCnDyGCj?= =?us-ascii?Q?PuxAxIRf5WGXEhHlkKLvhXProAr42JNBPi0krzIQ8epcbzFVk+ybz5rdwIVc?= =?us-ascii?Q?yrCq8K7VBS08UWLOaPscYc3EEMbfcJcyh7ChDVsoeNIKbkxvUNAYMEyrFq/b?= =?us-ascii?Q?sTbXccbd6rMbiIXSr+KyUvVg+JBcKQPTNsY7NNxmO3h1r316EOD/nx7kjF+V?= =?us-ascii?Q?XsW/07R4bWVNoGdt5NrKrqiLVx4vb98Z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HC7r20Nzf723wIZl/CFlX+ApNjBoyM8udyf8kN96uUC5qsttPmtaqE3R5xP+xgY=; 5:WcmXY1X6iVtEJaY6LaAJjdw9LE/mc/oq6D6Ecm+FhwOTgAe1xVY8k4/wgKNt5cHcvT+jPVrxuTR+JQIf4QE2igG5xjQxE12W6NvLvH8r4nNcNRH1oh2zWlAS0Tqo4wQHPbGc3QEtuhDLt5k65YlZn5KycJJ9xqNjmNN7Plu2xGE=; 24:M/798qNNRsxa/f3iouWEPmpdNsqubG3gdJjU2CSspoiI6EV2tKEgt9vi1BqSLIbEhADks1S2q9t2h5dACAcMteGjnMbEyL0g1wy+F7ziqyY=; 7:iYNatMONeBg2zMkTXQTZvm0js8zJMCPQbBFK9iv1IF7U0JTScj5sJGOUZAwGKUrKnU62oo5Adu2KSey8ZizQeQ6ufkFqAWbm2hZgDAxpdSHlL03j6uTVuxr3G9FHchNfLHzbLJOM3njvTk+WpjO6UMrRdL1ChcgxngxmbYrzt2ACJK0tTp5bOgQ3ZQ5Y05AW9YK8l/vGXL+Gl0tjaAefLsjrdGIs+YybPxQ0CCSztS99C27YmqdxrTkZWyxwnW0x SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2018 12:54:21.9634 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fdc7b6b2-edca-4d6f-6eef-08d551dff1ef 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: BN3PR03MB2356 Subject: [dpdk-dev] [PATCH] bus/fslmc: add support for scanned device count 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: , X-List-Received-Date: Tue, 02 Jan 2018 12:54:48 -0000 FSLMC bus detects a multiple type of logical objects representing components of the datapath. Using the type of device, a newly introduced API rte_fslmc_get_device_count can return the count of devices scanned of that device type. Signed-off-by: Shreyansh Jain --- :: This patch is based on *net-next* tree. drivers/bus/fslmc/fslmc_bus.c | 12 ++++++++++++ drivers/bus/fslmc/rte_bus_fslmc_version.map | 1 + drivers/bus/fslmc/rte_fslmc.h | 18 +++++++++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index 63c333a59..39478f7f3 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -53,6 +53,14 @@ struct rte_fslmc_bus rte_fslmc_bus; uint8_t dpaa2_virt_mode; +uint32_t +rte_fslmc_get_device_count(enum rte_dpaa2_dev_type device_type) +{ + if (device_type > DPAA2_DEVTYPE_MAX) + return 0; + return rte_fslmc_bus.device_count[device_type]; +} + static void cleanup_fslmc_device_list(void) { @@ -164,6 +172,9 @@ scan_one_fslmc_device(char *dev_name) else dev->dev_type = DPAA2_UNKNOWN; + /* Update the device found into the device_count table */ + rte_fslmc_bus.device_count[dev->dev_type]++; + t_ptr = strtok(NULL, "."); if (!t_ptr) { FSLMC_BUS_LOG(ERR, "Incorrect device string observed (%s).", @@ -408,6 +419,7 @@ struct rte_fslmc_bus rte_fslmc_bus = { }, .device_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.device_list), .driver_list = TAILQ_HEAD_INITIALIZER(rte_fslmc_bus.driver_list), + .device_count = {0}, }; RTE_REGISTER_BUS(fslmc, rte_fslmc_bus.bus); diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index f59fc671f..16b759d8b 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -97,5 +97,6 @@ DPDK_18.02 { dpaa2_virt_mode; qbman_fq_query_state; qbman_fq_state_frame_count; + rte_fslmc_get_device_count; } DPDK_17.11; diff --git a/drivers/bus/fslmc/rte_fslmc.h b/drivers/bus/fslmc/rte_fslmc.h index fd52e2b84..e6314b5cb 100644 --- a/drivers/bus/fslmc/rte_fslmc.h +++ b/drivers/bus/fslmc/rte_fslmc.h @@ -88,7 +88,8 @@ enum rte_dpaa2_dev_type { DPAA2_CI, /**< DPCI type device */ DPAA2_MPORTAL, /**< DPMCP type device */ /* Unknown device placeholder */ - DPAA2_UNKNOWN + DPAA2_UNKNOWN, + DPAA2_DEVTYPE_MAX, }; TAILQ_HEAD(rte_dpaa2_object_list, rte_dpaa2_object); @@ -150,8 +151,8 @@ struct rte_fslmc_bus { /**< FSLMC DPAA2 Device list */ struct rte_fslmc_driver_list driver_list; /**< FSLMC DPAA2 Driver list */ - int device_count; - /**< Optional: Count of devices on bus */ + int device_count[DPAA2_DEVTYPE_MAX]; + /**< Count of all devices scanned */ }; /** @@ -191,6 +192,17 @@ RTE_PMD_EXPORT_NAME(nm, __COUNTER__) */ void rte_fslmc_object_register(struct rte_dpaa2_object *object); +/** + * Count of a particular type of DPAA2 device scanned on the bus. + * + * @param dev_type + * Type of device as rte_dpaa2_dev_type enumerator + * @return + * >=0 for count; 0 indicates either no device of the said type scanned or + * invalid device type. + */ +uint32_t rte_fslmc_get_device_count(enum rte_dpaa2_dev_type device_type); + /** Helper for DPAA2 object registration */ #define RTE_PMD_REGISTER_DPAA2_OBJECT(nm, dpaa2_obj) \ RTE_INIT(dpaa2objinitfn_ ##nm); \ -- 2.14.1