vipinpv85 / DPDK-Suricata_3.0

add dpdk interface and packet processing to suricata in worker mode
https://github.com/vipinpv85/DPDK-Suricata_3.0
GNU Lesser General Public License v3.0
62 stars 34 forks source link

Does dpdk-suricata support vhost-user? #29

Open Leonardo-DiCaprio opened 4 years ago

Leonardo-DiCaprio commented 4 years ago

I test this project with pktegn in the same machine, pktgen in docker and dpdk-suricata in host. I build a clear docker envrioment mounting hugepages folder and /tmp/virtio/, where I plan to save my virtio socks on host. Then I run this command in docker `./pktgen -l 1-5 -n 3 --socket-mem 1024 --vdev 'eth_vhost0,iface=/tmp/virtio/sock0' --file-prefix=test --no-pci -- -P -m "5.0" It seems pktgen works well in container, and there it is a sock0 file in /tmp/virtio/

And I test this for sure in host: sudo ./testpmd -l 0-1 -n 1 --socket-mem 1024 --vdev 'virtio_user0,path=/tmp/virtio/sock0' -- -i --forward-mode=io --auto-start Testpmd can receive packte from pktgen(all packets can be received in order).

Then I run dpdk-suricata in host with config like this:

[EAL]
-l=6-10
-n=2
--base-virtaddr=0x300000000000
--master-lcore=6
--socket-mem=128
--socket-limit=2048
--vdev=virtio_user0,path=/tmp/virtio/sock0

Command: ./src/suricata -c suricata.yaml --dpdkintel But I got this error:

7/8/2020 -- 16:25:37 - <Debug> -  ................ Validating configurations!!
7/8/2020 -- 16:25:37 - <Debug> -  - CPU: 5
7/8/2020 -- 16:25:37 - <Debug> -  - Port: 1
7/8/2020 -- 16:25:37 - <Debug> -  - execute threads: 5
7/8/2020 -- 16:25:37 - <Debug> -  - DPDK ports 1 config-file ports 1
7/8/2020 -- 16:25:37 - <Debug> -  - pkt MBUFF setup 0x30007fc87280
7/8/2020 -- 16:25:37 - <Debug> -  - port (0) Name (virtio_user0)
Ethdev port_id=0 nb_tx_queues=2 > 1
7/8/2020 -- 16:25:37 - <Error> - [ERRCODE: SC_ERR_DPDKINTEL_CONFIG_FAILED(275)] -  configure device: err=-22, port=0

7/8/2020 -- 16:25:37 - <Error> - [ERRCODE: SC_ERR_MISSING_CONFIG_PARAM(118)] - DPDK dev setup!!

Then I locate this error in https://github.com/vipinpv85/DPDK-Suricata_3.0/blob/35358175edc538c244b4b7a3acfa734a1a69a03c/suricata-3.0/src/util-dpdk-setup.c#L164

And I notice there is a TODO saying that:

       ToDo: support for non INTEL PCI interfaces also - phase 2
        /* ToDo - change default configuration to systune configuration */ 

And the default configuration is:

.rxmode = {
    .split_hdr_size = 0,
},
.txmode = {
    .mq_mode = ETH_MQ_TX_NONE,
},

I try to change default config in your code by imitating l2fwd's config, but failed. Now I am not sure if there is still a todo or not.

vipinpv85 commented 4 years ago

not an error, you can easily fix this

Leonardo-DiCaprio commented 4 years ago

Are there any hints? I try to run with --vdev=virtio_user0,queues=1,path=/tmp/virtio/sock0, but this didn't help.