【问题标题】:RSS (Receive Side Scaling) on Intel XL710 Per portIntel XL710 上的 RSS(接收端缩放)每个端口
【发布时间】:2018-08-02 18:11:20
【问题描述】:

我与使用 DPDK 的英特尔 XL710 卡斗争,使其在每个端口上仅使用 SRC IPV4 或 DST IPV4 计算 RSS 哈希。 该卡有 4 个 10GE 端口,无论我做什么,RSS 配置对他们来说都是全局的。我尝试在 PCTYPE 中设置 SRC/DST IPV4 字段,而应用的配置 last 只起作用。

所以我想要实现的行为。

假设我有上游数据包到达端口 0:

SRC:10.10.10.1DST:10.10.10.2

并回复下行数据包到达端口 1:

SRC:10.10.10.2DST:10.10.10.1

我希望卡上的端口 0(在我们的例子中是 upstream)根据 SRC 地址 10.10.10.1 计算 RSS 哈希对于端口 1(downstream)使用 DST 地址计算哈希,在我们的例子中也将是 10.10.10.1。所以想法是在RX队列之间分配数据包,只有SRC/DST地址分别影响这种分配。

我并没有专门绑定到 RSS。如果允许实现这一点,无论技术会做什么。

我使用的配置:

void setFilter(uint16_t portId, uint32_t value){

//Value = RTE_ETH_FLOW_NONFRAG_IPV4_TCP in that case

struct rte_eth_hash_filter_info info;
uint32_t ftype, idx, offset;
int ret;

if (rte_eth_dev_filter_supported(portId,
            RTE_ETH_FILTER_HASH) < 0) {
    printf("RTE_ETH_FILTER_HASH not supported on port %d\n",
                        portId);
    return;
}

memset(&info, 0, sizeof(info));
info.info_type = RTE_ETH_HASH_FILTER_GLOBAL_CONFIG;
info.info.global_conf.hash_func =
  RTE_ETH_HASH_FUNCTION_DEFAULT;

ftype = value;
idx = ftype / UINT64_BIT;
offset = ftype % UINT64_BIT;
info.info.global_conf.valid_bit_mask[idx] |= (1ULL << offset);
info.info.global_conf.sym_hash_enable_mask[idx] |=
  (1ULL << offset);
ret = rte_eth_dev_filter_ctrl(portId, RTE_ETH_FILTER_HASH,
                RTE_ETH_FILTER_SET, &info);
if (ret < 0)
    printf("Cannot set global hash configurations by port %d\n",
                        portId);
else
    printf("Global hash configurations have been set "
           "succcessfully by port %d\n", portId);
}

void setPctypeRss(uint16_t portId, uint16_t fieldIdx) {

/* Note that AVF_FILTER_PCTYPE_NONF_IPV4_TCP is define for
 * Virtual Function. Defines are the same for Physical Functions
 */
int ret = -ENOTSUP;

enum rte_pmd_i40e_inset_type inset_type = INSET_HASH;
struct rte_pmd_i40e_inset inset;

ret = rte_pmd_i40e_inset_get(portId, AVF_FILTER_PCTYPE_NONF_IPV4_TCP,
                             &inset, inset_type);

if (ret) {
    printf("Failed to get input set.\n");
    return;
}

memset(&inset, 0, sizeof(inset));

ret = rte_pmd_i40e_inset_set(portId, AVF_FILTER_PCTYPE_NONF_IPV4_TCP,
                 &inset, inset_type);

if (ret) {
    printf("Failed to CLEAR input set.\n");
    return;
}
else
{
    printf("Successfull cleared input set\n");
}

ret = rte_pmd_i40e_inset_get(portId, AVF_FILTER_PCTYPE_NONF_IPV4_TCP,
                 &inset, inset_type);
if (ret) {
    printf("Failed to get input set.\n");
    return;
}

ret = rte_pmd_i40e_inset_field_set(&inset.inset, fieldIdx);

if (ret) {
    printf("Failed to configure input set field.\n");
    return;
}

ret = rte_pmd_i40e_inset_set(portId, AVF_FILTER_PCTYPE_NONF_IPV4_TCP,
                 &inset, inset_type);
if (ret) {
    printf("Failed to set input set.\n");
    return;
}

if (ret == -ENOTSUP)
    printf("Function not supported\n");
}

【问题讨论】:

  • RSS 是要走的路。向我们展示您迄今为止尝试过的配置?
  • @AndriyBerestovskyy 添加了配置代码,希望对您有所帮助

标签: network-programming intel dpdk


【解决方案1】:

IMO 值得尝试更简单的解决方案。我们可以简单地使用rte_eth_dev_configure()

https://doc.dpdk.org/api/rte__ethdev_8h.html#a1a7d3a20b102fee222541fda50fd87bd

只需将eth_conf.rss_conf.rss_hf 设置为ETH_RSS_IP,如下所述:

https://doc.dpdk.org/api/structrte__eth__rss__conf.html#ad70f17882a835e5d4e38c64a9f872fdc

在 DPDK 中使用此功能的示例很少。而且它们中的大多数都可以正常工作;)

【讨论】:

  • 感谢您的回复!我也尝试了该配置,但它不允许在 NIC 上的每个物理端口使用不同的 IPV4 标头字段进行 RSS 哈希计算。您只能使其对称,但似乎没有办法强制 RSS 至少在 XL710 上仅使用 SRC 计算物理端口 0 的哈希值和仅使用 DST 的物理端口 1 的哈希值。
  • @toozyfuzzy 有用吗?你想创建一个每个服务器的本地状态结构吗?
  • 不,它会影响所有端口 =(我需要这个,因为我的设备具有“客户端”实体,该实体由它在此设备上配置的 IPV4 标识。所以我想将该 IPV4 的所有流引导到相同的lcore 进行处理。设备有大量的“客户端”,每个客户端都有唯一的 IPV4
  • "RSS 字段选择是全局完成的,不能根据 PF 或 VF 进行不同的配置。"来源:intel.com/content/dam/www/public/us/en/documents/…
  • 我不确定您有多少客户端,但请注意 Flow Director 有其自身的限制......我想最可靠和便携的解决方案是软件分发器,即数据包的专用核心分类并转发到特定的 RX 队列以供其他内核处理。除非对称 RSS 能满足您的需求...
猜你喜欢
  • 1970-01-01
  • 2012-05-28
  • 2015-07-12
  • 1970-01-01
  • 2023-04-02
  • 2014-10-04
  • 2018-09-25
  • 2016-12-15
  • 1970-01-01
相关资源
最近更新 更多