From patchwork Mon Jan 15 06:11:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 124472 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp568683lje; Sun, 14 Jan 2018 22:13:05 -0800 (PST) X-Google-Smtp-Source: ACJfBosJKkAaqbtZQ/h07MOWIqbCZzFw6Pl35z+dj3Wh3g12U3a7367v5l5fPIO97r+Tk+s7yjTr X-Received: by 10.80.243.129 with SMTP id g1mr1160691edm.6.1515996785218; Sun, 14 Jan 2018 22:13:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515996785; cv=none; d=google.com; s=arc-20160816; b=nmt6GyEapitXHtjZpocobyR8oyk6I0QhbbG8hU3wT1WVKHdYaFIYEaFmyBAJXcvI9N 24yZ2L/Wt6qfVed97/1Y9hqSB/KRryrMvu1xUuuwAN4SRycIaQ6zkuTG9qAbAwIIckRY fP5I2V+OH5D6t1PQJJBSfz2ELmkXfM+Qtw42UNpSGzDiyr/nrl+dL9ovrMInvFIXqkln PJaTInl2fbxHzDP+g6uKe3+qkqc9cra9LiGvMPIkV7Z78WFUAsrC54TY9jY+mbRQyRjf /+BcrGNP5b4TEeJEJW0NZk4M00wB2fj4qWtfhZIkC4c+39tujNVAC4+BlgE/E8VG2BBX 8VKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=C1U3RSEeqKRCKDB/yxRtKXJjuyx8vUnXo92hkQlpa2A=; b=JF/Yhua6ZLgtyoE3hACw8h7TUqNVJhgzXkA/bRK6JQA62q4tWK0wrsO42NiWDTSVzR DKub6m7Ces+GaXqF73JFhEd0dVzjmQ86d5JimoA9FnogW04S8EBgQqg5i+CbsCedt6UD FVg8soAs7qz5gpmnXLRGbnglih+zbNGFcVajBFnqE1tOnHZ8uwgJxoA9zwe3Zou859TK XbU06mp90kFxR5LVesmF1fIpyoIU39DIzs8029nYfTAc/U/WxvHRWP4gv4mMtmrTi/Cg J5havb7YdCH8zERQXAegzoiDvBfBxMXkngp9t+yIt3Dka9B94Wj2CQutRwo8O8T/dWXi vZ/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id 6si9280327edh.127.2018.01.14.22.13.04; Sun, 14 Jan 2018 22:13:05 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A6117A495; Mon, 15 Jan 2018 07:12:35 +0100 (CET) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0044.outbound.protection.outlook.com [104.47.41.44]) by dpdk.org (Postfix) with ESMTP id 1F7157D19 for ; Mon, 15 Jan 2018 07:12:33 +0100 (CET) Received: from CY4PR03CA0004.namprd03.prod.outlook.com (10.168.162.14) by MWHPR03MB2703.namprd03.prod.outlook.com (10.168.207.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Mon, 15 Jan 2018 06:12:31 +0000 Received: from BY2FFO11FD010.protection.gbl (2a01:111:f400:7c0c::165) by CY4PR03CA0004.outlook.office365.com (2603:10b6:903:33::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Mon, 15 Jan 2018 06:12:31 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD010.mail.protection.outlook.com (10.1.14.74) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Mon, 15 Jan 2018 06:12:31 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0F6CKAH011776; Sun, 14 Jan 2018 23:12:28 -0700 From: Hemant Agrawal To: CC: , , Date: Mon, 15 Jan 2018 11:41:12 +0530 Message-ID: <1515996674-26338-4-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515996674-26338-1-git-send-email-hemant.agrawal@nxp.com> References: <1513333483-4372-1-git-send-email-hemant.agrawal@nxp.com> <1515996674-26338-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131604703514032424; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(396003)(39860400002)(39380400002)(376002)(2980300002)(1109001)(1110001)(339900001)(199004)(189003)(47776003)(48376002)(97736004)(77096006)(85426001)(86362001)(296002)(305945005)(356003)(54906003)(16586007)(316002)(53936002)(36756003)(498600001)(2950100002)(105606002)(51416003)(76176011)(2906002)(5660300001)(2351001)(4326008)(8936002)(104016004)(68736007)(50226002)(8676002)(81156014)(81166006)(106466001)(6916009)(6666003)(50466002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2703; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD010; 1:3vb1Gcz8tQYiSNPf6aBPxf0C7PtgLEBp2Qcuv8Gv37QjKYgq9rJkAZS0GSBi7PzX57nSic02BAA+PYJEMOTX86xYIs0qag9Ree+VsMGDkehFU8gBIakP5vvH1VT31gqi MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3a7944d3-fa8a-4213-7928-08d55bdef630 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:MWHPR03MB2703; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2703; 3:J6EFDk8CLZ4yblbTAGBuHcWG86JGTlpomRqMsBb40+24EwOG4VrXO+qFvbEwmacUIutE9n8vGEH+9atE8rzFDjZGzAPEFGQZ2K5qFcK54mTvFJnGJHWmOLMLBoUBDCWTzCRTiJt59C7e/EM3/xwGb6VvQJxRfusmHxkWiG1k8fqmlOkGB12EyN0ADDnMuhayq+Vh+9Fyug4wM+sRC3NaSrjkhjJl7gv85SZOcyf27Cskc7dQkhhtWI+pLSbAssl2Z/cVCS40Jw66O2BKHktg8gPpQtuDcGAsQqF5fsg3U/TJI2QbnH6U6DZ1vh9jUlKVzC/b0QS8PEegSFetx/WSD23nsuUTYYSrQzNIbGowcFk=; 25:Dq4vSUAi4oWcfl4steNJnzJnRbVHpQZ8BTLESSH3gV6dftaXr2mQrWWgXvgo41+vZmqbXsFZihdCEM3vSNpbbjjD4EPL4WoK5MVo69eJUcGCSCUeVAWspaPgsaYTklYgbE7Y1Kyj/eTz9qqPBKqTj3/x9PkxQYh/+t0GFzINDEJEU+QJkP83jyRPO90ueEMOZK4BB6/WhrRuyIqRXaft/T4VNLnaUkmRmZjiYF3RPbeGmewpqo9BLs0GdSmmXsiiaDqUbnrAeWmgiuDj+2X3FLtYYQg4wscRdLQE6BjYKlY+gPNnEfq8QedJokGb0CyNfV58GC+V/F+d6maBd2wPsQ== X-MS-TrafficTypeDiagnostic: MWHPR03MB2703: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2703; 31:/UhmZAN0kOjPb9BxyrWdG9H8YULWY6V4aBVXB6rZ8uNe8F9/F2TM4on1OfbeIaI5k0K7649OrtbYNxoJKh7vN5zLJ/+JhJpNcn3r8udeVMALB4IhsCCEldb3TO+1BMGcpvGRm4Xu4VqfCsDamzl97srm96K6nlP4YJiZW7/o5DBmxhd7HFj/zF1mrLRPy8u1xJ4PFaqGQSbIV5ErUpS0QzNyfnuo78RhEUnCLQWhxD4=; 4:A6315ucxFHHy3EJYVNQvpn2u7rS2YYiBf0Not/ReArDH1OfUEEk1X37VI9x+U4mtSpNs62Oj/0lcvggGCxzsGdtmPyPIDxl6f4cwk8sIXiTjw/31Y4Ax+O6XvfZYjyzJG/x2Q/N2DsaeXeWyDsg1Nmv+okAkZGZLOjllc91BehB+Oxp0Xa457CPR8x1HE3TVmyqYwudRRkM5OBpzlDByHMVFoP7uMLCSsKJ5rrj/T09ZaRiFV7Yf5v4QZOl/AvALTlEzNaQjRPpuSXGxG/sDcbsw8hl8W6Eusx1jhO4JHh2wobb5Jd0zi3n5omYg1vr2 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231023)(944501161)(10201501046)(6055026)(6096035)(20161123563025)(20161123565025)(20161123556025)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703151042153)(20161123559100)(20161123561025)(201708071742011); SRVR:MWHPR03MB2703; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2703; X-Forefront-PRVS: 0553CBB77A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2703; 23:euXv10DOqSEDjyjgipyoB/DUmZh8GnrrO0GYw1xyF?= CE9YCbvXjLP4bPy/N5eCbpk7nWZo+qFw3R3bJShNGqhRQfsmiuey8WQgIxMiXZ372tTcX/7j9QwBjErKPwKw9DriNh81C+Sh36E/NRNq/4TxIox0l/uz+oL5WL4N9Ujvp1jukHzGhjkcNxxEx8ZW2susxfrKwPDEAjgOe8IvgddzzO/WRpErXjRZTZ4mL4eWEl+bQ+ft7Bd2zSX+9yoP29wQ5E6uvsZtBjLLIL+k8YrJsDpvo7taieC9X25C6MAX5pJGs5xu+bjyL0vTxuHi90L2IJG4OO+Bwfp4RYkSwAxpHkEgpEAencffUDM4s50TyWIOSNoLsbENOaBrQRvy6FDcLgOfB8MzXiHCcMNFZT32Bp268q4tZ++nmVheI//zid6C7gCWRwyQqf4P1kI8SFfnj8mw8ajPDqBLatklzjh2YB/LvuSZee8pHWeDRZC3AsjOxPN4mOTRP55rB9n3au5kppg4bew6hubWH0Xl7CtCQiPdGsaUZ7RBYhGJKaFviKC4IU0H4wNT8Ip1uaCHQG/1HJFebovs7u8tfxfaevc9gJMs7u1thUJgyu+Ng4G9HEIu1QcDhLTUAl2KSJKGKng+oFNSVoHEaz/Iyw1+44siUSzIczYp0L6DVZLkth85l65wbsaZ3JY9BDn71T7fWxisu2u44Iy6sgntpmpTBqAYSpnrk8Ez6ZVdzbLEPlCUTrkuNcswYSicwt3aBbXTs602Wa9kJLksj9ail+JjMxwTF48aMZPVrcCGlMOxJNq2ggBfgFMamYfk2efzwZFLyOrOfmo/sQr+Dp4vk82FJnw7KIrxkdEpIblV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04j8/FFi73ULfmTS0oAPhY29pel5eGxI374+7NqYi0mpAKloPXJFP0L+Hsy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2018 06:12:31.2160 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3a7944d3-fa8a-4213-7928-08d55bdef630 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2703 Subject: [dpdk-dev] [PATCH v2 3/5] mbuf: support register mempool Hw ops name APIs 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" With this patch the specific HW mempool are no longer required to be specified in the config file at compile. A default platform hw mempool can be detected dynamically and published to config at run time. Only one type of HW mempool can be active default. Signed-off-by: Hemant Agrawal --- lib/librte_mbuf/Makefile | 1 + lib/librte_mbuf/rte_mbuf.c | 42 +++++++++++++++++++++++++++++++++--- lib/librte_mbuf/rte_mbuf.h | 20 +++++++++++++++++ lib/librte_mbuf/rte_mbuf_version.map | 8 +++++++ 4 files changed, 68 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile index 398f724..85c4f9e 100644 --- a/lib/librte_mbuf/Makefile +++ b/lib/librte_mbuf/Makefile @@ -7,6 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk LIB = librte_mbuf.a CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 +CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common LDLIBS += -lrte_eal -lrte_mempool EXPORT_MAP := rte_mbuf_version.map diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index c085c37..fd3b6f5 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -58,6 +58,7 @@ #include #include #include +#include /* * ctrlmbuf constructor, given as a callback function to @@ -148,6 +149,43 @@ rte_pktmbuf_init(struct rte_mempool *mp, m->next = NULL; } +int +rte_mbuf_register_platform_mempool_ops(const char *ops_name) +{ + if (internal_config.plat_mbuf_pool_ops_name == NULL) { + internal_config.plat_mbuf_pool_ops_name = ops_name; + return 0; + } + RTE_LOG(ERR, MBUF, + "%s is already registered as platform mbuf pool ops\n", + internal_config.plat_mbuf_pool_ops_name); + return -EACCES; +} + +const char * +rte_mbuf_platform_mempool_ops(void) +{ + return internal_config.plat_mbuf_pool_ops_name; +} + +/* Return mbuf pool ops name */ +static const char * +rte_mbuf_best_mempool_ops(void) +{ + /* User defined mempool ops takes the priority */ + const char *best_ops = rte_eal_mbuf_default_mempool_ops(); + if (best_ops) + return best_ops; + + /* Next choice is platform configured mempool ops */ + best_ops = rte_mbuf_platform_mempool_ops(); + if (best_ops) + return best_ops; + + /* Last choice is to use the compile time config pool */ + return RTE_MBUF_DEFAULT_MEMPOOL_OPS; +} + /* helper to create a mbuf pool */ struct rte_mempool * rte_pktmbuf_pool_create(const char *name, unsigned n, @@ -176,9 +214,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, if (mp == NULL) return NULL; - mp_ops_name = rte_eal_mbuf_default_mempool_ops(); - if (mp_ops_name == NULL) - mp_ops_name = RTE_MBUF_DEFAULT_MEMPOOL_OPS; + mp_ops_name = rte_mbuf_best_mempool_ops(); ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL); if (ret != 0) { RTE_LOG(ERR, MBUF, "error setting mempool handler\n"); diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index e4e3917..d26e8cd 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1081,6 +1081,26 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, int socket_id); /** + * Register the platform supported pktmbuf HW pool + * + * @param pool ops name + * @return + * - 0: Success + * - -EACCES: platform mempool is already registered. + */ +int +rte_mbuf_register_platform_mempool_ops(const char *ops_name); + +/** + * Get registered platform supported pool ops name for mbuf + * + * @return + * returns platform pool ops name. + */ +const char* +rte_mbuf_platform_mempool_ops(void); + +/** * Get the data room size of mbufs stored in a pktmbuf_pool * * The data room size is the amount of data that can be stored in a diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map index 6e2ea84..b8e258f 100644 --- a/lib/librte_mbuf/rte_mbuf_version.map +++ b/lib/librte_mbuf/rte_mbuf_version.map @@ -35,3 +35,11 @@ DPDK_16.11 { rte_get_tx_ol_flag_list; } DPDK_2.1; + +DPDK_18.02 { + global: + + rte_mbuf_platform_mempool_ops; + rte_mbuf_register_platform_mempool_ops; + +} DPDK_16.11;