Skip to content

Commit

Permalink
net/hns3: remove redundant RSS tuple field
Browse files Browse the repository at this point in the history
[ upstream commit bfd0b54 ]

The 'rss_tuple_fields' in struct struct hns3_rss_conf::rss_tuple_sets is
redundant. Because the enabled RSS tuple in PMD is already managed by
the 'types' in struct hns3_rss_conf::conf. This patch removes this
redundant variable.

Fixes: c37ca66 ("net/hns3: support RSS")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
  • Loading branch information
LiHuiSong1 authored and steevenlee committed Jun 20, 2022
1 parent 7bce9bb commit 21c2dd6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
6 changes: 2 additions & 4 deletions drivers/net/hns3/hns3_flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ hns3_disable_rss(struct hns3_hw *hw)
{
int ret;

ret = hns3_set_rss_tuple_by_rss_hf(hw, &hw->rss_info.rss_tuple_sets, 0);
ret = hns3_set_rss_tuple_by_rss_hf(hw, 0);
if (ret)
return ret;
hw->rss_dis_flag = true;
Expand Down Expand Up @@ -1463,7 +1463,6 @@ hns3_parse_rss_algorithm(struct hns3_hw *hw, enum rte_eth_hash_function *func,
static int
hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config)
{
struct hns3_rss_tuple_cfg *tuple;
int ret;

hns3_parse_rss_key(hw, rss_config);
Expand All @@ -1479,8 +1478,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config)

hw->rss_info.conf.func = rss_config->func;

tuple = &hw->rss_info.rss_tuple_sets;
ret = hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_config->types);
ret = hns3_set_rss_tuple_by_rss_hf(hw, rss_config->types);
if (ret)
hns3_err(hw, "Update RSS tuples by rss hf failed %d", ret);

Expand Down
12 changes: 4 additions & 8 deletions drivers/net/hns3/hns3_rss.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ hns3_rss_reset_indir_table(struct hns3_hw *hw)
}

int
hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw,
struct hns3_rss_tuple_cfg *tuple, uint64_t rss_hf)
hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf)
{
struct hns3_rss_input_tuple_cmd *req;
struct hns3_cmd_desc desc;
Expand Down Expand Up @@ -356,7 +355,6 @@ hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw,
return ret;
}

tuple->rss_tuple_fields = rte_le_to_cpu_64(req->tuple_field);
/* Update supported flow types when set tuple success */
hw->rss_info.conf.types = rss_hf;

Expand All @@ -377,7 +375,6 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
struct rte_eth_rss_conf *rss_conf)
{
struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private);
struct hns3_rss_tuple_cfg *tuple = &hw->rss_info.rss_tuple_sets;
uint64_t rss_hf_bk = hw->rss_info.conf.types;
uint8_t key_len = rss_conf->rss_key_len;
uint64_t rss_hf = rss_conf->rss_hf;
Expand All @@ -394,7 +391,7 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
}

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

Expand All @@ -408,7 +405,7 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev,
return 0;

set_algo_key_fail:
(void)hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_hf_bk);
(void)hns3_set_rss_tuple_by_rss_hf(hw, rss_hf_bk);
set_tuple_fail:
rte_spinlock_unlock(&hw->lock);
return ret;
Expand Down Expand Up @@ -704,8 +701,7 @@ hns3_config_rss(struct hns3_adapter *hns)
!(rss_hf & HNS3_ETH_RSS_SUPPORT))
rss_hf = 0;

return hns3_set_rss_tuple_by_rss_hf(hw, &hw->rss_info.rss_tuple_sets,
rss_hf);
return hns3_set_rss_tuple_by_rss_hf(hw, rss_hf);
}

/*
Expand Down
5 changes: 1 addition & 4 deletions drivers/net/hns3/hns3_rss.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ struct hns3_rss_conf {
struct rte_flow_action_rss conf;
uint8_t hash_algo; /* hash function type defined by hardware */
uint8_t key[HNS3_RSS_KEY_SIZE]; /* Hash key */
struct hns3_rss_tuple_cfg rss_tuple_sets;
uint16_t rss_indirection_tbl[HNS3_RSS_IND_TBL_SIZE_MAX];
uint16_t queue[HNS3_RSS_QUEUES_BUFFER_NUM]; /* Queues indices to use */
bool valid; /* check if RSS rule is valid */
Expand Down Expand Up @@ -107,9 +106,7 @@ int hns3_set_rss_indir_table(struct hns3_hw *hw, uint16_t *indir,
int hns3_rss_reset_indir_table(struct hns3_hw *hw);
int hns3_config_rss(struct hns3_adapter *hns);
void hns3_rss_uninit(struct hns3_adapter *hns);
int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw,
struct hns3_rss_tuple_cfg *tuple,
uint64_t rss_hf);
int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf);
int hns3_set_rss_algo_key(struct hns3_hw *hw, const uint8_t *key);
int hns3_restore_rss_filter(struct rte_eth_dev *dev);

Expand Down

0 comments on commit 21c2dd6

Please sign in to comment.