#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <rte_byteorder.h>
#include <rte_ether.h>
#include <rte_ip.h>
#include <rte_tcp.h>
#include <rte_udp.h>
#include <rte_net.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_flow.h>
static volatile bool force_quit;
#define MBUF_CACHE_SIZE 250
#define NUM_MBUFS 8191
#define RX_RING_SIZE 128
#define TX_RING_SIZE 512
static const struct rte_eth_conf port_conf_default = {
.rxmode = {
.max_rx_pkt_len = ETHER_MAX_LEN }
};
static void
main_loop(void){
struct rte_mbuf *mbufs[32];
struct ether_hdr *eth_hdr;
struct ipv4_hdr *ipv4_hdr;
struct tcp_hdr *tcp_hdr;
struct udp_hdr *udp_hdr;
uint32_t tcp_or_udp;
uint32_t l3_ptypes;
struct rte_flow_error error;
uint16_t nb_rx;
uint8_t port_id = 0;
uint16_t nr_queues = 0;
uint16_t nb_pkts = 32;
uint16_t i;
while(!force_quit){
//单队列网卡,不用for循环遍历队列
nb_rx = rte_eth_rx_burst(port_id,nr_queues,mbufs,nb_pkts)
基于DPDK的解析流量包程序(参考pdump,纯测试能否可行)
最新推荐文章于 2024-08-03 15:21:22 发布
本文档介绍了使用DPDK库开发流量包解析程序的尝试,参照pdump项目,主要探讨其在纯测试环境下的可行性。
摘要由CSDN通过智能技术生成