From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0051.outbound.protection.outlook.com [104.47.41.51]) by dpdk.org (Postfix) with ESMTP id 6119E1B1BA for ; Sun, 1 Oct 2017 11:29:53 +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=UCnwzrmaJ7jIBcRfQkCi//ddaLcsprm6k+jRx19vKCo=; b=DAN4DiIeKapv24fj8EMD01yHI1Fp0k4HvDT2AACxO+MrirzZ5CPdSt8uE/swFy/alCqsdL5rNH5VGPzrfluRoPAwYjp4utt6gqgCn+Ro81Jw2yUtVQjZXiMjpHt2TiZD9B0GKTLn3pLxSC9PrzCymCU/XqNlmQcrvbIp1GDLeE8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) 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; Sun, 1 Oct 2017 09:29:49 +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:58:59 +0530 Message-Id: <20171001092902.10842-6-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171001092902.10842-1-santosh.shukla@caviumnetworks.com> References: <20170907153042.30890-1-santosh.shukla@caviumnetworks.com> <20171001092902.10842-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0077.INDPRD01.PROD.OUTLOOK.COM (10.174.208.145) To DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 01e31f05-d870-45f0-f49b-08d508aef831 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 3:6DYgI6KcFVcimAcoxo8nUY4f9YBCe8hiBC9OCh5ecttcLHJtKfZDbFHwO15GkjmChNiWFM4JzS4PhF2Fgzi9z6dYaX6Lmbm/x/52BMuWLgzu3t3iQwpn8YzRvi8yfKLSTUNuiEDzDxV/csixcjrUN2UUSU/hc+32MEhAQkAOs/9tzPqvveOFXMFGEV/MSnSWQDg+anFkilPEJhOQ4xEgnbQQN73PqIthO5Dy1AJHqNQjzaqZAfiCHmxYZzvSvMT+; 25:qJdD179OqWU60SUDfXfTdr/2iARjDZr81S5wTfcem5I8kLInj3W4OjkQufGzwI2zMAUjcNViMfGTtg2p6vnVZwa2A7Zt00NOrQTJv9bCqkChQLv/8jnFngdK/xxbpAINyfdf3VC7crChp5vIrsDWl2+mmYJncbTXnIxSHOLHwvNj9KOltjhk+bm+m72z9vIw37ufkkMBNdfWTaKDPYPCeg5WP2oBpEBX7nZPreJnZ5G67hmgKZZZz4V0MdMMVIBTM5ZooNph8p9sL6ixpG+h5sMiWpLHKFEJ+Kh1QG/5ZKl2mWTONxzLOpGsXZwyY3uuWAHnV29pQnL8C76P0F1epA==; 31:ngGi4wE33LsWmHPLnrd30NotINcvePTnsvEiF0b06+syuGL+DC0uHkchifZJWzUd/k/lks2+InxcvlABs3gIjTO1ad+CWOLzGmoy/k0sS0bCL08RtnTu5Rbj1I4OsGT1sFRpnvdbLMk/A3MHiogb/y0BfDhCdqTOtD5atZnv9MIakHBSivhV/QSIJAdtxNxbL5YrHmJ3R9EvFeTB3+IE53O2esPRG3WUPfFvZ8+lwQo= X-MS-TrafficTypeDiagnostic: DM5PR07MB3098: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 20:g3UixMK3hVJZz+tWXdsc3wNhms0F3Wg3ew8smgGmHCb1sLDVZLzzU89yLFPNlMxwQC6h3uZXs3/LwRpxYonzqQ9sc/BKhRVqsyPvOnE78dYogUJSlpiNKwUo/K1+Vkrk45npCIDcG5FBoW+Aicd6nhhGtOD8D84iSuweaobY0843c1zZTxdtvcquZEF6THCVa+iiOocyKJY1hgqEwWpNS/3Hap7A1V3k91qQMhcFAfXCyuyBEFo8+igSxuDygT9OBf2M993ZRa6fudrcgrMOuQmqHPKTlte2LL/NHn8dygWpGHf957WaDZhEyWJI/ci3dMVdXFNlBhwYVDi7VyzZuv7oF/nBn/wH942g10VTu2VcDAF5fJGq9nJk0WJVcrGaZL+SiIb9eCli/o4T84XEn57z6iQ+0WAHzG2vkEinn43vMJwPZ659F0VXP+cKbrpdhx0dEffHrt7clHkXaHzzD64ueHJhpaZk/f0n45HLmXdGNPo+Rv35+Sme0t3BM43TMwOhnhGWuWb11UuAn/+AwwohfF01acrvSRaqC1bo55O+npkZlh3aAW94Fgkh+16UFEsRUgXgpdDwysBHf7SbWgr+HSrlizW7dAL28a9RjKQ=; 4:lRrem9A98etdSEri3AC3uBW1huYW8IjpXIi9/HHbec+3LZ1p5JXB8M/iJ3lrXCSm+i5sYGf/U7aW8ytl1vCxp+xz1eiDkeTnrpT9uVRe/eBcPTwpcUXVNYy4KtBzYaEznaVpwpRAklDWpdi6J2sbNRgNbO23vDp65EIqXgfSBDNUGxhs9b50lX9ny6xbDvE3LBdRdBNeUNU8wxCVQM1zMMBbhQeI14/xHAw3CwcwwN+mv75XWvZzL5llDsJPb6gY 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)(3002001)(10201501046)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(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: 0447DB1C71 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(376002)(346002)(189002)(199003)(101416001)(478600001)(189998001)(106356001)(50986999)(81166006)(16586007)(81156014)(8676002)(72206003)(68736007)(42882006)(50466002)(8936002)(5660300001)(16526017)(48376002)(8656003)(2950100002)(2906002)(105586002)(66066001)(3846002)(6512007)(1076002)(36756003)(47776003)(316002)(76176999)(6116002)(4326008)(97736004)(53936002)(5009440100003)(25786009)(50226002)(6486002)(107886003)(6666003)(5003940100001)(33646002)(6506006)(305945005)(7736002)(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:2XcKlXZ71koFctBaVgTq2bca4Wuje5InWKPjKyjyr?= =?us-ascii?Q?e+wRbKkGsorQv7X//76YnD3MbHKqJ9V+/yqkC34zJLzPbd06Lf4495ZJDpcX?= =?us-ascii?Q?pAhorUM9RIvbS+Y1d+HI1aQCFBGFsiUhl4S11cP4/2ZiuWuHuyymElsJlEL1?= =?us-ascii?Q?IvIGqFyjgbdnqV1ueNeoCyLcQiYgsiqW8/X0ZRzs1CI0q4BZsKhJM4PBPSfG?= =?us-ascii?Q?G3Z74g/UIXvGi1D6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g3EhTqFu4hBkRX3dVdgB?= =?us-ascii?Q?4zG8x2rRV9SaTFXpenowIbngI465QydNaI/DlFvPLAYTNvYgVBVd8AKi9PBr?= =?us-ascii?Q?/5sdp0Q04bd2Uk=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 6:QQNZjJrPy/C2bXS3AA8wsTK536S6gQvmdHiDXeIFvlNyj6MCLirm7lqri33j0gXo/UAhsK5iyCIC5pova0K+LiG44VMOmPBD9odZrMHrgxsFZTw10yGPxPBuP3jdc1Iv3SBsUjjsFYw3HDC+uTJR4dbKQLp0QMt4ECjT6ZQr3wXrS/ZAd74Zd1SQcuibuhr+6cjAE0nDbI+nYZh7SLJ7j/qA0aYfMnhcVoXllsjihHH79VIKP0p4W6/XJnjh2dwSJXhQq/zfRBCH0DbFGj77EX8MHBuSPUQA/dGmDwwNxu8bvhxnW79mIgSS/i0C1mPLtVvQd6uRqDyKrI/r7GuYLQ==; 5:hlmjo1ctyAb8T0H6/4ak2YsxwRr9HeeaMhSM5i+u3DjcKgWepGPh//jdhofUTimYp22ihvvAiDD2p+5MLDOR3n2dCMieyC3rlcmLWLQl+5RGnPtO+EYfwxg8oKafBFyJ6DUIqpfbFmu6npKCMEiqOQ==; 24:v7vG1ObqgoGq8SbWqLr67afLX78Kvc78lhzDj2LGWqfKYMemMcMuoJUYxzvnX5FBs9yo5sDZHV08jOtvaU4Bg7k23o2Fa+xu/BVON5JU4ds=; 7:rAzRwxy/MFS2v7KGZx1K1aZPZ3jsFL3quIdZRmTNWZ5KGX3KY7EyZIoayM1zeCMW767o7jfJyXKcSslDej5QM2dXNEJgK+mDQXiw931+vKhbWW3N4rJ5YxWf5IC2veDo/hpcmf8eks6mdXiJxT1YSUyOnLss797SisFpnp2M1WhHUOniaLy0RS0TAmpuzV/W45dJbD7uKoNsdeQwkDV9trxAxqyd4II1lndqjZ2TnnY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2017 09:29:49.5914 (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 v7 5/8] mempool: get the mempool capability 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:29:53 -0000 Allow the mempool driver to advertise his pool capabilities. For that pupose, an api(rte_mempool_ops_get_capabilities) and ->get_capabilities() handler has been introduced. - Upon ->get_capabilities() call, mempool driver will advertise his capabilities to mempool flags param. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob Acked-by: Olivier Matz --- lib/librte_mempool/rte_mempool.c | 13 +++++++++++++ lib/librte_mempool/rte_mempool.h | 27 +++++++++++++++++++++++++++ lib/librte_mempool/rte_mempool_ops.c | 15 +++++++++++++++ lib/librte_mempool/rte_mempool_version.map | 7 +++++++ 4 files changed, 62 insertions(+) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 005240042..92de39562 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -522,12 +522,25 @@ rte_mempool_populate_default(struct rte_mempool *mp) size_t size, total_elt_sz, align, pg_sz, pg_shift; phys_addr_t paddr; unsigned mz_id, n; + unsigned int mp_flags; int ret; /* mempool must not be populated */ if (mp->nb_mem_chunks != 0) return -EEXIST; + /* Get mempool capabilities */ + mp_flags = 0; + ret = rte_mempool_ops_get_capabilities(mp, &mp_flags); + if (ret == -ENOTSUP) + RTE_LOG(DEBUG, MEMPOOL, "get_capability not supported for %s\n", + mp->name); + else if (ret < 0) + return ret; + + /* update mempool capabilities */ + mp->flags |= mp_flags; + if (rte_xen_dom0_supported()) { pg_sz = RTE_PGSIZE_2M; pg_shift = rte_bsf32(pg_sz); diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 85eb770dc..d251d4255 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -389,6 +389,12 @@ typedef int (*rte_mempool_dequeue_t)(struct rte_mempool *mp, */ typedef unsigned (*rte_mempool_get_count)(const struct rte_mempool *mp); +/** + * Get the mempool capabilities. + */ +typedef int (*rte_mempool_get_capabilities_t)(const struct rte_mempool *mp, + unsigned int *flags); + /** Structure defining mempool operations structure */ struct rte_mempool_ops { char name[RTE_MEMPOOL_OPS_NAMESIZE]; /**< Name of mempool ops struct. */ @@ -397,6 +403,10 @@ struct rte_mempool_ops { rte_mempool_enqueue_t enqueue; /**< Enqueue an object. */ rte_mempool_dequeue_t dequeue; /**< Dequeue an object. */ rte_mempool_get_count get_count; /**< Get qty of available objs. */ + /** + * Get the mempool capabilities + */ + rte_mempool_get_capabilities_t get_capabilities; } __rte_cache_aligned; #define RTE_MEMPOOL_MAX_OPS_IDX 16 /**< Max registered ops structs */ @@ -508,6 +518,23 @@ rte_mempool_ops_enqueue_bulk(struct rte_mempool *mp, void * const *obj_table, unsigned rte_mempool_ops_get_count(const struct rte_mempool *mp); +/** + * @internal wrapper for mempool_ops get_capabilities callback. + * + * @param mp [in] + * Pointer to the memory pool. + * @param flags [out] + * Pointer to the mempool flags. + * @return + * - 0: Success; The mempool driver has advertised his pool capabilities in + * flags param. + * - -ENOTSUP - doesn't support get_capabilities ops (valid case). + * - Otherwise, pool create fails. + */ +int +rte_mempool_ops_get_capabilities(const struct rte_mempool *mp, + unsigned int *flags); + /** * @internal wrapper for mempool_ops free callback. * diff --git a/lib/librte_mempool/rte_mempool_ops.c b/lib/librte_mempool/rte_mempool_ops.c index 5f24de250..f2af5e5bb 100644 --- a/lib/librte_mempool/rte_mempool_ops.c +++ b/lib/librte_mempool/rte_mempool_ops.c @@ -37,6 +37,7 @@ #include #include +#include /* indirect jump table to support external memory pools. */ struct rte_mempool_ops_table rte_mempool_ops_table = { @@ -85,6 +86,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h) ops->enqueue = h->enqueue; ops->dequeue = h->dequeue; ops->get_count = h->get_count; + ops->get_capabilities = h->get_capabilities; rte_spinlock_unlock(&rte_mempool_ops_table.sl); @@ -123,6 +125,19 @@ rte_mempool_ops_get_count(const struct rte_mempool *mp) return ops->get_count(mp); } +/* wrapper to get external mempool capabilities. */ +int +rte_mempool_ops_get_capabilities(const struct rte_mempool *mp, + unsigned int *flags) +{ + struct rte_mempool_ops *ops; + + ops = rte_mempool_get_ops(mp->ops_index); + + RTE_FUNC_PTR_OR_ERR_RET(ops->get_capabilities, -ENOTSUP); + return ops->get_capabilities(mp, flags); +} + /* sets mempool ops previously registered by rte_mempool_register_ops. */ int rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name, diff --git a/lib/librte_mempool/rte_mempool_version.map b/lib/librte_mempool/rte_mempool_version.map index f9c079447..3c3471507 100644 --- a/lib/librte_mempool/rte_mempool_version.map +++ b/lib/librte_mempool/rte_mempool_version.map @@ -41,3 +41,10 @@ DPDK_16.07 { rte_mempool_set_ops_byname; } DPDK_2.0; + +DPDK_17.11 { + global: + + rte_mempool_ops_get_capabilities; + +} DPDK_16.07; -- 2.14.1