是否有一种使用rte_flow将arp和ndp数据包发送到特定rx队列的方法?
在rte_flow_item_type中,我看不到arp或ndp的条目
对于ipv4,我采用了以下方法
pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
pattern[0].spec = NULL;
pattern[1].type = RTE_FLOW_ITEM_TYPE_IPV4;
pattern[1].spec = NULL;我要为arp和ndp做些什么?没有RTE_FLOW_ITEM_TYPE_ARP
发布于 2022-03-29 00:05:25
从v18.05-rc1开始,就出现了项目类型RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4。尽管如此,有关的PMD可能不支持这一建议。
考虑在EtherType字段上进行匹配,而不是:
#include <rte_byteorder.h>
#include <rte_ether.h>
#include <rte_flow.h> struct rte_flow_item_eth item_eth_mask = {};
struct rte_flow_item_eth item_eth_spec = {};
item_eth_spec.hdr.ether_type = RTE_BE16(RTE_ETHER_TYPE_ARP);
item_eth_mask.hdr.ether_type = RTE_BE16(0xFFFF);
pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
pattern[0].mask = &item_eth_mask;
pattern[0].spec = &item_eth_spec;在NDP中,也许查看RTE_FLOW_ITEM_TYPE_ICMP6_ND_*是值得的。同样,这些建议可能得不到有关的和平与发展司的支持。如果是这样的话,请考虑使用RTE_FLOW_ITEM_TYPE_ICMP6将所有ICMPv6重定向到专用队列。
发布于 2022-03-29 06:45:38
所有供应商PMD的不匹配数据包的默认队列(禁用RSS )为队列0。期望值为TAP PMD,操作系统支持多个RX队列。
由于您已经提到了DPDK版本是19.11,最好的选择是使用rte_flow_item_eth过滤所需的醚类型。载于DPDK 19.11
struct rte_flow_item_eth {
struct rte_ether_addr dst; /**< Destination MAC. */
struct rte_ether_addr src; /**< Source MAC. */
rte_be16_t type; /**< EtherType or TPID. */
};因此,使用下面的代码片段,您可以实现对所需队列的数据包类型引导。
struct rte_flow_attr attr = { .ingress = 1 };
struct rte_flow_item pattern[10];
struct rte_flow_action actions[10];
struct rte_flow_action_queue actionqueue = { .index = 1 };
struct rte_flow_item_eth eth;
struct rte_flow_item_vlan vlan;
struct rte_flow_item_ipv4 ipv4;
struct rte_flow *flow;
struct rte_flow_error error;
struct rte_flow_item_eth item_eth_mask;
struct rte_flow_item_eth item_eth_spec;
/* memset item_eth_mask and item_eth_spec to 0 */
item_eth_spec.hdr.ether_type = RTE_BE16(RTE_ETHER_TYPE_ARP);
item_eth_mask.hdr.ether_type = 0xFFFF;
/* setting the eth to pass all packets */
pattern[0].type = RTE_FLOW_ITEM_TYPE_ETH;
pattern[0].spec = ð
pattern[0].last = &item_eth_mask;
pattern[0].mask = &item_eth_spec;
/* end the pattern array */
pattern[1].type = RTE_FLOW_ITEM_TYPE_END;
actions[0].type = RTE_FLOW_ACTION_TYPE_QUEUE;
actions[0].conf = &actionqueue;
actions[1].type = RTE_FLOW_ACTION_TYPE_END;
/* validate and create the flow rule */
if (!rte_flow_validate(port, &attr, pattern, actions, &error))
flow = rte_flow_create(port, &attr, pattern, actions, &error);
else
printf("rte_flow err %s\n", error.message);注意:这在英特尔X710和E810网卡上失败,因为它支持VLAn+IP+UDP|TCP|SCTP+Inner。
https://stackoverflow.com/questions/71643934
复制相似问题