Skip to content

Commit

Permalink
net/hns3: fix configuring RSS hash when rules are flushed
Browse files Browse the repository at this point in the history
Currently, when performing test case as follow:
1. Run testpmd application based on hns3 network engine with multiple
   receive queues(--rxq=N --txq=N, N>1).
2. Create the special RSS rules by "create flow ..." command in the
   command prompt of the testpmd application.
3. Flush the RSS rules created in step 2 by "flow flush ..." command.
4. Enable RSS by "port config all rss all" command.
In step 4, the command exeuctes successfully. This phenomenon is
inconsistent with the expectation. The API function named
rte_eth_dev_rss_hash_update called in the command should return error
and the command should fail.

This patch fixes it by adding a flag for disabling RSS in the driver.
When RSS rules is flushed, we set the the flag with true, and the
'.rss_hash_update' ops implementation function named
hns3_dev_rss_hash_update return -EINVAL.

Fixes: c37ca66 ("net/hns3: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
  • Loading branch information
oulijun authored and Ferruh Yigit committed Apr 21, 2020
1 parent 920be79 commit 5e782bc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/hns3/hns3_ethdev.c
Expand Up @@ -2663,6 +2663,7 @@ hns3_get_board_configuration(struct hns3_hw *hw)

hw->mac.media_type = cfg.media_type;
hw->rss_size_max = cfg.rss_size_max;
hw->rss_dis_flag = false;
hw->rx_buf_len = cfg.rx_buf_len;
memcpy(hw->mac.mac_addr, cfg.mac_addr, RTE_ETHER_ADDR_LEN);
hw->mac.phy_addr = cfg.phy_addr;
Expand Down
1 change: 1 addition & 0 deletions drivers/net/hns3/hns3_ethdev.h
Expand Up @@ -368,6 +368,7 @@ struct hns3_hw {

/* The configuration info of RSS */
struct hns3_rss_conf rss_info;
bool rss_dis_flag; /* disable rss flag. true: disable, false: enable */

uint8_t num_tc; /* Total number of enabled TCs */
uint8_t hw_tc_map;
Expand Down
1 change: 1 addition & 0 deletions drivers/net/hns3/hns3_ethdev_vf.c
Expand Up @@ -1022,6 +1022,7 @@ hns3vf_get_configuration(struct hns3_hw *hw)
int ret;

hw->mac.media_type = HNS3_MEDIA_TYPE_NONE;
hw->rss_dis_flag = false;

/* Get queue configuration from PF */
ret = hns3vf_get_queue_info(hw);
Expand Down
1 change: 1 addition & 0 deletions drivers/net/hns3/hns3_flow.c
Expand Up @@ -1333,6 +1333,7 @@ hns3_disable_rss(struct hns3_hw *hw)

/* Disable RSS */
hw->rss_info.conf.types = 0;
hw->rss_dis_flag = true;

return 0;
}
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/hns3/hns3_rss.c
Expand Up @@ -261,6 +261,9 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
uint8_t *key = rss_conf->rss_key;
int ret;

if (hw->rss_dis_flag)
return -EINVAL;

rte_spinlock_lock(&hw->lock);
ret = hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_hf);
if (ret)
Expand Down

0 comments on commit 5e782bc

Please sign in to comment.