libpcap PMD
DPDK驱动模型除了支持物理网卡或虚拟网卡
也支持纯软件的驱动模型
libpcap
基于libpcap(ibrte_net_pcap)PMD, 从磁盘读写报文。
创建
- 伪网口名字名字以net_pcap开头,后接数字或字母
- 名字需要唯一
- 通过多个--dev添加多个设备
shell
#例如:
--vdev 'net_pcap0,opt0=..,opt1=..' --vdev 'net_pcap1,opt0=..'配置选项
rx_pcap
从pcap文件读入报文数据
shell
--vdev 'net_pcap0,rx_pcap=/path/to/file.pcap'
#重复读入报文
--vdev 'net_pcap0,rx_pcap=file_rx.pcap,infinite_rx=1'tx_pcap
将报文写入到pcap包,如果报文存在则覆盖。
shell
--vdev 'net_pcap0,tx_pcap=/path/to/file.pcap'rx_iface
将linux网口输入和输出流量作为PMD输入。
shell
--vdev 'net_pcap0,rx_iface=eth0'rx_iface_in
将linux网口输入流量作为PMD输入。
shell
--vdev 'net_pcap0,rx_iface_in=eth0'tx_iface
将流量发送到自定网口
shell
--vdev 'net_pcap0,tx_iface=eth0'iface
映射网口,通过该网口收发报文
shell
--vdev 'net_pcap0,iface=eth0'
#使用指定网口的mac
--vdev 'net_pcap0,iface=eth0,phy_mac=1'基于ring的PMD
软件实现的FIFO和librte_net_ringPMD
shell
--vdev=net_ring0 --vdev=net_ring1具体实现参见官方文档。