本文共 1348 字,大约阅读时间需要 4 分钟。
43. Extending the DPDK
本章描述了开发人员如何扩展DPDK以提供新库、新目标或支持新目标。
43.1. Example: Adding a New Library libfoo
要向DPDK添加一个新库,请按以下方式进行:
for f in config/\*; do \ echo CONFIG_RTE_LIBFOO=y >> $f; done
mkdir ${RTE_SDK}/lib/libfootouch ${RTE_SDK}/lib/libfoo/foo.ctouch ${RTE_SDK}/lib/libfoo/foo.h
void foo(void){ }在foo.h中声明:
extern void foo(void);
vi ${RTE_SDK}/lib/Makefile# add:# DIRS-$(CONFIG_RTE_LIBFOO) += libfoo
cp ${RTE_SDK}/lib/librte_mempool/Makefile ${RTE_SDK}/lib/libfoo/vi ${RTE_SDK}/lib/libfoo/Makefile# replace:# librte_mempool -> libfoo# rte_mempool -> foo
cd ${RTE_SDK}make config T=x86_64-native-linuxapp-gccmake
ls build/libls build/include
测试应用程序用于验证DPDK的所有功能。一旦添加了一个库之后,应该在测试应用程序中添加一个新的测试用例。
cd ${RTE_SDK}make config T=x86_64-native-linuxapp-gccmake
转载地址:http://bdqci.baihongyu.com/