From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40055.outbound.protection.outlook.com [40.107.4.55]) by dpdk.org (Postfix) with ESMTP id AE31134F3 for ; Wed, 2 May 2018 19:15:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mcqx1OSdjuBh69RftQWlV+/vvkMyf7HwgaJBfhIhfLE=; b=byjkMc9S78uJwvqKd5qwcrtsifgcYbifPkUrZyH0dVV/75UHKK6YHX7YfbE1f6pwbhpBStlIEp2EJNwznYuI9imrj0NNSZ7LrMLUx814qnb72Zc6ODuuov5CCyFmLIdO4/WzmblRzyH2KuwAlzEr6lsdEsVJ/ZuZBeqex150c8c= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=nipun.gupta@nxp.com; Received: from b27504-OptiPlex-790.ap.freescale.net (14.142.187.166) by AM4PR0401MB2419.eurprd04.prod.outlook.com (2603:10a6:200:51::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.715.18; Wed, 2 May 2018 17:15:52 +0000 From: Nipun Gupta To: thomas@monjalon.net, hemant.agrawal@nxp.com, shreyansh.jain@nxp.com Cc: dev@dpdk.org, Nipun Gupta Date: Wed, 2 May 2018 22:45:23 +0530 Message-Id: <1525281329-27984-2-git-send-email-nipun.gupta@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525281329-27984-1-git-send-email-nipun.gupta@nxp.com> References: <1524737696-3145-1-git-send-email-nipun.gupta@nxp.com> <1525281329-27984-1-git-send-email-nipun.gupta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [14.142.187.166] X-ClientProxiedBy: MA1PR0101CA0001.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:21::11) To AM4PR0401MB2419.eurprd04.prod.outlook.com (2603:10a6:200:51::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060)(7193020); SRVR:AM4PR0401MB2419; X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 3:dslZosOIZZvvbwKbFLGMVgntJTAo+i5C4mJHB/NAz9uVzUuHph7fXOcS+Cp5GUKkUAswH+lTb0tVnzPrfwLlqyDwfZ45i7Bjs4PUZp8aTCsENwUpnB8hbv0hhsDRsPighEFcm5p1IOFNgLD22O7VCEBTJ3w8698PAGYAizCJ3/aIFNfYdvAWR2N8tV7j91z61HqEdXB8dsOt6ME9CiCaIstdF3HFdlcaD7duxZQRktHfkS6EYdnPgPlPcw/5/+uO; 25:x/65WA0K6LMh36xDnT7AtBm01NQEUUDSlXkxwjYUagVmECdUjMNFa+wxm5h5QcuJnQl+8am/twrrcAJEa6sXEGhehITCNdIp7rJGbudtyTOA4vskIrY0gEFPGh9XtRqwy4y0hsmoKQkGBApNRMmUT0KaD12NbcXwA6sSGWTJjr4CTguN5BknTsPNH1NgRh5W/uiO1CIoGN5oMovEHaQdoJQf+QJ8kVT5puVwGEOXeitQjdqhfA5u744yWow/Qakn1h0IxNs8WiN6X6IrRw5abCswor9hzjSMvLDp+jCFzAD52gM7wA6iAusQmH/Vha3BvWrARdREJtTVnoku9iIOkw==; 31:+2RUgrBnwsSh7synpe8XmJems80Rw4heMuIBxTkFLZ7HDTH1RWrt9bmZt7Avk4uOoaQ7nFnCFNqvXiqVIzOPDzGD+hhXjjLru9YK9h69tfEtKLppWM/ONjhrCyqKtsgV4EJ8KvrvOfFjPO/+YGnN+BMr9D+SUyQHbrzjYeYSBORMbdpXHVc/BWuMAHTeHm1pVkUvp1fg3sK9B6rM5RxBI2qHRhwxenbDvDDJg4UKCiI= X-MS-TrafficTypeDiagnostic: AM4PR0401MB2419: X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 20:V9XqBwJyq314e7bakPUltv+bfw80p9gspvrUs/VjecmXT5jLN1aWFOSB4wTE3whRQqShIF922+vNeQakfsGlXZvS8XszlbOHTAqOc2teVcm6kqphRi7R2+r9vaGbzhAF65X6B745QLDNiZ3wBMUkLWLAzw9ozFKMsvsQR7jSsU9HGXY/BZDDQredisEPquG0znaTG74kzUdjR80y2VuvvmejZY7S9lGnB0H9Rr9qss16sexBuMZC4rAJKzT/K901MJwjk7U/OFAtfELFtYp7DFJcEOikP5dEPi2VnUdOrxpFzllgdvDfWsYx0r01kEVs9yO/8sfCIf8makBK+yshc87TGiaaBVe2oMjLWFVXPInDh4Wi3fQYGXs5KQFcEncV+oxIRWSBHAP4TtFU1x40FXus0HYC8r86xOoPhn0+9kGi9XORjib06FjbbLfx9Kx4b/lXOLC0b750oWLY12ir0jcrH66eHVSc69SJK4GGEyGJ/o2gllMR2EVIIWuAhE+a; 4:1VoxRoL2+i0XJnN3HcyII20oqUvKa9Pr+o9juQHtvq1MLeOfZldtMMpAM4RhSPPMVAh0T+bvJGLWLG75vwLaHzRYAvDIb55uawxqqaVeoIhv0p4LUVjQJ7MEh+JQjaeYnIVkhRphsmB5in8V0zy1T2eYBu5/DuAZnmJ6qqlkmCDVPRPsEz3mOf8zs7uYMAs1ie6vFLqAscwpF2U/UwRkB/mkSweSMA5eoWuV2eshvHHaH68Y+dCRxlGNFovy4yD27q93xetmUR9lE6Aa9DDsy7aZaZuwqhy0vfN8+7Uto4nAtuHOz3o7dv/+DrtnXI7CusapahjPURe4+WXo66IXFyrRCQuBGryMOR02FJrX1wg= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397)(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:AM4PR0401MB2419; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0401MB2419; X-Forefront-PRVS: 06607E485E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(376002)(39860400002)(39380400002)(346002)(366004)(199004)(189003)(575784001)(956004)(316002)(16586007)(11346002)(3846002)(5009440100003)(6506007)(305945005)(4326008)(6636002)(476003)(97736004)(5660300001)(7736002)(2616005)(48376002)(53936002)(50226002)(86362001)(6512007)(50466002)(6666003)(486006)(446003)(386003)(6116002)(36756003)(55236004)(47776003)(51416003)(6486002)(106356001)(8676002)(2906002)(186003)(68736007)(26005)(8936002)(25786009)(81156014)(105586002)(16526019)(44832011)(478600001)(81166006)(52116002)(66066001)(76176011)(110426005)(31153001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0401MB2419; H:b27504-OptiPlex-790.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM4PR0401MB2419; 23:fWAdPDL+kiJxcsqbqT7Vi6ImDBPv/OVhoENLVlR?= =?us-ascii?Q?3ZLXY7WGOr/3nzOmK3qNkKI5C24ZQV2+1AMMUZI+wn6lu1WrImKpGByaDlYG?= =?us-ascii?Q?KSFAKj9rYmfq/bkxXMs8t8fsXrSokGyBoh0XKfEA1gmXx7Z0eZAq2bkvwbOI?= =?us-ascii?Q?1lpVTweIR55XaEoVMONcQWwEVG9KyVwOMCKg1k4mvAzNxqPvK3pbPqRzuVKx?= =?us-ascii?Q?w1/ausIjPZQnmPdjNMKE1/bx5oBzIrUnZQOT3O5v6rI1sRaF9k5Q9VSsrZvl?= =?us-ascii?Q?63+hCUDdF392GbylWU54VYTnzXJB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xfGYGqT8ofJsg=; 24:usUH+OPin3aaE+TLzDQc9OPilyObwUNJxfm0VoootuYqa36hMpgPKnD2Nja4TrWWrvg1Fqj9eRdqLwuro0TY4Ev0tTA5gsEF9soUsxKm1r0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM4PR0401MB2419; 7:4wstSEZX6+tZn/n0ftucu/okSA9JvcgJvvDMA5ZK/eU2MVPNJ3YCGTX5azzgLCbocUY02SoMyPCj3Ivl4XSs+TbWlarv03rh7LW2lY3dE1AszDfsqPavLyFuQRwohu6SSGe8BX3vruAq0aSb2MQGRMe4hEjmKBB1D5TUE4NR1n+mfiCBfy2n7XNal8LI8rdRPhTEWQs+9Bqu5sgmDZpylxoa9JJQrRbJPhyDHxlOXSfAH24smxTOXHNCHmf7mLWE X-MS-Office365-Filtering-Correlation-Id: dfbb97c6-ac8b-46a9-64e1-08d5b0505cbe X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 May 2018 17:15:52.8915 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dfbb97c6-ac8b-46a9-64e1-08d5b0505cbe X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0401MB2419 Subject: [dpdk-dev] [PATCH v4 1/7] mempool/dpaa2: add functions exposed to DPDK applications 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: Wed, 02 May 2018 17:15:55 -0000 There are two API's which are required by NXP specific Command Interface Application (AIOP CMDIF). This patch exposes these two API's. Signed-off-by: Nipun Gupta --- doc/api/doxy-api-index.md | 1 + doc/api/doxy-api.conf | 1 + drivers/mempool/dpaa2/Makefile | 2 + drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 30 ++++++++++++ drivers/mempool/dpaa2/rte_dpaa2_mempool.h | 53 ++++++++++++++++++++++ .../mempool/dpaa2/rte_mempool_dpaa2_version.map | 8 ++++ 6 files changed, 95 insertions(+) create mode 100644 drivers/mempool/dpaa2/rte_dpaa2_mempool.h diff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md index 437d903..12d3e5c 100644 --- a/doc/api/doxy-api-index.md +++ b/doc/api/doxy-api-index.md @@ -38,6 +38,7 @@ The public API headers are grouped by topics: [i40e] (@ref rte_pmd_i40e.h), [bnxt] (@ref rte_pmd_bnxt.h), [dpaa] (@ref rte_pmd_dpaa.h), + [dpaa2] (@ref rte_dpaa2_mempool.h), [dpaa2_qdma] (@ref rte_pmd_dpaa2_qdma.h), [crypto_scheduler] (@ref rte_cryptodev_scheduler.h) diff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf index 88bee03..71fb6b2 100644 --- a/doc/api/doxy-api.conf +++ b/doc/api/doxy-api.conf @@ -31,6 +31,7 @@ PROJECT_NAME = DPDK INPUT = doc/api/doxy-api-index.md \ drivers/crypto/scheduler \ + drivers/mempool/dpaa2 \ drivers/net/bnxt \ drivers/net/bonding \ drivers/net/dpaa \ diff --git a/drivers/mempool/dpaa2/Makefile b/drivers/mempool/dpaa2/Makefile index 5125ad1..9e4c87d 100644 --- a/drivers/mempool/dpaa2/Makefile +++ b/drivers/mempool/dpaa2/Makefile @@ -31,4 +31,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL) += dpaa2_hw_mempool.c LDLIBS += -lrte_bus_fslmc LDLIBS += -lrte_eal -lrte_mempool -lrte_ring +SYMLINK-$(CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL)-include := rte_dpaa2_mempool.h + include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 5d057fb..e12a0ec 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -21,6 +21,7 @@ #include #include #include +#include "rte_dpaa2_mempool.h" #include #include @@ -244,6 +245,35 @@ struct dpaa2_memseg_list rte_dpaa2_memsegs } } +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return -ENOMEM; + } + + return bp_info->bpid; +} + +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr) +{ + struct dpaa2_bp_info *bp_info; + + bp_info = mempool_to_bpinfo(mp); + if (!(bp_info->bp_list)) { + RTE_LOG(ERR, PMD, "DPAA2 buffer pool not configured\n"); + return NULL; + } + + return (struct rte_mbuf *)((uint8_t *)buf_addr - + bp_info->meta_data_size); +} + int rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool, void **obj_table, unsigned int count) diff --git a/drivers/mempool/dpaa2/rte_dpaa2_mempool.h b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h new file mode 100644 index 0000000..4a22b7c --- /dev/null +++ b/drivers/mempool/dpaa2/rte_dpaa2_mempool.h @@ -0,0 +1,53 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2018 NXP + */ + +#ifndef __RTE_DPAA2_MEMPOOL_H__ +#define __RTE_DPAA2_MEMPOOL_H__ + +/** + * @file + * + * NXP specific mempool related functions. + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** + * Get BPID corresponding to the packet pool + * + * @param mp + * memory pool + * + * @return + * BPID of the buffer pool + */ +uint16_t +rte_dpaa2_mbuf_pool_bpid(struct rte_mempool *mp); + +/** + * Get MBUF from the corresponding 'buf_addr' + * + * @param mp + * memory pool + * @param buf_addr + * The 'buf_addr' of the mbuf. This is the start buffer address + * of the packet buffer (mbuf). + * + * @return + * - MBUF pointer for success + * - NULL in case of error + */ +struct rte_mbuf * +rte_dpaa2_mbuf_from_buf_addr(struct rte_mempool *mp, void *buf_addr); + +#ifdef __cplusplus +} +#endif + +#endif /* __RTE_DPAA2_MEMPOOL_H__ */ diff --git a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map index 82a5ec0..b9d996a 100644 --- a/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map +++ b/drivers/mempool/dpaa2/rte_mempool_dpaa2_version.map @@ -7,3 +7,11 @@ DPDK_17.05 { local: *; }; + +DPDK_18.05 { + global: + + rte_dpaa2_mbuf_from_buf_addr; + rte_dpaa2_mbuf_pool_bpid; + +} DPDK_17.05; -- 1.9.1