From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0081.outbound.protection.outlook.com [104.47.33.81]) by dpdk.org (Postfix) with ESMTP id 741EA37B1 for ; Sun, 1 Oct 2017 11:15:07 +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=gtinLnxhMBwfOXxww94ev3bW0Mzi7GtPu3H6yMLc5ZM=; b=DYUxKxTB+MSFJuLDEJZhVlPPBtsqNzqmLI83FiH121DbABNhnywXbwUZLDzo0w1rKiq+i5n3vh6uFZqFiiP6KkW5jqitGlkKyuAOPHdBKDIjJkp8uWiR01TXac5xOSwdFUaVS0j/zDY9/r+L64pI3nVB1OJMYokw8Xfd339gIAI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) by MWHPR07MB3104.namprd07.prod.outlook.com (10.172.95.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sun, 1 Oct 2017 09:15:01 +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: Sun, 1 Oct 2017 14:44:40 +0530 Message-Id: <20171001091440.10232-3-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171001091440.10232-1-santosh.shukla@caviumnetworks.com> References: <20170911151837.25092-1-santosh.shukla@caviumnetworks.com> <20171001091440.10232-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MWHPR13CA0019.namprd13.prod.outlook.com (10.169.208.29) To MWHPR07MB3104.namprd07.prod.outlook.com (10.172.95.10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7683ad14-71f2-4590-72c2-08d508ace7af X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:MWHPR07MB3104; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3104; 3:aCBhXTtbbxLMY+jAUO+uk/KQKzD5LfYaFPDBe5cR+bKWvnZsSnQSzpgLkf8mpYaW0NkSp9M+dMZ3sPwEGWQaXvSuL5ifblZ00e433vm567kJw6TDAoswaslJoUGiVV00eLiRqsKjWz/bEfjrmTz6jhSAOanYB0zQna7liPyZ9uh9vUUlosfAUWn4Z7EylZoafAQHitDBlj2nZZsU2au+NWmc5VMgFn7ZLe6wVgFOkoM8EsId8juUavoY6mkua+to; 25:gqZf3GQfE2V2/AlT5/vd77fIDJfybaMvxG9mlvLo1kNobEzRFlekbocXQ4RO8qno7MSzf9bhwpMP6ra/ny2LWJugCKJqeZMVD7JFMvgTuoaGnqazMvX78EeH3wSG2cf+VBAdoLnHNsdt/DnnHJmb+ccJX6lEtgefgvq3+UcgZSFZQFNyMQjTOb43fMvf9AHbSY3+3sSBiGa1oJM4JNH5A/NokpdQ0Bm5y+3thtEwFTRnlXcC6tCFqkv2q/CYgIG/Yop55mg+jEwsO4AtiH5DdL+ROt0HL23wIPokRj2FpbWIH5SzAWTD/q7v8l4p0A5nKhNrKANgWDsV8C81V8sJMA==; 31:x5FmJpWooIDKqwvTbpJQJN+oGKqeXW01ztNn2SegaQFDwQVv/y1/HU1ozx4t/9L06VYQ1Qg9LerTVyl+rMN+yYLv1gr1mGXvUi5v470Tpi5HzOqdcruXLHHQRSnvGrezFrdJLqqZ6X4cxAvEPSO/l3Noal/4YsdUhrw5uQUgOvxVInnNBSmPHqx2FFCEWaX/YKDMPAk1CUavFwKAjpT227q7shpSYFShnlnASLT4xtw= X-MS-TrafficTypeDiagnostic: MWHPR07MB3104: X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3104; 20:LxTgVGslaJWYqu0jJ8jrjSa1UX6P/Yko1bSml8IUeWQhrUMqTD7ZK7s3kQDezjV2At+IE8eUOWGYwpTAjFeBLR4t+26hE1URin0JmJmD2t//RQf4CiOW39yEQW8BSZC09Bz7mM5xlSeolIz5Rm/O2DavhdM5UEB1+N1d3DDz0Rfb6JvcpE7GJcAlfIyZ2zndB3gbkAoF4zjb6kSYAC7JDZnZ2bLRSOWkG0C1PupGDsyl7Q/fUF22PhdH74rtRy0EDLU80no3Va/d3AgDYcsF37NwykGNSDLIK/qUh/3KYi9s0TOX/Pi7oYjWp6E3O4BUi67budDms6pqzQ5Vz6Iv/dDcaET8pre010dVauI3o10ZDjaaMEhvc0GRjSNLWjLUQSEkmH39fFqZs05sELLNQf16xXolnO7WWhdOXxi8XKu83Zd21aAdfc4wq9K5R8F262lZK4K2entp7X6H0z3JKxISVMPPVYuhosLy0AxNBbq7TrLa2VVstTwihWO8v9aLCiPI4J0gj1dlo6E13MhZnDsxPIlznAK38TsKLmLTbAf8MOMDafwmlJk4BN8P0cFhOgPsrC7tD+OOJnHwfYuzNfv17WaqJs3vfYbp5pwERDc=; 4:DBAzdmIhA7tOxG3kgqWWtzB2hW+Rr0dxQKH2u+cEUcGiuR/XpsMc0OuStzS1xz6Vl3lz65Na/wCZQpP4BW+gsw9rhTq6V28ecWq8OyJcIxPZlmYghAw5lu5zH1ivoMJSkU9UMBN32PoDUcGZb5fEGSTsAxA6CqFTmZJDXO+0wv6lujrxPMhGWlPtXyEeWg/9Iutg8PUUd8NUqO0DiLsibKa+ajJXohV9GQfwtN2HkfNFEm79PJ/OrMQPj1036c1t X-Exchange-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)(100000703101)(100105400095)(93006095)(10201501046)(3002001)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123558100)(20161123555025)(20161123560025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR07MB3104; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR07MB3104; X-Forefront-PRVS: 0447DB1C71 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(346002)(376002)(39830400002)(199003)(189002)(3846002)(8676002)(50226002)(16586007)(5009440100003)(478600001)(8936002)(6512007)(6116002)(305945005)(6306002)(1076002)(6506006)(81166006)(81156014)(53936002)(16526017)(316002)(2950100002)(7736002)(5660300001)(66066001)(47776003)(36756003)(575784001)(8656003)(5003940100001)(42882006)(68736007)(106356001)(101416001)(97736004)(72206003)(105586002)(966005)(50466002)(189998001)(33646002)(76176999)(6666003)(4326008)(6486002)(48376002)(50986999)(107886003)(2906002)(25786009)(53376002)(15583001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3104; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; MWHPR07MB3104; 23:y+U7cQumbOO2i3Bq0KDjHLh2E1Iu2wfdqJD28iRPm?= =?us-ascii?Q?F+n4OhSDAOnpHVpBbelwL/QI6LKbXjkdTcedH8uWGfZbKHi8/reNQUX4IuI0?= =?us-ascii?Q?ESOKeaqS31b8f5GYCXt3A3Hb7TDHofs9age0r49f3kgNKFCsQ/BfPYFm5pJo?= =?us-ascii?Q?+/ZxN0K9F0azXNYgOO7xCotIHyY9JAFZMOfpfmhWlF9kiT1uV28iC51kTX6/?= =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gHAvQljwaZTFsIGUoJ06HkLIDd4Rsl8HAsu4ly5+Fj9TiozcQQyR/Q/OvxL0Xxwb6YNJHJwgXQitofk6K8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2017 09:15:01.2849 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3104 Subject: [dpdk-dev] [PATCH v5 2/2] ethdev: get the supported pool 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: Sun, 01 Oct 2017 09:15:08 -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_pool_ops_supported() API, which allows PMD driver to advertise his supported pool 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 --- v4 --> v5: - Incorporated wording comment perv 4 feedback, refer [1](Suggested by Olivier) - Note: Implementation assume that if PMD does not implement _pool_ops_supported() then library will return '1'.. assuming that PMD supports all the pool ops. (Proposed by Olivier) [1] http://dpdk.org/dev/patchwork/patch/28596/ v3 --> v4: - Replaced __preferred_pool() with rte_eth_dev_pools_ops_supported() (suggested by Olivier) History, Refer [2]. [2] http://dpdk.org/dev/patchwork/patch/27610/ lib/librte_ether/rte_ethdev.c | 18 ++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 24 ++++++++++++++++++++++++ lib/librte_ether/rte_ethdev_version.map | 1 + 3 files changed, 43 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 1849a3bdd..f0b647e10 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -3437,3 +3437,21 @@ rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id, return 0; } + +int +rte_eth_dev_pool_ops_supported(uint8_t port_id, const char *pool) +{ + struct rte_eth_dev *dev; + + 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->pool_ops_supported == NULL) + return 1; /* all pools are supported */ + + return (*dev->dev_ops->pool_ops_supported)(dev, pool); +} diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 99cdd54d4..c65b64d40 100644 --- a/lib/librte_ether/rte_ethdev.h +++ b/lib/librte_ether/rte_ethdev.h @@ -1428,6 +1428,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_pool_ops_supported_t)(struct rte_eth_dev *dev, + const char *pool); +/**< @internal Test if a port supports specific mempool ops */ + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -1548,6 +1552,8 @@ struct eth_dev_ops { eth_tm_ops_get_t tm_ops_get; /**< Get Traffic Management (TM) operations. */ + eth_pool_ops_supported_t pool_ops_supported; + /**< Test if a port supports specific mempool ops */ }; /** @@ -4470,6 +4476,24 @@ int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id, uint16_t *nb_rx_desc, uint16_t *nb_tx_desc); + +/** + * Test if a port supports specific mempool ops. + * + * @param port_id + * Port identifier of the Ethernet device. + * @param [in] pool + * The name of the pool operations to test. + * @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. + * - -ENODEV: Invalid port Identifier. + * - -EINVAL: Pool param is null. + */ +int +rte_eth_dev_pool_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 07f9e17f6..6b217119b 100644 --- a/lib/librte_ether/rte_ethdev_version.map +++ b/lib/librte_ether/rte_ethdev_version.map @@ -192,5 +192,6 @@ DPDK_17.11 { global: rte_eth_dev_reset; + rte_eth_dev_pool_ops_supported; } DPDK_17.08; -- 2.14.1