1. 首先,设置流的属性rte_flow_attr为ingress,即要操作的数据流为接收方向。 struct rte_flow *generate_ipv4_flow(uint16_t port_id, uint16_t rx_q, uint32_t src_ip, uint32_tsrc_mask, uint32_t dest_ip, uint32_t dest_mask, struct rte_flow_error *error) { struct rte_flow_attr attr;...
rte_flow_create:创建流量规则。 rte_flow_destroy:销毁流量规则。 structrte_flow{structrte_flow_attr*attr;/**< Attributes of the flow. */structrte_flow_item*items;/**< Pattern to match. */structrte_flow_action*actions;/**< Actions to perform. */// 其他字段...}; rte_event 用于事件驱...
("Flow created successfully to prioritize IP: 192.168.0.3 to queue: 1\n");// 主循环while(1) {// 在此处理数据包// 从不同队列中接收数据包并进行处理for(uint16_t q =0; q < nb_rx_queues; q++) {structrte_mbuf *bufs[nb_rxd]; const uint16_t nb_rx = rte_eth_rx_burst(PORT_...
1》rte_flow_validate 用在create 该 flow rule之前,检查该flow rule 是否有效,是否被硬件支持,是否可以create。 2》rte_flow_validate 基于 接口设备模式,队列配置,已经存在的flow rule,设备资源 进行检查。 3》执行 rte_flow_validate 的过程中,不要有其他的线程/程序在调用 rte_flow_create() or rte_flow_...
创建rte_flow_create:创建流规则。 struct rte_flow* rte_flow_create(uint8_t port_id, const struct rte_flow_attr* attr, const struct rte_flow_item pattern [], const struct rte_flow_action * actions [], struct rte_flow_error* error); // 成功时有效的句柄,否则rte_errno为NULL,并设置为为...
由于可能的冲突或资源限制,只要在同一时间没有成功调用rte_flow_create()或者rte_flow_destroy(),并且没有任何影响流规则的设备参数被修改,那么返回值可以保证有效。 参数: port_id:以太设备端口标识。 attr:流规则属性。 pattern:指定模式(以END为结尾的链表)。
一rte_flow是干嘛的 一组用来创建自定义规则的api,该规则可以改变网络流量的命运,以及查询计数。 二 规则啥样 1 match + action match包括:两类,A报文内容(按协议栈分层); B报文属性(网口,方向)。 action包括:计数,丢包,重定向queue,卸载。 2 规则被不同组包含 ...
rc = rte_flow_validate(port_id, &attrs, items, actions, &error); 流验证通常用于检查底层 DPDK 驱动程序是否支持特定的流配置。流验证是一个可选步骤,在最后的代码中,您可以直接跳转到流创建。 flow_ptr= rte_flow_create(port_id, &attrs, items, actions, &error); ...
rc = rte_flow_validate(port_id, &attrs, items, actions, &error); 流验证通常用于检查底层 DPDK 驱动程序是否支持特定的流配置。流验证是一个可选步骤,在最后的代码中,您可以直接跳转到流创建。 flow_ptr= rte_flow_create(port_id, &attrs, items, actions, &error); ...
* create the action sequence. * one action only, move packet to queue */ action[0].type = RTE_FLOW_ACTION_TYPE_QUEUE; action[0].conf = &queue; action[1].type = RTE_FLOW_ACTION_TYPE_MARK; action[1].conf = &mark; action[2].type = RTE_FLOW_ACTION_TYPE_END; ...