Sorry,mq_mode is RTE_ETH_MQ_RX_RSS in rte_eth_conf.
call chain:
rte_eth_bond_create()->rte_eth_dev_configure()->rte_eth_bond_slave_add()->rte_eth_dev_start()
Consider this call chain, internals->rss_key_len is 0 in bond_ethdev_configure() when we call rte_eth_dev_configure().
If internals->rss_key_len is 0, internals->rss_key can not be set properly.
Because memcpy in bond_ethdev_configure() use internals->rss_key_len(it is 0) as copy size, and internals->rss_key will not be set in other functions.
---
e.g.:
bond_ethdev_configure(struct rte_eth_dev *dev)
{
const char *name = dev->device->name;
struct bond_dev_private *internals = dev->data->dev_private;
...
/*
* If RSS is enabled, fill table with default values and
* set key to the value specified in port RSS configuration.
* Fall back to default RSS key if the key is not specified
*/
if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS) {
struct rte_eth_rss_conf *rss_conf =
&dev->data->dev_conf.rx_adv_conf.rss_conf;
if (rss_conf->rss_key != NULL) {
if (internals->rss_key_len > rss_conf->rss_key_len) {
RTE_BOND_LOG(ERR, "Invalid rss key length(%u)",
rss_conf->rss_key_len);
return -EINVAL;
}
memcpy(internals->rss_key, rss_conf->rss_key,
internals->rss_key_len);
} else {
if (internals->rss_key_len > sizeof(default_rss_key)) {
RTE_BOND_LOG(ERR,
"There is no suitable default hash key");
return -EINVAL;
}
memcpy(internals->rss_key, default_rss_key,
internals->rss_key_len);
}
----Origin----
From:"Min Hu (Connor)" <humin29@huawei.com>
To:"yuwenjun_yewu" <yuwenjun_yewu@cmss.chinamobile.com>,tangchengchang <tangchengchang@huawei.com>,"ferruh.yigit" <ferruh.yigit@intel.com>
Cc: dev <dev@dpdk.org>,stable <stable@dpdk.org>
Date:2022-01-14 08:59:21
Subject:Re: [PATCH] net/bonding: fix RSS not work for bonding in DPDK21.11
Hi,
在 2022/1/12 15:29, 俞文俊_yewu 写道:
> From 85c4ffffe32996fc262dd6f69d0ce272ae8e8350 Mon Sep 17 00:00:00 2001
>
> From: Yu Wenjun <yuwenjun_yewu@cmss.chinamobile.com>
>
> Date: Wed, 12 Jan 2022 15:01:10 +0800
>
> Subject: [PATCH] net/bonding: fix RSS not work for bonding
>
>
> RSS don't work when upgrade to DPDK21.11.
Cannot get your meaning, Why RSS don't work?
As mq_mode is not RTE_ETH_MQ_RX_RSS in rte_eth_conf, RSS is off.
Please make it clearer, thanks.
>
>
> e.g.:
>
> examples/bond/main.c:
>
> conf:
>
> static struct rte_eth_conf port_conf = {
>
> .rxmode = {
>
> .mq_mode = RTE_ETH_MQ_RX_NONE,
>
> .split_hdr_size = 0,
>
> },
>
> .rx_adv_conf = {
>
> .rss_conf = {
>
> .rss_key = NULL,
>
> .rss_hf = RTE_ETH_RSS_IP,
>
> },
>
> },
>
> .txmode = {
>
> .mq_mode = RTE_ETH_MQ_TX_NONE,
>
> },
>
> };
>
>
> call chain:
>
> rte_eth_bond_create()->rte_eth_dev_configure()->rte_eth_bond_slave_add()->rte_eth_dev_start()
>
>
> Signed-off-by: Yu Wenjun <yuwenjun_yewu@cmss.chinamobile.com>
>
> ---
>
> drivers/net/bonding/rte_eth_bond_pmd.c | 5 +++++
>
> 1 file changed, 5 insertions(+)
>
>
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c
> b/drivers/net/bonding/rte_eth_bond_pmd.c
>
> index 84f4900ee5..31bcee15cf 100644
>
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>
> @@ -3504,6 +3504,11 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
>
> if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS) {
>
> struct rte_eth_rss_conf *rss_conf =
>
> &dev->data->dev_conf.rx_adv_conf.rss_conf;
>
> +
>
> +if (internals->rss_key_len == 0) {
>
> +internals->rss_key_len = sizeof(default_rss_key);
>
> +}
>
> +
>
> if (rss_conf->rss_key != NULL) {
>
> if (internals->rss_key_len > rss_conf->rss_key_len) {
>
> RTE_BOND_LOG(ERR, "Invalid rss key length(%u)",
>
> --
>
> 2.32.0.windows.1
>
>
Subject:Re: [PATCH] net/bonding: fix RSS not work for bonding in DPDK21.11
Hi,
在 2022/1/12 15:29, 俞文俊_yewu 写道:
> From 85c4ffffe32996fc262dd6f69d0ce272ae8e8350 Mon Sep 17 00:00:00 2001
>
> From: Yu Wenjun <yuwenjun_yewu@cmss.chinamobile.com>
>
> Date: Wed, 12 Jan 2022 15:01:10 +0800
>
> Subject: [PATCH] net/bonding: fix RSS not work for bonding
>
>
> RSS don't work when upgrade to DPDK21.11.
Cannot get your meaning, Why RSS don't work?
As mq_mode is not RTE_ETH_MQ_RX_RSS in rte_eth_conf, RSS is off.
Please make it clearer, thanks.
>
>
> e.g.:
>
> examples/bond/main.c:
>
> conf:
>
> static struct rte_eth_conf port_conf = {
>
> .rxmode = {
>
> .mq_mode = RTE_ETH_MQ_RX_NONE,
>
> .split_hdr_size = 0,
>
> },
>
> .rx_adv_conf = {
>
> .rss_conf = {
>
> .rss_key = NULL,
>
> .rss_hf = RTE_ETH_RSS_IP,
>
> },
>
> },
>
> .txmode = {
>
> .mq_mode = RTE_ETH_MQ_TX_NONE,
>
> },
>
> };
>
>
> call chain:
>
> rte_eth_bond_create()->rte_eth_dev_configure()->rte_eth_bond_slave_add()->rte_eth_dev_start()
>
>
> Signed-off-by: Yu Wenjun <yuwenjun_yewu@cmss.chinamobile.com>
>
> ---
>
> drivers/net/bonding/rte_eth_bond_pmd.c | 5 +++++
>
> 1 file changed, 5 insertions(+)
>
>
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c
> b/drivers/net/bonding/rte_eth_bond_pmd.c
>
> index 84f4900ee5..31bcee15cf 100644
>
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>
> @@ -3504,6 +3504,11 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
>
> if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS) {
>
> struct rte_eth_rss_conf *rss_conf =
>
> &dev->data->dev_conf.rx_adv_conf.rss_conf;
>
> +
>
> +if (internals->rss_key_len == 0) {
>
> +internals->rss_key_len = sizeof(default_rss_key);
>
> +}
>
> +
>
> if (rss_conf->rss_key != NULL) {
>
> if (internals->rss_key_len > rss_conf->rss_key_len) {
>
> RTE_BOND_LOG(ERR, "Invalid rss key length(%u)",
>
> --
>
> 2.32.0.windows.1
>
>