From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0050.outbound.protection.outlook.com [104.47.41.50]) by dpdk.org (Postfix) with ESMTP id D29E11B261 for ; Fri, 6 Oct 2017 09:46:20 +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=WlcpVPiMq383P/DpvK7torWdxQ6lMf8ZemD8/aKLKNo=; b=lOSrz9hqA8OXu92gp7Sk7Jkh+Thhagx+LSTeckmyTsqnOgre1XOnpEbMhqw6ScRWeKEPqc0N1/6JwpC4aXWaJUxpGZqrgkzZaWmZeq1rvwvAi2UwtqdfyQYdUoBoUQM2X+3nztCqLalTojIqsfXpZOe1Pv1wBPGprYUf2s+w0Ns= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (223.180.6.162) by DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 6 Oct 2017 07:46:17 +0000 From: Santosh Shukla To: dev@dpdk.org, thomas@monjalon.net Cc: olivier.matz@6wind.com, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, Santosh Shukla Date: Fri, 6 Oct 2017 13:15:30 +0530 Message-Id: <20171006074530.12521-3-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171006074530.12521-1-santosh.shukla@caviumnetworks.com> References: <20171001091440.10232-2-santosh.shukla@caviumnetworks.com> <20171006074530.12521-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [223.180.6.162] X-ClientProxiedBy: PN1PR01CA0106.INDPRD01.PROD.OUTLOOK.COM (10.174.144.22) To DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25496fea-656d-4898-4fda-08d50c8e54ed X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 3:EWaf1xaPTU/UXau/apEj9QcL4stNjfHPtn0uIRmv0LbByQbBnRC5zCtlNEL5B0eP/JihpcaqyuyhDoUTwNfziIrGpjvF/Yo9B3bKp4I3FUT+XGddeNvskkkkvIlgtmaq1S7mVzrfAntbjIfOs+o0E4le4xR37FiaWCm9fIpr5FCpIuJagV3IhH2W/LDTsPWmUf6fcTjaD3lTzbfMMaq2e3mlnuxzBF4DiGKtN26pLJQ/GDmifls7cKF/hlszxHAc; 25:57HTlbea2tZQz/kQDK6jgpUxEycsfeEvKJayqFggIBYkVAAeyHX6jM06zthxcm1hrTXjTW7yjTkXI9nI3VP8gkZMsraJHaEOyd/t3hhNhTET/XJEDORdQlBhHBFfdYWjxhnQcoTvIolVvinQNp4klt9aQKtBDspk1yw7LZkIflT9ilWgceoQBPcZSlzPdI32LuqzI3hxuy/dkgT11OwsPAJc3wrfc2ZxqTH6W183VT2SAUy6iBuvJzHNdOtQSsZZh/q4meeIzpFQu+IjYjcudv6ep7BbjcnFf4u3YLBAhG+N9J2sTBn8pmAd/VpcdzjgtCMm1nnJZHWk+hEKImMhjQ==; 31:Y6iWZF9TVyp4QXc3Qin5ghQdyJPFEtfShB2VRgrsLghn6ipIrYg8qWYFgm4kYHXzNi0qbPGLZnjZ12qwOY6uOI8GGIuD6bWHox3ztDyaNULW79HKct25RvvqS9UudlJ1gBYs1N6R9PhmFdVuBYvn7IW35pCI/ley140hPyW9rfHZ/c21uAQbB7WRP3xX3UTx5HQ+QjPMnmwjdXfjJnEkjRqDXV1LeaLewo16foTpGuc= X-MS-TrafficTypeDiagnostic: DM5PR07MB3098: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 20:QE2A4YYdTAG426xShRyqAufhByb9cT0rZ6hxUfNXPZTiMLaRoAMy3PLMGgqjV1U4zRKVb2BJB2NUzwkORmkHjl52KCOBsfI2pJzeagvLX5sINyC3GsS3qV1aJho1HoEOE/fNfkSYrd9JFMyO2LUhkW1s2nT3n/fJXsnGozjh6zjE2m+er1JZLbTiYupj9alFeUmC3ktOShpFDCxh80Ync3sNiES0U24xLxrAcQyHersI/Fl2+7qXA6utgWE+LvNeNk0ntArgR+P7x4h4Wdv+rzDZddKSvdN3oe8dAgO/+x5/KBzJgo7UXrw8BW/EmIbHU6dla8OfJd0uhwiHtiRzR/O3oo+fg4Xj9YhieZJANWZNpyZB/P40OEZXYezdAbvuUGqh6njqjVUED5dh9NE8ZOeBGi+qutLAIO72YdASDCrIafbTXZAhnDZlzg7oEwS8Eif+J0zZWLroLxrQViHvAccR+vzLFebbw5+XCItJlF8kdH/zPdCbU7XYAl4Qs61GCINUW19FnF4YOOyX1PU78fEoppiNMfv6Ih/xkh3xge0faDJ/sevb4EXEXVDYwd6KWhV/nMNST4p9xDjGzoT3JUZrnwzt6FtmUr6bqERviIw=; 4:hKATO5V9LDP6npfVAp2ruJiDDj4QaaIzb0jytkto53PYGP7Ub5oX6rRQnKb1Exi4vvSS5Fu3X9oj3iMnYb5/mqsH/iJTVfhE5WgTt+ZKr17Dg3K+ag6ruWmNXwG4cLHhZyH1i7TsHw6GXWmzCFAmiHYxDHGQjdhjiPBqYvVa/lbSYVxhZHgtmeLer4i2nMymBouPUS4C2ptwE+ln1Sptl0u79NSYYFovmOBq77Od17R1WdHjvVcnW1BKNTJt4edB 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)(10201501046)(93006095)(3002001)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3098; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3098; X-Forefront-PRVS: 0452022BE1 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6069001)(6009001)(376002)(346002)(189002)(199003)(53376002)(25786009)(76176999)(66066001)(6116002)(478600001)(36756003)(4326008)(16586007)(8936002)(3846002)(316002)(2906002)(2950100002)(68736007)(5660300001)(42882006)(97736004)(101416001)(7736002)(81156014)(6306002)(33646002)(1076002)(575784001)(305945005)(6512007)(53936002)(81166006)(48376002)(8656003)(47776003)(189998001)(72206003)(106356001)(8676002)(6666003)(5003940100001)(50226002)(50986999)(16526018)(6486002)(966005)(107886003)(6506006)(50466002)(105586002)(15583001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3098; 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; DM5PR07MB3098; 23:5o2TqKWqakHj6XXrEQEipNXEStaTuPBJa6OfhShay?= =?us-ascii?Q?v09gCkI9S4spgWEVO8E4vQKKfZ2zszvuTG0w/cQ86q2XVwcZrh4G5SIsG7zF?= =?us-ascii?Q?yNttWI4iLi8VDxDJiqu3g7C61k6syeND3E4JIK9Dg1qhqNPePLXoHZn5PvCQ?= =?us-ascii?Q?JGtDMlA9z+lOGIn1C/zJxTcGaA5GPpiPfPXmw2m8hOLTlAVVcgoru5/aEmIH?= =?us-ascii?Q?JJ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DbTaDHwG8y8nMME15C4YpLf0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2017 07:46:17.0802 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3098 Subject: [dpdk-dev] [PATCH v6 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: Fri, 06 Oct 2017 07:46:21 -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 Acked-by: Olivier Matz --- v5 --> v6: - Arranged alphabetical order for rte_eth_dev_pool_ops_supported. (Suggested by Thomas) 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..92c9e2908 100644 --- a/lib/librte_ether/rte_ethdev_version.map +++ b/lib/librte_ether/rte_ethdev_version.map @@ -191,6 +191,7 @@ DPDK_17.08 { DPDK_17.11 { global: + rte_eth_dev_pool_ops_supported; rte_eth_dev_reset; } DPDK_17.08; -- 2.14.1