首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基于dpdk的arp分组rte流

基于dpdk的arp分组rte流
EN

Stack Overflow用户
提问于 2022-03-28 07:42:55
回答 2查看 404关注 0票数 0

是否有一种使用rte_flow将arp和ndp数据包发送到特定rx队列的方法?

在rte_flow_item_type中,我看不到arp或ndp的条目

对于ipv4,我采用了以下方法

代码语言:javascript
复制
                                                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

  • Dpdk版本: 19.11
  • NIC: mlx5,100 G mellanox卡,
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-03-29 00:05:25

v18.05-rc1开始,就出现了项目类型RTE_FLOW_ITEM_TYPE_ARP_ETH_IPV4。尽管如此,有关的PMD可能不支持这一建议。

考虑在EtherType字段上进行匹配,而不是:

代码语言:javascript
复制
#include <rte_byteorder.h>
#include <rte_ether.h>
#include <rte_flow.h>
代码语言:javascript
复制
        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重定向到专用队列。

票数 1
EN

Stack Overflow用户

发布于 2022-03-29 06:45:38

所有供应商PMD的不匹配数据包的默认队列(禁用RSS )为队列0。期望值为TAP PMD,操作系统支持多个RX队列。

由于您已经提到了DPDK版本是19.11,最好的选择是使用rte_flow_item_eth过滤所需的醚类型。载于DPDK 19.11

代码语言:javascript
复制
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. */
};

因此,使用下面的代码片段,您可以实现对所需队列的数据包类型引导。

代码语言:javascript
复制
        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 = &eth;
        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。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71643934

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档