From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f53.google.com (mail-pg0-f53.google.com [74.125.83.53]) by dpdk.org (Postfix) with ESMTP id 22180F04 for ; Fri, 1 Sep 2017 22:47:27 +0200 (CEST) Received: by mail-pg0-f53.google.com with SMTP id r133so3518206pgr.3 for ; Fri, 01 Sep 2017 13:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=foBVkeG7A25TVp/ClE2a00WR6f7V2YUMYfcrLgFCfcQ=; b=hK3iTNZzEitnHiawj42El6EgyUwKccd/7UugG6PuWKUcHZji6Z1XGhLYZspTfveyfm bc8zM00t5zkO75w0BaYTaZj27Dm6ZKv93ev0NuWa85frwjx+NFonewpSVW8t82jqxGdq uiToaT/PbSABtxtb+zEjdf85wdWI/NyCtKInNFvCbgloLyLNZ3HFMs3ZHdvjdMaf/Psw Km7wS3NZVKC29j23rGPm4g/KfDDTg7o9HLsNP6cZYr/8FmJkynzAONLTYHy5MzVP+Fkb ApWSDPl+CmbVOQwXxWCbJ6GjaZnLNqAEvVZIBSbseso1mHtAgHe7v1rCJ6SqoYyFACNW ewig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=foBVkeG7A25TVp/ClE2a00WR6f7V2YUMYfcrLgFCfcQ=; b=RAL2fuuKve0q9Bk94dWZq0ekYRt5jsK/RJtxQil7bQzuqA1Ytoq4bmbmHkh2APRxn6 H3INWEj0gxwjEP1J6aeMe1jGOPx9ZPLVC/6ydcTMLVhn4vKPftSePi/lJNeztYvEsatd SoergkkBVQp5qUbCabqXAtigDBfKz3RTtQUZ3iiRBiyQdD9WkTO8XZO2jy6DhlH9XTVS bvVMKCwfJy0Xw2Y5HLlXEDA99vD4py0uJ+12PMaqMiBRxdse4z26Q6e94wCG/1gYWxCN EJ+/09MJGMh2iKJ4P4IoEXBKoy8Ju1wHXHjz2/pjwpwy3ApJMX40XOgPO9WBB6UfCbTK fpMg== X-Gm-Message-State: AHPjjUjDcyupObyK2p4zE1EfsP2Rqm1ZpgCT+LLxvK60+i6g2bYlrz2B rWDisAa+ltokJBFYk+XECQ== X-Google-Smtp-Source: ADKCNb7FhZz0Nwbz3Pi6FZwsVSICr+aTXwkv7v9H4dgCv5LOpTp6c/icHuKYWEQstro4mecTQbL/cA== X-Received: by 10.98.198.70 with SMTP id m67mr3614466pfg.125.1504298846265; Fri, 01 Sep 2017 13:47:26 -0700 (PDT) Received: from xeon-e3 (76-14-207-240.or.wavecable.com. [76.14.207.240]) by smtp.gmail.com with ESMTPSA id w6sm1272781pfb.13.2017.09.01.13.47.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Sep 2017 13:47:26 -0700 (PDT) Date: Fri, 1 Sep 2017 13:47:24 -0700 From: Stephen Hemminger To: Ming Fu Cc: "users@dpdk.org" Message-ID: <20170901134724.7e292a7f@xeon-e3> In-Reply-To: <348a7faca1b44f419567717f4be29bf8@mbx01cmb01p.esentire.local> References: <348a7faca1b44f419567717f4be29bf8@mbx01cmb01p.esentire.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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:47:27 -0000 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 from 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 > > (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 () > > So this function is called probably before rte_eal_init(). If I have an application linked to a static lib of dpdk outside of dpdk build tree, how do I make it to register the call to rte_mempool_register_ops from __libc_csu_init()? > > Thanks > Ming > > 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 application? > > Try to make snort to receive packet from a dpdk ring as an client application. The DPDK is compiled into the snort DAQ lib statically. The DAQ lib is then linked to snort statically. > > What I am find is that the rte_mempool_ops_table is all 0, causing the client to crash when free the received mbuf from the ring. I was wondering how this rte_mempool_ops_table is populated during DPDK initialization for a client application. > > The my dpdk snort went through rte_eal_init(), rte_ring_lookup() and rte_mempool_lookup() without error. > > Thanks > Ming Make sure static initalizers are run in your program. If you use the DPDK mk rules, it works correctly. If you use other build environments, you need to adjust the linker flags.