From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0054.outbound.protection.outlook.com [104.47.36.54]) by dpdk.org (Postfix) with ESMTP id 0B5BE1B01C for ; Fri, 15 Dec 2017 11:25:46 +0100 (CET) Received: from CY1PR03CA0029.namprd03.prod.outlook.com (10.174.128.39) by BN3PR03MB2354.namprd03.prod.outlook.com (10.166.74.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.302.9; Fri, 15 Dec 2017 10:25:45 +0000 Received: from BN1BFFO11FD010.protection.gbl (2a01:111:f400:7c10::1:149) by CY1PR03CA0029.outlook.office365.com (2603:10b6:600::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.302.9 via Frontend Transport; Fri, 15 Dec 2017 10:25:45 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BN1BFFO11FD010.mail.protection.outlook.com (10.58.144.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.282.5 via Frontend Transport; Fri, 15 Dec 2017 10:25:35 +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 vBFAPe5j017334; Fri, 15 Dec 2017 03:25:42 -0700 From: Hemant Agrawal To: , CC: Date: Fri, 15 Dec 2017 15:54:42 +0530 Message-ID: <1513333483-4372-2-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513333483-4372-1-git-send-email-hemant.agrawal@nxp.com> References: <1499170968-23016-1-git-send-email-hemant.agrawal@nxp.com> <1513333483-4372-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131578071360572733; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(7966004)(336005)(39380400002)(39860400002)(346002)(376002)(396003)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(2906002)(104016004)(15650500001)(316002)(110136005)(47776003)(16586007)(36756003)(498600001)(2950100002)(4326008)(53936002)(106466001)(50466002)(48376002)(105606002)(5660300001)(97736004)(305945005)(356003)(81156014)(50226002)(575784001)(8936002)(86362001)(85426001)(68736007)(76176011)(77096006)(59450400001)(51416003)(81166006)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2354; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD010; 1:aCmxJGIpq0nsVBIdaR8Au+wmnGo4ne5wrvogWBZE4JbnfCHSRJy6rCdrRezx0QKYAPMkXTouAuoqtb01kTucVyDNcb/VOwK8AD6DDIybSzXVHzJ8cd1TqHZnZwmK/DA2 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ace9785-0932-49c0-8d3d-08d543a62e24 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603307); SRVR:BN3PR03MB2354; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2354; 3:o2KhYD12SmXdBt6XMwlw2plVPpQtfSeXChRu5hzKHek+oWs3e4NLOcctssddRHX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ochBOwe3nKtWIdoISmg4q1ZDYvVXUFFjlhCP0IDkT4L3dQNXyCOuT+etWGWPlSG6Z0dxsKIIqMM9IJ9F8o7D+dhrbJEGd6jO+b1TNQHkLqIz4nuqOeDW6jueDjdsNBHGbsZRjINJnonq3xjbf9PNwwnENQ+4BBSOwqvI8I9dF01POaWNJHiXobGabiuAnPXIdJT+dMtQlZzgh7CNgBnKAgkpf 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)(3002001)(93006095)(93001095)(10201501046)(3231023)(6055026)(6096035)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123563025)(20161123559100)(20161123556025)(20161123561025)(20161123565025)(201708071742011); SRVR:BN3PR03MB2354; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN3PR03MB2354; X-Forefront-PRVS: 05220145DE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2354; 23:eHoWd31T03YXii2nmF9KlJtPP3LcLcOjV7+3smdut?= =?us-ascii?Q?cjXFJlqubnsWH3Gl10XCOGl5en9+447L5Taql5VrXlkhxH87L0vY9JiDnia1?= =?us-ascii?Q?H7Ey+3vnQ/5m855WP3Z0MAiIrPbdwgH6POffRnugeEhvIEbXlWOJTeXe7aqj?= =?us-ascii?Q?oIrMHnroxZg2bfNvcXrZiagPX20NCZlLfEc1R/KhLxCpCXiOOoaHT29OFS3q?= =?us-ascii?Q?xamNyU8hinbGCyRcW+pzWZM748BfiO6iDMLmv1kNJqvffmD9J7FU2WZJaaau?= =?us-ascii?Q?Xvcc1nDMcbxUmXJbeMTpivkVKoGiVa7H2R6gOiVAXLjculHq2J54IXg3FPfm?= =?us-ascii?Q?KoBd20aOI7hETKSx8vfUqZtI9Fk5/6zkag6jDe4xH9PTucDneufJVs5xpoPH?= =?us-ascii?Q?Du0A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T9dsCwhazowo+Lz/F7fV0Y+cuqcr8nvnsJHfX9hlyU6ulXg7HGn63UVGay38Zdpg8DGrET92iNUOeuAEMeGpIjYQ8tDBZCRNS69PBw6xeF3k9rZM0umweot/haIMiuKw7cIA0/CmToWk6R6eWZptotqG7jiVjyG2T11fMy1fV144ehAwUTaxVwrxloURJ8j7eNRDku3LO/UNTZaCeY=; 5:eyaYNZBA2i7SRpXFVAVlI63fGPKa3sDrhabMwTpAZ2G9qO87GqPYP3G4r0KSQDWgSmRjoqortoxsfWc5mkEQqzJik2L+lg03nQXkimNz2cRcEIyPRLOHytGKcGyglhIXNzEDJ8UbtohRuC5b6Gg+G6FJZDOn1UAr7zSMyN/Xrj4=; 24:Xn6GXOh4LKIk3AABM2GPstz+a1OX1o03biCqzvphRM0QdjlNWist5TnoMbxWBTjiUyOkZkSGhEHqNbdK4gwQwrywPq6NKpZr5FGq7CQOmf4=; 7:8DZreOT1OwhAV0DzJQf7S/2KN61SsXY0saxUNan+1b3x1VYcmT0SrSUmQw8l1RoSgOPGRKG363UXzT+iu0e0WNfCvFRQO6QJwfDwrdZTR/FvA0ac4KHV/FH4eLqOwukm5dDzU2bHhSf6+hKmm+PYUGV0QIf3J3I5nFcRjgH9BUyuNQumuRwquEuuCGK6BH9KjSJGrNkR48nQOSNSDAOC9WhExWe7npVa8i3DvoeLfdu2yNOTTqXsxNxzKeCv82Zp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2017 10:25:35.8700 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ace9785-0932-49c0-8d3d-08d543a62e24 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: BN3PR03MB2354 Subject: [dpdk-dev] [PATCH 1/2] mbuf: update default Mempool ops with HW active pool 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: Fri, 15 Dec 2017 10:25:47 -0000 With this patch the specific HW mempool are no longer required to be specified in the config file at compile. A default active hw mempool can be detected dynamically and published to default mempools ops config at run time. Only one type of HW mempool can be active default. Signed-off-by: Hemant Agrawal --- lib/librte_mbuf/rte_mbuf.c | 33 ++++++++++++++++++++++++++++++++- lib/librte_mbuf/rte_mbuf.h | 13 +++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 7543662..e074afa 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -148,6 +148,37 @@ rte_pktmbuf_init(struct rte_mempool *mp, m->next = NULL; } +static const char *active_mbuf_pool_ops_name; + +int +rte_pktmbuf_reg_active_mempool_ops(const char *ops_name) +{ + if (active_mbuf_pool_ops_name == NULL) { + active_mbuf_pool_ops_name = ops_name; + return 0; + } + RTE_LOG(ERR, MBUF, + "%s is already registered as active pktmbuf pool ops\n", + active_mbuf_pool_ops_name); + return -EACCES; +} + +/* Return mbuf pool ops name */ +static const char * +rte_pktmbuf_active_mempool_ops(void) +{ + const char *default_ops = rte_eal_mbuf_default_mempool_ops(); + + /* If mbuf default ops is same as compile time default + * Just to be sure that no one has updated it by other means. + */ + if ((strcmp(default_ops, RTE_MBUF_DEFAULT_MEMPOOL_OPS) == 0) && + (active_mbuf_pool_ops_name != NULL)) + return active_mbuf_pool_ops_name; + else + return default_ops; +} + /* helper to create a mbuf pool */ struct rte_mempool * rte_pktmbuf_pool_create(const char *name, unsigned n, @@ -176,7 +207,7 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, if (mp == NULL) return NULL; - mp_ops_name = rte_eal_mbuf_default_mempool_ops(); + mp_ops_name = rte_pktmbuf_active_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 ce8a05d..3140a0b 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1081,6 +1081,19 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, int socket_id); /** + * Register the active HW pkt mbuf pool + * + * Register the active pktmbuf HW pool to overwrite the default pool + * + * @param pool ops name + * @return + * - 0: Success + * - -EACCES: Active mempool is already registered. + */ +int +rte_pktmbuf_reg_active_mempool_ops(const char *ops_name); + +/** * 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 -- 2.7.4