From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.esentire.com (mail.esentire.com [52.129.34.132]) by dpdk.org (Postfix) with ESMTP id 39F70568A for ; Fri, 1 Sep 2017 22:56:13 +0200 (CEST) Received: from exchange.esentire.com (cas01colo01p.internal [10.1.120.115]) by mail.esentire.com (Postfix) with ESMTPS id 90185180303; Fri, 1 Sep 2017 20:56:12 +0000 (UTC) Received: from mbx01cmb01p.esentire.local (10.1.120.118) by mbx01cmb01p.esentire.local (10.1.120.118) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Fri, 1 Sep 2017 16:56:12 -0400 Received: from mbx01cmb01p.esentire.local ([fe80::814b:946e:3026:96c9]) by mbx01cmb01p.esentire.local ([fe80::814b:946e:3026:96c9%14]) with mapi id 15.00.1210.000; Fri, 1 Sep 2017 16:56:12 -0400 From: Ming Fu To: Stephen Hemminger CC: "users@dpdk.org" Thread-Topic: [dpdk-users] How rte_mempool_ops_table is populated in a DPDK client application? Thread-Index: AdMjJeblGSS7UtUHTnOkVizz9u6FOAAOXa/AAAlrQAAACDiZwA== Date: Fri, 1 Sep 2017 20:56:12 +0000 Message-ID: References: <348a7faca1b44f419567717f4be29bf8@mbx01cmb01p.esentire.local> <20170901134724.7e292a7f@xeon-e3> In-Reply-To: <20170901134724.7e292a7f@xeon-e3> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.1.120.131] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-users] How rte_mempool_ops_table is populated in a DPDK client application? X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Sep 2017 20:56:13 -0000 Hi Stephen, Is there any document or example project I can reference as how to properly= setup static initializer for DPDK from a GNU like Makefile. Thanks, Ming -----Original Message----- From: Stephen Hemminger [mailto:stephen@networkplumber.org]=20 Sent: September-01-17 4:47 PM To: Ming Fu Cc: users@dpdk.org Subject: Re: [dpdk-users] How rte_mempool_ops_table is populated in a DPDK = client application? On Fri, 1 Sep 2017 20:26:48 +0000 Ming Fu wrote: > Did some digging and find that the rte_mempool_ops_table is populated fro= m function rte_mempool_register_ops(). > From a small program build in the dpdk example, the rte_mempool_register_= ops() is called from the following stack trace >=20 > (gdb) where > #0 0x000000000047eea0 in rte_mempool_register_ops () > #1 0x00000000006a8abd in __libc_csu_init () > #2 0x00007ffff71f97bf in __libc_start_main () from /lib/x86_64-linux-gnu= /libc.so.6 > #3 0x0000000000440f29 in _start () >=20 > So this function is called probably before rte_eal_init(). If I have an a= pplication linked to a static lib of dpdk outside of dpdk build tree, how d= o I make it to register the call to rte_mempool_register_ops from __libc_cs= u_init()? >=20 > Thanks > Ming >=20 > From: Ming Fu > Sent: September-01-17 9:36 AM > To: users@dpdk.org > Subject: How rte_mempool_ops_table is populated in a DPDK client applicat= ion? >=20 > Try to make snort to receive packet from a dpdk ring as an client applica= tion. The DPDK is compiled into the snort DAQ lib statically. The DAQ lib i= s then linked to snort statically. >=20 > What I am find is that the rte_mempool_ops_table is all 0, causing the cl= ient to crash when free the received mbuf from the ring. I was wondering ho= w this rte_mempool_ops_table is populated during DPDK initialization for a = client application. >=20 > The my dpdk snort went through rte_eal_init(), rte_ring_lookup() and rte_= mempool_lookup() without error. >=20 > Thanks > Ming Make sure static initalizers are run in your program. If you use the DPDK m= k rules, it works correctly. If you use other build environments, you need to adjust the linker flags.