From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <Ming.Fu@esentire.com>
Received: from mail.esentire.com (mail.esentire.com [52.129.34.132])
 by dpdk.org (Postfix) with ESMTP id 7CD531E20
 for <users@dpdk.org>; Tue, 29 Aug 2017 22:51:45 +0200 (CEST)
Received: from exchange.esentire.com (cas01cmb01p.internal [10.1.120.116])
 by mail.esentire.com (Postfix) with ESMTPS id E11A918025B
 for <users@dpdk.org>; Tue, 29 Aug 2017 20:51:43 +0000 (UTC)
Received: from mbx02cmb01p.esentire.local (10.1.120.125) by
 mbx02cmb01p.esentire.local (10.1.120.125) with Microsoft SMTP Server (TLS) id
 15.0.1210.3; Tue, 29 Aug 2017 16:51:43 -0400
Received: from mbx02cmb01p.esentire.local ([fe80::614a:403b:50de:71e4]) by
 mbx02cmb01p.esentire.local ([fe80::614a:403b:50de:71e4%12]) with mapi id
 15.00.1210.000; Tue, 29 Aug 2017 16:51:43 -0400
From: Ming Fu <Ming.Fu@esentire.com>
To: "users@dpdk.org" <users@dpdk.org>
Thread-Topic: dpdk with snort 2.9.9 receive from DPDK ring
Thread-Index: AdMhCIjMMcbfqufVSFGBQ7RCk7Cd8A==
Date: Tue, 29 Aug 2017 20:51:43 +0000
Message-ID: <cb6dbe9d5e714524824132f805e6bdd0@mbx02cmb01p.esentire.local>
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]
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
X-Content-Filtered-By: Mailman/MimeDel 2.1.15
Subject: [dpdk-users] dpdk with snort 2.9.9 receive from DPDK ring
X-BeenThere: users@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK usage discussions <users.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/users>,
 <mailto:users-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/users/>
List-Post: <mailto:users@dpdk.org>
List-Help: <mailto:users-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/users>,
 <mailto:users-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 29 Aug 2017 20:51:45 -0000

I am making a snort DAQ module to receive packet from DPDK capture through =
a ring. The snort version is 2.9.9 and DPDK version is 17.08. The code is v=
ery similar to the multi_process/client_server_mp example. The DPDK is init=
ialized in daq initialize function and mbuf received from daq acquire funct=
ion. Snort inspects the mbuf but does not re-inject back to the network, so=
 daq free the mbuf by rte_pktmbuf_free(mbuf) in the same thread as it calls=
 rte_ring_dequeue_burst();
The snort successfully received the first burst of 32 packets, but it fails=
 on the first rte_pktmbuf_free().

Seems some internal dpdk function pointer is NULL.
#0  0x0000000000000000 in ?? ()
#1  0x00000000004f7a8d in rte_mempool_ops_enqueue_bulk (n=3D<optimized out>=
, obj_table=3D<optimized out>, mp=3D<optimized out>)
    at /home/mfu/work/dpdk-17.08/build/include/rte_mempool.h:497
#2  __mempool_generic_put (cache=3D<optimized out>, n=3D1, obj_table=3D0x7f=
ffffffe6e8, mp=3D<optimized out>) at /home/mfu/work/dpdk-17.08/build/includ=
e/rte_mempool.h:1069
#3  rte_mempool_generic_put (flags=3D<optimized out>, cache=3D<optimized ou=
t>, n=3D1, obj_table=3D0x7fffffffe6e8, mp=3D<optimized out>)
    at /home/mfu/work/dpdk-17.08/build/include/rte_mempool.h:1109
#4  rte_mempool_put_bulk (n=3D1, obj_table=3D0x7fffffffe6e8, mp=3D<optimize=
d out>) at /home/mfu/work/dpdk-17.08/build/include/rte_mempool.h:1132
#5  rte_mempool_put (obj=3D<optimized out>, mp=3D<optimized out>) at /home/=
mfu/work/dpdk-17.08/build/include/rte_mempool.h:1150
#6  rte_mbuf_raw_free (m=3D<optimized out>) at /home/mfu/work/dpdk-17.08/bu=
ild/include/rte_mbuf.h:853
#7  rte_pktmbuf_free_seg (m=3D<optimized out>) at /home/mfu/work/dpdk-17.08=
/build/include/rte_mbuf.h:1349
#8  rte_pktmbuf_free (m=3D<optimized out>) at /home/mfu/work/dpdk-17.08/bui=
ld/include/rte_mbuf.h:1369
#9  dpdk_daq_acquire (handle=3D0x1af6910, cnt=3D0, callback=3D<optimized ou=
t>, metaback=3D<optimized out>, user=3D<optimized out>) at daq_dpdk.c:234
#10 0x00000000004551d3 in DAQ_Acquire ()
#11 0x0000000000437828 in SnortMain ()
#12 0x00007ffff61af830 in __libc_start_main () from /lib/x86_64-linux-gnu/l=
ibc.so.6
#13 0x0000000000406d29 in _start ()

I notice that snort has three threads,
(gdb) info thread
  Id   Target Id         Frame
* 1    Thread 0x7ffff7fdf8c0 (LWP 42472) "snort" 0x0000000000000000 in ?? (=
)
  2    Thread 0x7fffdff5a700 (LWP 42481) "eal-intr-thread" 0x00007ffff62969=
d3 in epoll_wait () from /lib/x86_64-linux-gnu/libc.so.6
  3    Thread 0x7fffdf4d5700 (LWP 42482) "snort" 0x00007ffff625b30d in nano=
sleep () from /lib/x86_64-linux-gnu/libc.so.6

Would it be a problem if the rte_pktmbuf_free() is not called from the eal =
thread?

Thanks
Ming