From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0051.outbound.protection.outlook.com [104.47.33.51]) by dpdk.org (Postfix) with ESMTP id 9CD0F7D76 for ; Tue, 15 Aug 2017 08:08:27 +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=eeU4kwxJuA4m7eQDpHCabSKfg1NJDdnLN2sAwn/5hL4=; b=PgZJn61wErbU1xOFNhnBRhigbYRFvn2aUR+UylKgg68+f2cVst+bQCbFg4Lcn3JiNjsIrnh7k0y+pnV83f/0Qh7XJs3ttwhucTymY7nYvvyeWTL8YfxA44ntxrHv0s7EQIWLdTR6gn6Xa3TLTAnUFINx7dsNO+xASEguu7AQhFo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (14.140.2.178) by BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1341.17; Tue, 15 Aug 2017 06:08:22 +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 11:37:40 +0530 Message-Id: <20170815060743.21076-5-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170815060743.21076-1-santosh.shukla@caviumnetworks.com> References: <20170720134759.4680-1-santosh.shukla@caviumnetworks.com> <20170815060743.21076-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.140.2.178] X-ClientProxiedBy: BMXPR01CA0022.INDPRD01.PROD.OUTLOOK.COM (10.174.214.160) To BN6PR07MB3089.namprd07.prod.outlook.com (10.172.105.7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 15ebb2e7-5a03-41cf-5ad6-08d4e3a409be X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:BN6PR07MB3089; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 3:oRxVS8tyGfMTs/7f4Md2erLXxbdmBBe+WRLu01faOSdLxQErdGzisphb1uZjqLK3exdWubW/GxLcv4Jlp8oHvGxQQuZicTwsxL1Q01DglFPTuX8mE1zAWnhG0GR6z4TxDWgUToN7sq+AcqV9vJdXAGCpET0qesSPNVHiZYkyv7m5JRWgWaX2YdwHpRchP0rH9qiuyTKLDle82x5mmORFDY2d0iA7ZcF0fVKEpEpn95NalqK2hFOQIylJquDUZd/I; 25:cya4DCeBnqIDnvaXV0oCr3NXlhwsqo95Jx8LuIFzvTUNGvgp8dv0YbVlYayUm7FpmFJ3mY+GDsbrtgRB9PFtNzt4fA/wTyHoepxyJSs1vjNBxro2TqVqTuDzfRFWAEonDaoGfKtyF0/20zQUuBRAYBo4ipoVfyNJDxC3VfJpdXrGBRboim1ynSPcY1RF2RnTl2vBWuiMCgB9iXWnVl9PuDBfTewGGojJi+RWb0J+KgTOzSGB8boh1ywfcw/5Ma9uoDilhwIBaqPuIohDPQ+7vk5eKPIJIYSl4zzKP2jku2aqJ1GldZE5rEiXuhHodl6vjOn6loiHmxqKFBdb3eE84A==; 31:sno6iD+Pg2bjIZtMrhqXHCSb0zjX61jCID9U+KYi0wjnd3WdXVqxaw7VZZ6qJm9gMhBvYO2qUwZ0hxKlfKoOQHdCMGjhxzF9FxSBM2YTCMMsstgGTdXhkaVFcA7WhuAM0c1UxNwImXD1ASzmrQbcoqZvjlM7HgvRZNeEA3Qw9G5HC7X7KDEmxFIwbgGNdqeQn8RZxVFlwDtsNqscrOxmpdQ1mPESekXugotX1o+6lL4= X-MS-TrafficTypeDiagnostic: BN6PR07MB3089: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3089; 20:FQu6M8POxpHhp4Ea29buWrc7hTM7650owpX0RJFJvAtOzZr87kPMnG9nUAU/WiQQf8cJmN6hgjfegLMwhrdik70HTw3sAytJsAYwrnA0epod6IIURl/PZooo/DUfmpoZzy4r/vZOT3PtzyrL24BA8BFbMCHBVi1qt8dMtdo/VsmY0Yq3tnLrOESrvflzBgbGY3XJK6U8AMVuyLfKOPGmBOTfwVKLWBuXITQ45pJieaVEeSQ53ZVTtjetSLraIi4scDbcLRQ27u1jQzsGQsSi9pEzrSm94c6OboJny5QHSiy9NehkgNfwUNrWJZ6kFt4EDfxQ8V73GqUHbOkMPxRV9oKAyhCQMSwYGM6Pt7ogj7s9oXvCakomUV+uW+cZCLH52ngP4FSJkYiUoEQQyWPjegNyBkrCP3YsLXxzHngAEsqrlLqvaf9z5+EMjUEwXwc/O4ciGVaRDpgIp8GRT6rzfoio0Xcq4Tgyrfzf6EqZCLk5evk5YiFFz1O4w3EsVoA5OiUTfxqkeuJR9MdRH6JLIhDRSfiZZL4Ty1k0s0SCsMqzjWCun1pQhm8NX9opAnXPldygBVZui1Bf9mkuilQJg24LFmp/QjxhI063esL+72Y=; 4:F6UHhc8jcQq00n2t8UHT3JiJDUrUu7ueRBlzzYisFD9xie3wLhtKVIY/UH2ppl20yS4NfVhh+P1ugszKUVOv3EN/ncSnfxDZVW1qzMjfi6Y3YLSzhmsKAtPygDhIdHurCjvblS4OZFnM9yxAx8Icw7C16kPkQTjSh3GxlqhqV1earJeK9PbR5KtsgXWAM+PYV9NwngORTkux7Pq1CIz3HRhANzTemQiySyBR44jSgXKR2kOESE+gxom494dgwbWD 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)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3089; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3089; X-Forefront-PRVS: 04004D94E2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(7370300001)(6009001)(6069001)(199003)(189002)(6512007)(106356001)(72206003)(6486002)(42882006)(6506006)(66066001)(2950100002)(47776003)(6666003)(48376002)(4326008)(36756003)(50466002)(68736007)(478600001)(25786009)(2906002)(105586002)(97736004)(5660300001)(7736002)(305945005)(50226002)(8656003)(189998001)(53936002)(8676002)(5003940100001)(7350300001)(42186005)(33646002)(5009440100003)(76176999)(6116002)(3846002)(107886003)(81156014)(81166006)(110136004)(101416001)(50986999)(1076002)(110426004)(15583001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3089; 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; BN6PR07MB3089; 23:wXH/m+OogDvFQg7ZSh8NPcZCdbZmkXkLHrErm2Uq6?= =?us-ascii?Q?f2VT7La0oGX3OH0SUo+4m2Pip+w+SYhTEc/1tfTLbzBv2zfadNnYkWCRlOQP?= =?us-ascii?Q?nQX3wel66b+x61yI6kKphdiiBOqSoeltQndcj1UN8ZnSDIoMNHK8ZU3eebON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M0hHCuLJTdB7EAZqql35rlcy3OxVp1p5azG1eD2ILTepZBCKoW2Z4y/uLVx7r1PxvLqgf522peOI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Aug 2017 06:08:22.1038 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3089 Subject: [dpdk-dev] [PATCH v4 4/7] 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: Tue, 15 Aug 2017 06:08:28 -0000 Allow mempool to advertise its capability. A handler been introduced called rte_mempool_ops_get_capabilities. - Upon ->get_capabilities call, mempool driver will advertise capability by updating to 'mp->flags'. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- lib/librte_mempool/rte_mempool.c | 5 +++++ lib/librte_mempool/rte_mempool.h | 20 ++++++++++++++++++++ lib/librte_mempool/rte_mempool_ops.c | 14 ++++++++++++++ lib/librte_mempool/rte_mempool_version.map | 7 +++++++ 4 files changed, 46 insertions(+) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index f95c01c00..d518c53de 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -529,6 +529,11 @@ rte_mempool_populate_default(struct rte_mempool *mp) if (mp->nb_mem_chunks != 0) return -EEXIST; + /* Get mempool capability */ + ret = rte_mempool_ops_get_capabilities(mp); + if (ret) + RTE_LOG(DEBUG, MEMPOOL, "get_capability not supported for %s\n", mp->name); + 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 74e91d34f..bc4a1dac7 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 capability. + */ +typedef int (*rte_mempool_get_capabilities_t)(struct rte_mempool *mp); + + /** Structure defining mempool operations structure */ struct rte_mempool_ops { char name[RTE_MEMPOOL_OPS_NAMESIZE]; /**< Name of mempool ops struct. */ @@ -397,6 +403,7 @@ 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. */ + rte_mempool_get_capabilities_t get_capabilities; /**< Get capability */ } __rte_cache_aligned; #define RTE_MEMPOOL_MAX_OPS_IDX 16 /**< Max registered ops structs */ @@ -508,6 +515,19 @@ 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 + * Pointer to the memory pool. + * @return + * - 0: Success; Capability updated to mp->flags + * - <0: Error; code of capability function. + */ +int +rte_mempool_ops_get_capabilities(struct rte_mempool *mp); + /** * @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..31a73cc9a 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,18 @@ rte_mempool_ops_get_count(const struct rte_mempool *mp) return ops->get_count(mp); } +/* wrapper to get external mempool capability. */ +int +rte_mempool_ops_get_capabilities(struct rte_mempool *mp) +{ + 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); +} + /* 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.11.0