【发布时间】: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.1 和 DST:10.10.10.2
并回复下行数据包到达端口 1:
SRC:10.10.10.2 和 DST: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