net/iavf: fix default RSS configuration
PATCH 1/1 net/iavf: fix default RSS configuration
All the RSS rules should be cleared before creating default RSS rules for VF, otherwise duplicated rules will cause error.
Fixes 5ea614254332("net/iavf: fix VF reset for RSS")
Signed-off-by Wenjun Wu <[email protected]>
---
This is a DPDK 20.11 only patch, since the deployment has been implemented after code refactoring in DPDK 21.02.
--- drivers/net/iavf/iavf.h | 2 ++ drivers/net/iavf/iavf_ethdev.c | 26 ++++++++++++++++++++++++++ drivers/net/iavf/iavf_hash.c | 8 +------- drivers/net/iavf/iavf_vchnl.c | 23 +++++++++++++++++++++++ 4 files changed, 52 insertions(+), 7 deletions(-)
drivers/net/iavf/iavf.h +2 -0
@@ -322,6 +322,8 @@ int iavf_fdir_check(struct iavf_adapter *adapter, struct iavf_fdir_conf *filter);int iavf_add_del_rss_cfg (struct iavf_adapter *adapter,struct virtchnl_rss_cfg *rss_cfg,bool add); +int iavf_set_hena (struct iavf_adapter *adapter,uint64_t hena); +int iavf_hash_default_set (struct iavf_adapter *ad,bool add);int iavf_add_del_mc_addr_list (struct iavf_adapter *adapter,struct rte_ether_addr *mc_addrs,uint32_t mc_addrs_num,bool add);
drivers/net/iavf/iavf_ethdev.c +26 -0
@@ -295,6 +295,12 @@ iavf_init_rss(struct iavf_adapter *adapter)if (ret)return ret; + ret =iavf_hash_default_set (adapter, true); +if (ret) { +PMD_DRV_LOG (ERR ,"fail to set default RSS" ); +return ret; + } +return 0 ; }
@@ -1954,6 +1960,24 @@ iavf_dev_filter_ctrl(struct rte_eth_dev *dev,return ret; } +static void +iavf_default_rss_disable (struct iavf_adapter *adapter) +{ +struct iavf_info *vf =IAVF_DEV_PRIVATE_TO_VF (adapter); +int ret =0 ; + +if (vf->vf_res->vf_cap_flags &VIRTCHNL_VF_OFFLOAD_RSS_PF ) { +/* Set hena = 0 to ask PF to cleanup all existing RSS. */ + ret =iavf_set_hena (adapter,0 ); +if (ret) +/* It is a workaround, temporarily allow error to be +* returned due to possible lack of PF handling for +* hena = 0. +*/ +PMD_INIT_LOG (WARNING ,"fail to disable default RSS," +"lack PF support" ); + } +}static int iavf_dev_init (struct rte_eth_dev *eth_dev)
@@ -2041,6 +2065,8 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)return ret; } +iavf_default_rss_disable (adapter); +return 0 ; }
drivers/net/iavf/iavf_hash.c +1 -7
@@ -458,7 +458,7 @@ static struct iavf_flow_parser iavf_hash_parser = { .stage = IAVF_FLOW_STAGE_RSS, }; -static int +int iavf_hash_default_set (struct iavf_adapter *ad,bool add) {struct virtchnl_rss_cfg *rss_cfg;
@@ -510,12 +510,6 @@ iavf_hash_init(struct iavf_adapter *ad)return ret; } - ret =iavf_hash_default_set (ad, true); -if (ret) { -PMD_DRV_LOG (ERR ,"fail to set default RSS" ); -iavf_unregister_parser (parser, ad); - } -return ret; }
drivers/net/iavf/iavf_vchnl.c +23 -0
@@ -1490,3 +1490,26 @@ iavf_get_max_rss_queue_region(struct iavf_adapter *adapter)return 0 ; } + +int +iavf_set_hena (struct iavf_adapter *adapter,uint64_t hena) +{ +struct iavf_info *vf =IAVF_DEV_PRIVATE_TO_VF (adapter); +struct virtchnl_rss_hena vrh; +struct iavf_cmd_info args; +int err; + + vrh.hena = hena; + args.ops =VIRTCHNL_OP_SET_RSS_HENA ; + args.in_args = (u8 *)&vrh; + args.in_args_size =sizeof (vrh); + args.out_buffer = vf->aq_resp; + args.out_size =IAVF_AQ_BUF_SZ ; + + err =iavf_execute_vf_cmd (adapter, &args); +if (err) +PMD_DRV_LOG (ERR , +"Failed to execute command of OP_SET_RSS_HENA" ); + +return err; +}
Signature · 1 line
2.25.1