From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0046.outbound.protection.outlook.com [104.47.33.46]) by dpdk.org (Postfix) with ESMTP id 09BDC8CF6 for ; Tue, 15 Aug 2017 10:07:59 +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=IPbkq74VcKOJWth77+DzU70l01HH9lcLSNYbFabpNXw=; b=DCBNVY2w/JNump0RM22yomQ7dteH7Ls1E4cNAnZ+jlT8rtpeRY7BoqvPOGN7eB3ciiXhqLPFO+uz0sTIbdtqls2XSnjmcY0ePGvFrGPzyiVDqPc9LAuGKdhZi1v6c2o3e/R8shA6z27I2ca7D8XCVpAYdbndCTtyzfDGOJjf4Vs= Received: from localhost.localdomain (14.140.2.178) by MWHPR07MB3102.namprd07.prod.outlook.com (10.172.95.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1341.21; Tue, 15 Aug 2017 08:07:55 +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: Tue, 15 Aug 2017 13:37:17 +0530 Message-Id: <20170815080717.9413-3-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170815080717.9413-1-santosh.shukla@caviumnetworks.com> References: <20170720070613.18211-2-santosh.shukla@caviumnetworks.com> <20170815080717.9413-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BMXPR01CA0016.INDPRD01.PROD.OUTLOOK.COM (10.174.214.154) To MWHPR07MB3102.namprd07.prod.outlook.com (10.172.95.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80cb5338-9f87-4830-59b5-08d4e3b4bde1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:MWHPR07MB3102; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3102; 3:JzPNiyvHJoMlG0iQ/5P5upM8BNonfoqYRymZTK3hATJmeBxFYHPlQBusi8S8OdZPQ3USXJCkq0dtPUWfCOokCk+gOUmq96IpnF4h+s2LenewIaeSMlNVnDNBscOXC3Nvh0Bk1uRB4uNjIA8iadlxJk+zueDyJwul0uB3jML5ZV3Lxd81fRdY4mhN61ANOfz7umEzMQ6pjKFAkhCNOnmm4EieWqW3upZrHGQRv2TO5OMB/XbAFLC5roYekKI/hY46; 25:B49xNMaEC3/JrwgVv+MAb33+WATEkq+mWLleoxkBI0WBjecDxmrmTaALUsp+fjNnq1pOaDRqKfF2IlR8pMhB4+k1b0jLSl7w8LlxYzwUh9GcB5rRRg63a5nqSyLM1+MPSaqXO62sm9dZHWGypzMPBkkzsmWjTW5/vlt5/+OQqZSoeKzHkuCvR3nmKFdFR6UIgLvce8fzD1yYzjrmBW1R32MOtiHKln24KGepKjOj9qGubcCFacYhvbgfnsbeY2R7Pn8ROkS2v/Z/TxZ96/nY8nJPPxZnKxBGHK7c4eRdWg0aQ0ixBIyAuKvBf4ZvRFOfslYzqKKmjKUDnUg14RnN6Q==; 31:L/tQ5V/iu0UptNTseThp4eEXwXPC6tzIm84kSah1sdSzCHYZB6BJKOcRVfJyCmuHrDa+Dtk/IXofz/+yccnra1NtabL0I7x6qksfxfGsTZkM6bwvdEhP8uuBuInQW7F6DLSDi2M1RXEG0GSLiMoX/TQ9G4d+mAfYittDpKcv+lsapIKbMBXSgnjuk7fIr76l6n1LPtpxTr8leBTAWqFDLRagWKDAh3KKS8jfz/8B+MY= X-MS-TrafficTypeDiagnostic: MWHPR07MB3102: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; X-Microsoft-Exchange-Diagnostics: 1; MWHPR07MB3102; 20:Y7ofWYH65WjSt5hQv5NGhBtwNrk5F2vf/fYCO//ljw9f5Rk8xw+0qxT0Kiq4BfoVBs5oSJf/Uh03oyxw2LoMPDix9qrEGeHTng3hf1OK6x1eNhV4qmy/jaTBa2LZE3mH6TTVnMZ9tltZpqGbEq3mjShVPFGO0EnOM5su96eqEW2BVQhUHgeLfcg3XAGDqiwaWRP9qtg71UV9YeTn5aX0/Clki7K76/9PRaaTSCx+EONSssK5Lj6kYXYXGNQW+mx0qTqgWUqlVDxzYquMf/dZp/VzKD7rLYqRQVGM/xb550B/c08CJW6VOYmbcUOAVV7IhOxkNvXsHE928xQqDLmg0woMcuVXq4Jp5fU4ma8FpXvem2c+UlzGsnMmIoRyLayVVo2gC+pmm2XBhkMxpkMxi0sNN/5islMa3wohvv3NkO5McPrfzVRk7ALLIAiRHdTDNEEyDKnhhTjDXXSi9T0unTWokyRx5rqnt5cMToKd74TxpZzhnr1tzlL5iBanhIMX+GsIF8um7B+bfaMMrol46H1mI1EViyuSxmqzLBnXTlEMpZ+KEfKKLH0gh3L2z4xx+DiZPkzDHqFXvE/Cu79azgxLvB2GXRnYJAhGqQ73gYc=; 4:twynCRVeIK0PNs6AkP4aNHqtSDCkHhFp9lttJg7pirqM5vqknUVwvWMjEjvGABdROMkN4hF5iXky8KakKDonqfHdSb/tnGJ+4tMRqDzEpcvwGcqh3GlM7KNgVUaOJtSqwWJ2MdZciI34FMSOr3Rv6lT5QTQLFas1mlOuM0vduqRYz8EAfbL2e7akf6+zKDkwfbNAp3PBuEdFrI2B70nFUl68iuOi7tG/7c5hXUwjX6cLh1tgvbv81RsFbHnb6r50 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)(601004)(2401047)(5005006)(8121501046)(93006095)(100000703101)(100105400095)(3002001)(10201501046)(6041248)(20161123555025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:MWHPR07MB3102; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:MWHPR07MB3102; X-Forefront-PRVS: 04004D94E2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6069001)(6009001)(199003)(189002)(6116002)(81156014)(6512007)(81166006)(305945005)(6306002)(66066001)(6486002)(50986999)(50226002)(76176999)(47776003)(8676002)(68736007)(50466002)(575784001)(48376002)(101416001)(33646002)(36756003)(6506006)(7736002)(53936002)(8656003)(106356001)(42186005)(2950100002)(6666003)(5003940100001)(105586002)(5009440100003)(97736004)(42882006)(107886003)(7350300001)(25786009)(53376002)(4326008)(110136004)(3846002)(72206003)(5660300001)(1076002)(966005)(2906002)(478600001)(189998001)(110426004); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR07MB3102; 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; MWHPR07MB3102; 23:ErIZ68SH/uM25akAf8H0GQvUsCc+Ad0xpxY9ZCSDP?= =?us-ascii?Q?uQDCgGlLx1RDSvvJ5gENhMcrv1Lkz6NIZeuv5ahvsqlwBUYGI6dv3EWF7Y2U?= =?us-ascii?Q?LgZtsYUPL4T2MrIFZeN/SV3eM9ByujHP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OP1cfbPgHGdhCbpxUvn1ynphXwrc3tgb2BU72a8OguESmqPgvyf6EDG9fLkU0imkOuGQAQN2iF99cChooTRZ673oSw0MKzXTJeSR7Fca16mErlQZscIIvyAvVqLINPzPyxjLkpIPr2Nazs++4Nc+8K17LCZuodG9GtMxL/P1V5wF/Hu23kzxVRpYg7SDM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2017 08:07:55.9738 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR07MB3102 Subject: [dpdk-dev] [PATCH v3 2/2] ethdev: allow pmd to advertise pool handle 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, 15 Aug 2017 08:08:00 -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 like to know `preferred mempool vs PMD driver` information in advance before port setup. Introducing rte_eth_dev_get_preferred_pool_ops() API, which allows PMD driver to advertise their pool capability to application. Application side programing sequence would be: char pref_mempool[RTE_MEMPOOL_OPS_NAMESIZE]; rte_eth_dev_get_preferred_pool_ops(ethdev_port_id, pref_mempoolx /*out*/); rte_mempool_create_empty(); rte_mempool_set_ops_byname( , pref_memppol, ); rte_mempool_populate_default(); Signed-off-by: Santosh Shukla --- v2 --> v3: - Updated version.map entry to DPDK_v17.11. v1 --> v2: - Renamed _get_preferred_pool to _get_preferred_pool_ops(). Per v1 review feedback, Olivier suggested to rename api to rte_eth_dev_pool_ops_supported(), considering that 2nd param for that api will return pool handle 'priority' for that port. However, per v1 [1], we're opting for approach 1) where ethdev API returns _preferred_ pool handle to application and Its upto application to decide on policy - whether application wants to create pool with received preferred pool handle or not. For more discussion details on this topic refer [1]. [1] http://dpdk.org/dev/patchwork/patch/24944/ - Removed const qualifier from _get_preferred_pool_ops() param. - Updated API description and changes return val from -EINVAL to _ENOTSUP (suggested by Olivier) lib/librte_ether/rte_ethdev.c | 18 ++++++++++++++++++ lib/librte_ether/rte_ethdev.h | 21 +++++++++++++++++++++ lib/librte_ether/rte_ether_version.map | 7 +++++++ 3 files changed, 46 insertions(+) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 0597641ee..6a0fe51fc 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -3409,3 +3409,21 @@ rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id, return 0; } + +int +rte_eth_dev_get_preferred_pool_ops(uint8_t port_id, char *pool) +{ + struct rte_eth_dev *dev; + const char *tmp; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + dev = &rte_eth_devices[port_id]; + + if (*dev->dev_ops->get_preferred_pool_ops == NULL) { + tmp = rte_eal_mbuf_default_mempool_ops(); + snprintf(pool, RTE_MBUF_POOL_OPS_NAMESIZE, "%s", tmp); + return 0; + } + return (*dev->dev_ops->get_preferred_pool_ops)(dev, pool); +} diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h index 0adf3274a..afbce0b23 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_get_preferred_pool_ops_t)(struct rte_eth_dev *dev, + char *pool); +/**< @internal Get preferred pool handle for 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_get_preferred_pool_ops_t get_preferred_pool_ops; + /**< Get preferred pool handle for port */ }; /** @@ -4436,6 +4442,21 @@ int rte_eth_dev_adjust_nb_rx_tx_desc(uint8_t port_id, uint16_t *nb_rx_desc, uint16_t *nb_tx_desc); +/** + * Get preferred pool handle for port + * + * @param port_id + * port identifier of the device + * @param [out] pool + * Preferred pool handle for this port. + * Maximum length of preferred pool handle is RTE_MBUF_POOL_OPS_NAMESIZE. + * @return + * - (0) if successful. + * - (-ENOTSUP, -ENODEV or -EINVAL) on failure. + */ +int +rte_eth_dev_get_preferred_pool_ops(uint8_t port_id, char *pool); + #ifdef __cplusplus } #endif diff --git a/lib/librte_ether/rte_ether_version.map b/lib/librte_ether/rte_ether_version.map index 42837285e..5d97d6299 100644 --- a/lib/librte_ether/rte_ether_version.map +++ b/lib/librte_ether/rte_ether_version.map @@ -187,3 +187,10 @@ DPDK_17.08 { rte_tm_wred_profile_delete; } DPDK_17.05; + +DPDK_17.11 { + global: + + rte_eth_dev_get_preferred_pool_ops; + +} DPDK_17.08; -- 2.11.0