From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0042.outbound.protection.outlook.com [104.47.42.42]) by dpdk.org (Postfix) with ESMTP id 870C01B1A6 for ; Mon, 11 Sep 2017 17:19:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=o9IKeTyChuMBDfx0mkT5vV0LjH7m5p/Ps4+FP5u1dAE=; b=NazX/28GOUMwftCaPsdpqepKNUpzMr3gnKsMMcH4WUA2VGNV57GDSF6h/31IVNws9LfrEhMB3CiKNUS5QL4N68CuXaTwhCZtUPfd3pM4nMv2p21AJXL7fOIc2yvt6D9rJNcLHoLPHZT6j0vivF8UhfbWI9IOS3Fvv3jLIucHXBo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) by DM5PR07MB3100.namprd07.prod.outlook.com (10.172.85.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.9; Mon, 11 Sep 2017 15:19:21 +0000 From: Santosh Shukla To: olivier.matz@6wind.com, dev@dpdk.org Cc: thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, Santosh Shukla Date: Mon, 11 Sep 2017 20:48:37 +0530 Message-Id: <20170911151837.25092-3-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170911151837.25092-1-santosh.shukla@caviumnetworks.com> References: <20170815080717.9413-1-santosh.shukla@caviumnetworks.com> <20170911151837.25092-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BMXPR01CA0011.INDPRD01.PROD.OUTLOOK.COM (10.174.214.149) To DM5PR07MB3100.namprd07.prod.outlook.com (10.172.85.10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c9a0e3c0-ea69-4a62-3d8b-08d4f9287be9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR07MB3100; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3100; 3:0DCBejUpZVn9Kcgsqw9OfplUppMKb23PKOhuMOalKwJSutgj+TcQQ694QULYJ3ngotdPZbb0x15B8v8W9vg1Sl3LvA7XlEUQIHlPaw6oIgHDoCXW1E5ZQlsGAy2C+E5JnVpFCVBQK2TCDFlPtcF2b5/HLJO5YwNgjFap6NJaA3H6JsU4gKmu9/s21w+gmEt0tnPb6ZHckzVZcaQICW9x+UU7pGcPH0j6yk8Ycd5dKvsbWa6NuNcP26CuqYBMW6cM; 25:U8/7RK4ix7XDOsCr7ACrEw4iQcwbFHkhZWbVe5Lpcab+Xi6xEPd4T8FL98jYqTpIB0aibsjWy2BOsbvmc7fmHr194i3aEnzpCtJrVPBdU0+SMiiMN8cSqJZPB1Y0qZL1xm5AmftovFhLGyVCK5qFyC7l4FknACS5Cf6rt+/qlj+snA+45P0CLbgesbLSOFhTuFuc3uwoxgeSe/lMrPmHwh8/AS+i9w1YZ40pqy5YKk6Sd2uc32wo3nL9t3ZvFbGc6nylhYjrQtQufmzDYqclF/zaWnjcp/o4M6hNu1gh7NWvg/aJPsaRZrdS+UaETH6pw1IC508AFXcYCT97zpVmWg==; 31:UNhI9W30Wmr6XizlNHN32NJfzgdHvGNdICbmmomq0wK8CyBTgXlOs9dDwuIYokXYIKsa+nFMvxL03+y8hRLCP6x080Znkz34pEB9KSA+Nmn6ATSRb3wkA+sSICN9m/I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antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(10201501046)(100000703101)(100105400095)(93006095)(3002001)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123555025)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3100; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3100; X-Forefront-PRVS: 04270EF89C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(189002)(199003)(47776003)(5660300001)(81156014)(81166006)(575784001)(6306002)(6512007)(7736002)(8936002)(8676002)(50226002)(305945005)(97736004)(66066001)(42186005)(101416001)(76176999)(36756003)(50986999)(6506006)(6486002)(105586002)(106356001)(68736007)(2950100002)(33646002)(42882006)(6666003)(1076002)(5003940100001)(5009440100003)(6116002)(3846002)(50466002)(48376002)(2906002)(8656003)(966005)(25786009)(478600001)(72206003)(53936002)(107886003)(189998001)(110136004)(53376002)(4326008)(15583001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3100; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR07MB3100; 23:kXhpM7bIx4csnREOPadHHyFHAKXIRgrohsqMG8OMi?= =?us-ascii?Q?XEl11cSoQmHPbJ2IKKM3bWh9NO1g2KNEZd7FcBi3kR868zT+0gE6KkcIFbe9?= =?us-ascii?Q?WYDpbpggTj2/TwmUrXtg2buxXri+uSMuqxsOj+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KkayHpoN4z9UISQzVhtpm0cKbyzJP04d4gMN2gOknLGJwXR2mTIV/3tXY8LTBLaYQmb7bY2us/c2iku7iBY40zZw62kXmicA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2017 15:19:21.2879 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3100 Subject: [dpdk-dev] [PATCH v4 2/2] ethdev: get the supported pools for a port 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: Mon, 11 Sep 2017 15:19:26 -0000 Now that dpdk supports more than one mempool drivers and each mempool driver works best for specific PMD, example: - sw ring based mempool for Intel PMD drivers. - dpaa2 HW mempool manager for dpaa2 PMD driver. - fpa HW mempool manager for Octeontx PMD driver. Application would like to know the best mempool handle for any port. Introducing rte_eth_dev_pools_ops_supported() API, which allows PMD driver to advertise his supported pools capability to the application. Supported pools are categorized in below priority:- - Best mempool handle for this port (Highest priority '0') - Port supports this mempool handle (Priority '1') Signed-off-by: Santosh Shukla --- v3 --> v4: - Replaced __preferred_pool() with rte_eth_dev_pools_ops_supported() (suggested by Olivier) History, Refer [1]. [1] http://dpdk.org/dev/patchwork/patch/27610/ lib/librte_ether/rte_ethdev.c | 24 ++++++++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 24 ++++++++++++++++++++++++ lib/librte_ether/rte_ethdev_version.map | 7 +++++++ 3 files changed, 55 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 0597641ee..0fa0cc3fa 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -3409,3 +3409,27 @@ rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id, return 0; } + +int +rte_eth_dev_pools_ops_supported(uint8_t port_id, const char *pool) +{ + struct rte_eth_dev *dev; + const char *tmp; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + if (pool == NULL) + return -EINVAL; + + dev = &rte_eth_devices[port_id]; + + if (*dev->dev_ops->pools_ops_supported == NULL) { + tmp = rte_eal_mbuf_default_mempool_ops(); + if (!strcmp(tmp, pool)) + return 0; + else + return -ENOTSUP; + } + + return (*dev->dev_ops->pools_ops_supported)(dev, pool); +} diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0adf3274a..d90029b1e 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1425,6 +1425,10 @@ typedef int (*eth_get_dcb_info)(struct rte_eth_dev *dev, struct rte_eth_dcb_info *dcb_info); /**< @internal Get dcb information on an Ethernet device */ +typedef int (*eth_pools_ops_supported_t)(struct rte_eth_dev *dev, + const char *pool); +/**< @internal Get the supported pools for a port */ + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -1544,6 +1548,8 @@ struct eth_dev_ops { eth_tm_ops_get_t tm_ops_get; /**< Get Traffic Management (TM) operations. */ + eth_pools_ops_supported_t pools_ops_supported; + /**< Get the supported pools for a port */ }; /** @@ -4436,6 +4442,24 @@ int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id, uint16_t *nb_rx_desc, uint16_t *nb_tx_desc); + +/** + * Get the supported pools for a port + * + * @param port_id + * Port identifier of the Ethernet device. + * @param [in] pool + * The supported pool handle for this port. + * Maximum length of pool handle name is RTE_MEMPOOL_OPS_NAMESIZE. + * @return + * - 0: best mempool ops choice for this port. + * - 1: mempool ops are supported for this port. + * - -ENOTSUP: mempool ops not supported for this port. + * - <0: (-ENODEV, EINVAL) on failure. + */ +int +rte_eth_dev_pools_ops_supported(uint8_t port_id, const char *pool); + #ifdef __cplusplus } #endif diff --git a/lib/librte_ether/rte_ethdev_version.map b/lib/librte_ether/rte_ethdev_version.map index 42837285e..644705cf1 100644 --- a/lib/librte_ether/rte_ethdev_version.map +++ b/lib/librte_ether/rte_ethdev_version.map @@ -187,3 +187,10 @@ DPDK_17.08 { rte_tm_wred_profile_delete; } DPDK_17.05; + +DPDK_17.11 { + global: + + rte_eth_dev_pools_ops_supported; + +} DPDK_17.08; -- 2.14.1