built dpdk 19.11.12 from source and i have written an ext app built using these libraries. I use dpdk-devbind to bind a device to igb_uio .
The device i have is an Intel X550. When i run testpmd it seems to recognize the device but int my app rte_eth_dev_count_avail always returns 0
I would belive this has to either do with the way i have built my dpdk library or my app
this is extract of the Makefile i am using to build my app
RTE_SDK ?= /usr/local/share/dpdk
RTE_TARGET ?= x86_64-default-linuxapp-gcc
include $(RTE_SDK)/mk/rte.vars.mk
# binary name
APP = myapp
# all source are stored in SRCS-y
SRCS-y := main.c
WERROR_FLAGS += -Werror
CFLAGS += -O3 -g
CFLAGS += $(WERROR_FLAGS) -Wno-address-of-packed-member
CFLAGS += -Wall
CFLAGS += -pie -fPIE -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -fstack-protector-strong
CFLAGS += -DSTATSD
LDFLAGS += -z relro -z now
LDFLAGS += -ljansson -lrte_pmd_ixgbe
LDLIBS += -lrte_pmd_ixgbe
# disable since libxenstore.so isn't linked properly
#CONFIG_RTE_LIBRTE_PMD_XENVIRT = n
CONFIG_RTE_LIBRTE_PMD_IXGBE = y
include $(RTE_SDK)/mk/rte.extapp.mk
I build my dpdk libraries using this
RUN make -C /dpdk/dpdk-stable-${DPDK_VERSION}/ config T=x86_64-native-linuxapp-gcc
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_BUILD_SHARED_LIB=n/CONFIG_RTE_BUILD_SHARED_LIB=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_ETHDEV_DEBUG=n/CONFIG_RTE_LIBRTE_ETHDEV_DEBUG=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=n/CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_E1000_DEBUG_TX=n/CONFIG_RTE_LIBRTE_E1000_DEBUG_TX=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_IXGBE_DEBUG_RX=n/CONFIG_RTE_LIBRTE_IXGBE_DEBUG_RX=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LIBRTE_IXGBE_DEBUG_TX=n/CONFIG_RTE_LIBRTE_IXGBE_DEBUG_TX=y/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LOG_DP_LEVEL=RTE_LOG_INFO/CONFIG_RTE_LOG_DP_LEVEL=RTE_LOG_DEBUG/g > /tmp/out && mv /tmp/out build/.config
RUN cd /dpdk/dpdk-stable-${DPDK_VERSION}/ && cat build/.config | sed -e s/CONFIG_RTE_LOG_HISTORY=256/CONFIG_RTE_LOG_HISTORY=2048/g > /tmp/out && mv /tmp/out build/.config
i can bind to the interfaces using dpdk-devbind and testpmd also seems to identify and be able to bind to these devices
but my app is not able to recognize the devices.
What am i missing here ?
these are the logs --log-level=8 for EAL logs and I get this output
Sep 09 04:56:50 {"timestamp": 1662717410.8821511, "level": "info", "message": "Initialising EAL ..."}
Sep 09 04:56:50 EAL: Detected 64 lcore(s)
Sep 09 04:56:50 EAL: Detected 2 NUMA nodes
Sep 09 04:56:50 EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
Sep 09 04:56:50 EAL: Selected IOVA mode 'PA'
Sep 09 04:56:50 EAL: No available hugepages reported in hugepages-1048576kB
Sep 09 04:56:50 EAL: Debug dataplane logs available - lower performance
Sep 09 04:56:50 EAL: Debug dataplane logs available - lower performance
Sep 09 04:56:50 EAL: Probing VFIO support...
Sep 09 04:56:50 EAL: VFIO support initialized
Sep 09 04:56:50 EAL: Probing VFIO support...
Sep 09 04:56:50 EAL: VFIO support initialized
also adding the -d parameter with the directory where the plugins are located /usr/local/lib/ gives me an error where the plugin is not found
the eal param initialized is
--master-lcore 4 -l 4,5,6,7 --log-level 8 -d /usr/local/lib/
Sep 09 04:47:29 EAL: Detected 64 lcore(s)
Sep 09 04:47:29 EAL: Detected 2 NUMA nodes
Sep 09 04:47:29 EAL: librte_compressdev.so.0.200: cannot open shared object file: No such file or directory
Sep 09 04:47:29 EAL: FATAL: Cannot init plugins
Sep 09 04:47:29 EAL: Cannot init plugins
the librte_compressdev.so.0.200 is present in the path
ls -l /usr/local/lib/librte_compressdev.so.0.200
-rwxr-xr-x 1 root root 38024 Sep 8 23:51 /usr/local/lib/librte_compressdev.so.0.200
[based on the live debug]
DPDK 17.11 LTS use libdpdk.so and a complete shared library, which makes all the necessary ethdev PMD available. hence using the current makefile, it pans out properly without any issues.
But moving to DPDK 19.11 LTS, libdpdk.so is no longer availble. hence one have to manually link either in shared or static libraries properly (as pointed out in comments). For example
DPDK_CFLAGS=" -DHAVE_DPDK -I${RTE_SDK}/${RTE_TARGET}/include/ -include ${RTE_SDK}/${RTE_TARGET}/include/rte_config.h "
DPDK_LDFLAGS="-I$RTE_SDK/lib/librte_eal/linux/eal/include \
-DRTE_USE_FUNCTION_VERSIONING \
-I$RTE_SDK/$RTE_TARGET/include -include $RTE_SDK/$RTE_TARGET/include/rte_config.h \
-D_GNU_SOURCE -W -Wall -DALLOW_EXPERIMENTAL_API \
-L$RTE_SDK/$RTE_TARGET/lib -Wl,-lrte_flow_classify -Wl,--whole-archive -Wl,-lrte_pipeline -Wl,--no-whole-archive \
-Wl,--whole-archive -Wl,-lrte_table -Wl,--no-whole-archive -Wl,--whole-archive \
-Wl,-lrte_port -Wl,--no-whole-archive -Wl,-lrte_pdump -Wl,-lrte_ip_frag -Wl,-lrte_meter \
-Wl,-lrte_fib -Wl,-lrte_rib -Wl,-lrte_lpm -Wl,-lrte_acl -Wl,-lrte_power -Wl,-lrte_kni \
-Wl,-lrte_efd -Wl,-lrte_bpf -Wl,-lrte_ipsec -Wl,--whole-archive -Wl,-lrte_cfgfile -Wl,-lrte_gro \
-Wl,-lrte_gso -Wl,-lrte_hash -Wl,-lrte_member -Wl,-lrte_vhost -Wl,-lrte_kvargs -Wl,-lrte_mbuf \
-Wl,-lrte_net -Wl,-lrte_ethdev -Wl,-lrte_cryptodev -Wl,-lrte_security -Wl,-lrte_compressdev \
-Wl,-lrte_eventdev -Wl,-lrte_timer -Wl,-lrte_mempool -Wl,-lrte_stack -Wl,-lrte_mempool_ring \
-Wl,-lrte_ring -Wl,-lrte_pci -Wl,-lrte_eal -Wl,-lrte_cmdline -Wl,-lrte_reorder -Wl,-lrte_sched \
-Wl,-lrte_rcu -Wl,-lrte_bus_pci -Wl,-lrte_bus_vdev -Wl,-lrte_mempool_bucket -Wl,-lrte_mempool_stack \
-Wl,-lrte_pmd_af_packet \
-Wl,-lrte_pmd_ixgbe \
-Wl,-lrte_pmd_memif \
-Wl,-lrte_pmd_null \
-Wl,-lpcap -Wl,-lrte_pmd_ring -Wl,-lrte_pmd_tap -Wl,-lrte_pmd_virtio -Wl,-lrte_bus_vmbus \
-Wl,-lcrypto -Wl,-lrte_pmd_null_crypto -Wl,-lrte_pmd_crypto_scheduler -Wl,-lrte_pmd_virtio_crypto \
-Wl,-lrte_pmd_skeleton_event -Wl,-lrte_pmd_sw_event \
-Wl,--no-whole-archive -Wl,-lrt -Wl,-lm -Wl,-lnuma -Wl,-ldl -Wl,-export-dynamic -Wl,-export-dynamic \
-L$RTE_SDK/examples/l2fwd/build/lib -L$RTE_SDK/$RTE_TARGET/lib -Wl,--as-needed"
Since DPDk 19.11 LTS makes uses on meson-ninja, my suggestion and recommendation is to make use of pkg-config to built the right CFLAGS and LDFLAGS. Please refer StackOverflow query on using dpdk cmake too
Note: recommended to build a custom target folder rather than make install, since the built and application run is done in docker.
My Environment info:
Operating system: Ubuntu 18.04
OpenCV: 4.3.0
CUDA: 10.2
NVIDIA gpu: GEFORCE RTX 2060
My cmake list before install opencv:
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_C_EXAMPLES=ON
-D INSTALL_PYTHON_EXAMPLES=OFF
-D WITH_TBB=ON \ -D WITH_CUDA=ON
-D CUDA_GENERATION=Turing \ -D BUILD_opencv_cudacodec=ON
-D ENABLE_FAST_MATH=ON
-D NVCUVID_FAST_MATH=ON
-D CUDA_FAST_MATH=ON
-D WITH_CUBLAS=ON
-D BUILD_opencv_java=OFF
-D BUILD_ZLIB=ON
-D BUILD_TIFF=ON
-D WITH_GTK=ON
-D WITH_NVCUVID=ON
-D WITH_FFMPEG=ON
-D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2
-D WITH_1394=ON
-D CUDNN_INCLUDE_DIR=/usr/local/cuda/include
-D CUDNN_LIBRARY=/usr/local/cuda/lib64/libcudnn.so.7.6.5
-D OPENCV_GENERATE_PKGCONFIG=ON
-D OPENCV_PC_FILE_NAME=opencv4.pc
-D OPENCV_ENABLE_NONFREE=ON
-D WITH_GSTREAMER=ON
-D WITH_V4L=ON
-D OPENCV_PYTHON3_INSTALL_PATH=$cwd/OpenCV-4.3.0-py3/lib/python3.5/site-packages
-D WITH_QT=ON
-D WITH_CUDNN=ON
-D OPENCV_DNN_CUDA=ON
-D WITH_OPENGL=ON
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules
-D BUILD_EXAMPLES=ON ..
After Cmake a part of output:
. .
-- Video I/O:
-- DC1394: YES (2.2.5)
-- FFMPEG: YES
-- avcodec: YES (57.107.100)
-- avformat: YES (57.83.100)
-- avutil: YES (55.78.100)
-- swscale: YES (4.8.100)
-- avresample: YES (3.7.0)
-- GStreamer: YES (1.14.5)
-- v4l/v4l2: YES (linux/videodev2.h)
--
-- Parallel framework: TBB (ver 2017.0 interface 9107)
--
-- Trace: YES (with Intel ITT)
--
-- Other third-party libraries:
-- Intel IPP: 2020.0.0 Gold [2020.0.0]
-- at: /home/yongatek02/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
-- Intel IPP IW: sources (2020.0.0)
-- at: /home/yongatek02/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
-- Lapack: NO
-- Eigen: YES (ver 3.3.4)
-- Custom HAL: NO
-- Protobuf: build (3.5.1)
--
-- NVIDIA CUDA: YES (ver 10.2, CUFFT CUBLAS NVCUVID FAST_MATH)
-- NVIDIA GPU arch: 75
-- NVIDIA PTX archs:
--
-- cuDNN: YES (ver 7.6.5)
--
-- OpenCL: YES (no extra features)
-- Include path: /home/yongatek02/opencv/3rdparty/include/opencl/1.2
-- Link libraries: Dynamic load . .
I tested simple cuda examples and OpenCV and working fine no problem. I tried this example to be able to decode my IP camera stream with GPU. It compiled fine with this command via on terminal:
g++ -std=c++11 codec.cpp `pkg-config --libs --cflags opencv4` -o output
Here is also my code:
#include <opencv2/opencv_modules.hpp>
#include <iostream>
#include <opencv2/core.hpp>
#include <opencv2/cudacodec.hpp>
#include <opencv2/highgui.hpp>
int main(int argc, const char* argv[])
{
const std::string fname = "rtsp://usrname/ipadress..."; // Tried also different formats of videos such as YUV,mp4 webM
cv::namedWindow("GPU", cv::WINDOW_NORMAL);
cv::cuda::GpuMat d_frame;
cv::Ptr<cv::cudacodec::VideoReader> d_reader = cv::cudacodec::createVideoReader(fname);
for (;;)
{
if (!d_reader->nextFrame(d_frame))
break;
cv::Mat frame;
d_frame.download(frame);
cv::imshow("GPU", frame);
if (cv::waitKey(3) > 0)
break;
}
return 0;
}
But when I tried to run it, it gives me this error:
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.3.0)
/home/yongatek02/opencv_contrib/modules/cudacodec/src/video_decoder.cpp:101:
error: (-210:Unsupported format or combination of formats) Video
source is not supported by hardware video decoder in function 'create'
Aborted (core dumped)
I also tried to use some different types of formats such as YUV, MP4, webm etc. and the error is still the same.
What I am missing here ?
I had the same problem when I was processing video files on local disk. It turned out that the cudacodec did not support the codec of its audio track. I used ffmpeg to drop the audio track and it worked properly.
ffmpeg -i input.mp4 -an output.mp4
pi#raspberrypi:~ $ raspistill -w 800 -h 600 -tl 0 -t 0 -o - | test-launch "fdsrc ! image/jpeg ! jpegparse ! rtpjpegpay"
stream ready at rtsp://127.0.0.1:8554/test
But I failed to use vlc in win10 to connect with raspberry pi3. I dont know where the problem is. I can't get any error information. I success in running this command :
raspivid -t 0 -h 1920 -w 1080 -fps 30 -o - | ./test-launch " fdsrc ! h264parse ! rtph264pay name=pay0 pt=96 "
So, I think my command is okay. Could someone help me?Thanks.
HaHa, I think I have resolved my own question ( 哈哈哈,我认为我解决了自己的问题 )。Now, let me help you.
The server is
raspistill -w 800 -h 600 -tl 0 -t 0 -o - | test-launch "fdsrc ! image/jpeg,width=800,height=600 ! jpegparse ! rtpjpegpay name=pay0 pt=96"
The client is
gst-launch-1.0.exe rtspsrc location=rtsp://192.168.1.30:8554/test ! rtpjpegdepay ! jpegparse ! multifilesink location="%d.jpeg"
or
gst-launch-1.0.exe rtspsrc location=rtsp://192.168.1.30:8554/test ! rtpjpegdepay ! jpegparse ! jpegdec ! videoconvert ! autovideosink
vlc can't resolv the flow from server temporarily. So don't to use it !
currently I'm using below command to get latest 4 files.
But this command also fetches directories...but i want to exclude directory. How to do?
ls -tr /home/user | tail -4
If you want just the files to show you can issue:
for i in `ls -tr /home/user`; do if test -f $i; then echo $i; fi done | tail -4
-f flag on test checks if argument is a file
-d flag on test checks if argument is a directory
I want to work with DPDK for packet processing I can't run kni example
I tried every possible config and I get :
EAL: Error - exiting with code: 1
Cause: Invalid option specified
./build/kni -c 0x0f -n 4 -- -P -p 0x3 -config="(0,2,3),(1,4,5)"
./build/kni -c 0x0f -n 4 -- -P -p 0x3 -config="(0,4,6),(1,5,7)"
I should put a "--" before config, but in all samples it has one dash
Your command has en error:
./build/kni -c 0x0f -n 4 -- -P -p 0x3 -config="(0,4,6),(1,5,7)"
The -P option should put before -config, like this:
-c 0x0f -n 4 -- -p 0x3 -P --config="(0,4,6),(1,5,7)"
From DPDK sample application user guide:
to run the application with two ports served by six lcores, one lcore of RX, one
lcore of TX, and one lcore of kernel thread for each port:
./build/kni -c 0xf0 -n 4 -- -P -p 0x3 -config="(0,4,6,8),(1,5,7,9)"
you need to check your "config" inputs(should be 4 elements for each port).
the following command will work
./build/kni -l 4-5 -n 4 -- -p1 -P --config="(0, 4, 5)"