net/ice: cleanup RSS/FDIR profile when device init
PATCH 1/1 net/ice: cleanup RSS/FDIR profile when device init
The patch cleanup RSS/FDIR profile resources when device init to fix profile ID increase issue.
---
---
This patch depends on the following patches in patchwork:
(1) http://patchwork.dpdk.org/project/dpdk/list/?series=6557
(2) http://patches.dpdk.org/project/dpdk/list/?series=6579
(3) http://patches.dpdk.org/project/dpdk/list/?series=6577
---
drivers/net/ice/ice_ethdev.c | 115 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+)
drivers/net/ice/ice_ethdev.c +115 -0
@@ -13,6 +13,7 @@#include "base/ice_sched.h" #include "base/ice_flow.h" #include "base/ice_dcb.h" +#include "base/ice_common.h" #include "ice_ethdev.h" #include "ice_rxtx.h" #include "ice_generic_flow.h"
@@ -40,6 +41,7 @@ static const char * const ice_valid_args[] = {#define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package"#define ICE_COMMS_PKG_NAME "ICE COMMS Package"#define ICE_MAX_PKG_FILENAME_SIZE 256 +#define ICE_MAX_RES_DESC_NUM 1024int ice_logtype_init;int ice_logtype_driver;
@@ -1851,6 +1853,113 @@ ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on)return ret; } +static enum ice_status +ice_aq_get_res_profs (struct ice_hw *hw,uint16_t num_entries, +struct ice_aqc_get_allocd_res_desc_resp *resp_buf, +uint16_t buf_size,uint16_t res_type, +bool res_shared,uint16_t *desc_id, +struct ice_sq_cd *cd,uint16_t *num_prof) +{ +struct ice_aq_desc aq_desc; +int ret; + +struct ice_aqc_get_allocd_res_desc *cmd = + &aq_desc.params.get_res_desc; + +if (!resp_buf) +return ICE_ERR_PARAM ; + +if (buf_size != (num_entries *sizeof (*resp_buf))) +return ICE_ERR_PARAM ; + +ice_fill_dflt_direct_cmd_desc (&aq_desc, + ice_aqc_opc_get_allocd_res_desc); + + cmd->ops.cmd.res =CPU_TO_LE16 (((res_type <<ICE_AQC_RES_TYPE_S ) & +ICE_AQC_RES_TYPE_M ) | (res_shared ? +ICE_AQC_RES_TYPE_FLAG_SHARED :0 )); + cmd->ops.cmd.first_desc =CPU_TO_LE16 (*desc_id); + ret =ice_aq_send_cmd (hw, &aq_desc, resp_buf, buf_size, cd); +if (!ret) { + *desc_id =LE16_TO_CPU (cmd->ops.resp.next_desc); + *num_prof =LE16_TO_CPU (cmd->ops.resp.num_desc); + } +return ret; +} + +static enum ice_status +ice_get_hw_res (struct ice_hw *hw,uint16_t type,uint16_t num,uint16_t *res, +uint16_t *prof_buf,uint16_t *num_prof) +{ +struct ice_aqc_get_allocd_res_desc_resp *resp_buf; +int ret; +uint16_t buf_len; + + buf_len =sizeof (*resp_buf) +sizeof (resp_buf->elem) * (num -1 ); + resp_buf = (struct ice_aqc_get_allocd_res_desc_resp *) +ice_malloc (hw, buf_len); +if (!resp_buf) +return -ENOMEM ; + + ret =ice_aq_get_res_profs (hw, num, resp_buf, buf_len, type,1 , + res,NULL , num_prof); +if (ret) + goto exit; + +ice_memcpy (prof_buf, resp_buf->elem,sizeof (resp_buf->elem) * + (*num_prof),ICE_NONDMA_TO_NONDMA ); +exit: +rte_free (resp_buf); +return ret; +} + +static int +ice_clearup_resource (struct ice_hw *hw,uint16_t res_type) +{ +int ret; +uint16_t prof_id; +uint16_t prof_buf[ICE_MAX_RES_DESC_NUM ]; +uint16_t first_desc =1 ; +uint16_t num_prof =0 ; + + ret =ice_get_hw_res (hw, res_type,ICE_MAX_RES_DESC_NUM , + &first_desc, prof_buf, &num_prof); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to get fxp resource" ); +return ret; + } + +for (prof_id =0 ; prof_id < num_prof; prof_id++) { + ret =ice_free_hw_res (hw, res_type,1 , &prof_buf[prof_id]); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to free fxp resource" ); +return ret; + } + } + +return 0 ; +} + +static int +ice_reset_fxp_resource (struct ice_hw *hw) +{ +int ret; + + ret =ice_clearup_resource (hw,ICE_AQC_RES_TYPE_FD_PROF_BLDR_PROFID ); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to clearup fdir resource" ); +return ret; + } + + ret =ice_clearup_resource (hw,ICE_AQC_RES_TYPE_HASH_PROF_BLDR_PROFID ); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to clearup rss resource" ); +return ret; + } + +return 0 ; +} +static int ice_dev_init (struct rte_eth_dev *dev) {
@@ -1983,6 +2092,12 @@ ice_dev_init(struct rte_eth_dev *dev)return ret; } + ret =ice_reset_fxp_resource (hw); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to reset fxp resource" ); +return ret; + } +return 0 ; err_pf_setup:
Signature · 1 line
2.15.1
Quoted 2 lines · Ying Wang
The patch cleanup RSS/FDIR profile resources when device init to fix profile ID increase issue.
Could you elaborate the profile ID increase issue in the commit log?
Quoted 37 lines
Fixes d7d150b93070 ("net/ice: enable RSS when device init")Signed-off-by Ying Wang <[email protected]>---
---
This patch depends on the following patches in patchwork:
(1) http://patchwork.dpdk.org/project/dpdk/list/?series=6557
(2) http://patches.dpdk.org/project/dpdk/list/?series=6579
(3) http://patches.dpdk.org/project/dpdk/list/?series=6577
---
drivers/net/ice/ice_ethdev.c| 115 +++++++++++++++++++++++++++++++++++++++++++1 file changed, 115 insertions(+)drivers/net/ice/ice_ethdev.c +2
-0@@ -13,6 +13,7 @@#include "base/ice_sched.h" #include "base/ice_flow.h" #include "base/ice_dcb.h" +#include "base/ice_common.h" #include "ice_ethdev.h" #include "ice_rxtx.h" #include "ice_generic_flow.h" @@ -40,6 +41,7 @@ static const char * const ice_valid_args[] = {#define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package"#define ICE_COMMS_PKG_NAME "ICE COMMS Package"#define ICE_MAX_PKG_FILENAME_SIZE 256 +#define ICE_MAX_RES_DESC_NUM 1024int ice_logtype_init;int ice_logtype_driver;
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1861
Quoted 9 lines
drivers/net/ice/ice_ethdev.c +6
-0@@ -1851,6 +1853,113 @@ ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on)return ret; } +static enum ice_status +ice_aq_get_res_profs (struct ice_hw *hw,uint16_t num_entries, +struct ice_aqc_get_allocd_res_desc_resp *resp_buf, +uint16_t buf_size,uint16_t res_type, +bool res_shared,uint16_t *desc_id, +struct ice_sq_cd *cd,uint16_t *num_prof)
May consider use struct to reduce the number of parameters.
Quoted 27 lines
drivers/net/ice/ice_ethdev.c +27
-0+{ +struct ice_aq_desc aq_desc; +int ret; + +struct ice_aqc_get_allocd_res_desc *cmd = + &aq_desc.params.get_res_desc; + +if (!resp_buf) +return ICE_ERR_PARAM ; + +if (buf_size != (num_entries *sizeof (*resp_buf))) +return ICE_ERR_PARAM ; + +ice_fill_dflt_direct_cmd_desc (&aq_desc, + ice_aqc_opc_get_allocd_res_desc); + + cmd->ops.cmd.res =CPU_TO_LE16 (((res_type <<ICE_AQC_RES_TYPE_S ) & +ICE_AQC_RES_TYPE_M ) | (res_shared ? +ICE_AQC_RES_TYPE_FLAG_SHARED :0 )); + cmd->ops.cmd.first_desc =CPU_TO_LE16 (*desc_id); + ret =ice_aq_send_cmd (hw, &aq_desc, resp_buf, buf_size, cd); +if (!ret) { + *desc_id =LE16_TO_CPU (cmd->ops.resp.next_desc); + *num_prof =LE16_TO_CPU (cmd->ops.resp.num_desc); + } +return ret; +}
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1898
Quoted 10 lines
drivers/net/ice/ice_ethdev.c +10
-0+ +static enum ice_status +ice_get_hw_res (struct ice_hw *hw,uint16_t type,uint16_t num,uint16_t *res, +uint16_t *prof_buf,uint16_t *num_prof) +{ +struct ice_aqc_get_allocd_res_desc_resp *resp_buf; +int ret; +uint16_t buf_len; + + buf_len =sizeof (*resp_buf) +sizeof (resp_buf->elem) * (num -1 );
why (num - 1) here?
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1900
Quoted 2 lines
drivers/net/ice/ice_ethdev.c +2
-0+ resp_buf = (struct ice_aqc_get_allocd_res_desc_resp *) +ice_malloc (hw, buf_len);
Cast is unnecessary for void *
Quoted 7 lines
drivers/net/ice/ice_ethdev.c +7
-0+if (!resp_buf) +return -ENOMEM ; + + ret =ice_aq_get_res_profs (hw, num, resp_buf, buf_len, type,1 , + res,NULL , num_prof); +if (ret) + goto exit;
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1917
Quoted 10 lines
drivers/net/ice/ice_ethdev.c +10
-0+ +ice_memcpy (prof_buf, resp_buf->elem,sizeof (resp_buf->elem) * + (*num_prof),ICE_NONDMA_TO_NONDMA ); +exit: +rte_free (resp_buf); +return ret; +} + +static int +ice_clearup_resource (struct ice_hw *hw,uint16_t res_type)
s/clearup/cleanup
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1926
Quoted 9 lines
drivers/net/ice/ice_ethdev.c +9
-0+{ +int ret; +uint16_t prof_id; +uint16_t prof_buf[ICE_MAX_RES_DESC_NUM ]; +uint16_t first_desc =1 ; +uint16_t num_prof =0 ; + + ret =ice_get_hw_res (hw, res_type,ICE_MAX_RES_DESC_NUM , + &first_desc, prof_buf, &num_prof);
What is purpose of first_desc? Seems there is no reference of it afterwards.
Quoted 25 lines
drivers/net/ice/ice_ethdev.c +25
-0+if (ret) { +PMD_INIT_LOG (ERR ,"Failed to get fxp resource" ); +return ret; + } + +for (prof_id =0 ; prof_id < num_prof; prof_id++) { + ret =ice_free_hw_res (hw, res_type,1 , &prof_buf[prof_id]); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to free fxp resource" ); +return ret; + } + } + +return 0 ; +} + +static int +ice_reset_fxp_resource (struct ice_hw *hw) +{ +int ret; + + ret =ice_clearup_resource (hw,ICE_AQC_RES_TYPE_FD_PROF_BLDR_PROFID ); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to clearup fdir resource" ); +return ret;
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1961
Quoted 10 lines
drivers/net/ice/ice_ethdev.c +10
-0+ } + + ret =ice_clearup_resource (hw,ICE_AQC_RES_TYPE_HASH_PROF_BLDR_PROFID ); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to clearup rss resource" ); +return ret; + } + +return 0 ; +}
s/clearup/cleanup
Thanks,
Xiaolong
Quoted 20 lines
drivers/net/ice/ice_ethdev.c +1
-0+static int
ice_dev_init(struct rte_eth_dev *dev)
{drivers/net/ice/ice_ethdev.c +6
-0@@ -1983,6 +2092,12 @@ ice_dev_init(struct rte_eth_dev *dev)return ret; } + ret =ice_reset_fxp_resource (hw); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to reset fxp resource" ); +return ret; + } +return 0 ;
err_pf_setup:Signature · 1 line
2.15.1
Hi, Xiaolong
Thanks for your comments, will fix them in v2.
Quoted 205 lines
-----Original Message-----
From: Ye, Xiaolong
Sent: Monday, September 30, 2019 5:26 PM
To: Wang, Ying A <[email protected]>
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Yang, Qiming <[email protected]>; [email protected]
Subject: Re: [PATCH] net/ice: cleanup RSS/FDIR profile when device initQuoted 2 lines · Ying Wang
The patch cleanup RSS/FDIR profile resources when device init to fix profile ID increase issue.
Could you elaborate the profile ID increase issue in the commit log?
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool
Quoted 38 lines
Fixes d7d150b93070 ("net/ice: enable RSS when device init")Signed-off-by Ying Wang <[email protected]>---
---
This patch depends on the following patches in patchwork:
(1) http://patchwork.dpdk.org/project/dpdk/list/?series=6557
(2) http://patches.dpdk.org/project/dpdk/list/?series=6579
(3) http://patches.dpdk.org/project/dpdk/list/?series=6577
---
drivers/net/ice/ice_ethdev.c| 115
+++++++++++++++++++++++++++++++++++++++++++1 file changed, 115 insertions(+)(quoted diff) +0
-0
b/drivers/net/ice/ice_ethdev.cindex3abdaffbc..04102728f100644drivers/net/ice/ice_ethdev.c +2
-0@@ -13,6 +13,7 @@#include "base/ice_sched.h" #include "base/ice_flow.h" #include "base/ice_dcb.h" +#include "base/ice_common.h" #include "ice_ethdev.h" #include "ice_rxtx.h" #include "ice_generic_flow.h" @@ -40,6 +41,7 @@ static const char * const ice_valid_args[] = {#define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package"#define ICE_COMMS_PKG_NAME "ICE COMMS Package"#define ICE_MAX_PKG_FILENAME_SIZE 256 +#define ICE_MAX_RES_DESC_NUM 1024int ice_logtype_init;int ice_logtype_driver;@@ -1851,6 +1853,113 @@ ice_vsi_config_sw_lldp(struct ice_vsi *vsi, boolon)
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1861
Quoted 9 lines
drivers/net/ice/ice_ethdev.c +6
-0return ret; } +static enum ice_status +ice_aq_get_res_profs (struct ice_hw *hw,uint16_t num_entries, +struct ice_aqc_get_allocd_res_desc_resp *resp_buf, +uint16_t buf_size,uint16_t res_type, +bool res_shared,uint16_t *desc_id, +struct ice_sq_cd *cd,uint16_t *num_prof)May consider use struct to reduce the number of parameters.
Quoted 7 lines
drivers/net/ice/ice_ethdev.c +7
-0+{ +struct ice_aq_desc aq_desc; +int ret; + +struct ice_aqc_get_allocd_res_desc *cmd = + &aq_desc.params.get_res_desc; +drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on)
Quoted 10 lines
drivers/net/ice/ice_ethdev.c +10
-0+if (!resp_buf) +return ICE_ERR_PARAM ; + +if (buf_size != (num_entries *sizeof (*resp_buf))) +return ICE_ERR_PARAM ; + +ice_fill_dflt_direct_cmd_desc (&aq_desc, + ice_aqc_opc_get_allocd_res_desc); + + cmd->ops.cmd.res = CPU_TO_LE16(((res_type << ICE_AQC_RES_TYPE_S)&
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on)
Quoted 13 lines
drivers/net/ice/ice_ethdev.c +13
-0+ ICE_AQC_RES_TYPE_M) | (res_shared ? + ICE_AQC_RES_TYPE_FLAG_SHARED : 0)); + cmd->ops.cmd.first_desc =CPU_TO_LE16 (*desc_id); + ret =ice_aq_send_cmd (hw, &aq_desc, resp_buf, buf_size, cd); +if (!ret) { + *desc_id =LE16_TO_CPU (cmd->ops.resp.next_desc); + *num_prof =LE16_TO_CPU (cmd->ops.resp.num_desc); + } +return ret; +} + +static enum ice_status +ice_get_hw_res(struct ice_hw *hw, uint16_t type, uint16_t num, uint16_t*res,
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1898
Quoted 6 lines
drivers/net/ice/ice_ethdev.c +6
-0+ uint16_t *prof_buf, uint16_t *num_prof) { + struct ice_aqc_get_allocd_res_desc_resp *resp_buf; +int ret; +uint16_t buf_len; + + buf_len =sizeof (*resp_buf) +sizeof (resp_buf->elem) * (num -1 );why (num - 1) here?
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1900
Quoted 2 lines
drivers/net/ice/ice_ethdev.c +2
-0+ resp_buf = (struct ice_aqc_get_allocd_res_desc_resp *) +ice_malloc (hw, buf_len);Cast is unnecessary for void *
Quoted 7 lines
drivers/net/ice/ice_ethdev.c +7
-0+if (!resp_buf) +return -ENOMEM ; + + ret =ice_aq_get_res_profs (hw, num, resp_buf, buf_len, type,1 , + res,NULL , num_prof); +if (ret) + goto exit;drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1917
Quoted 10 lines
drivers/net/ice/ice_ethdev.c +10
-0+ +ice_memcpy (prof_buf, resp_buf->elem,sizeof (resp_buf->elem) * + (*num_prof),ICE_NONDMA_TO_NONDMA ); +exit: +rte_free (resp_buf); +return ret; +} + +static int +ice_clearup_resource (struct ice_hw *hw,uint16_t res_type)s/clearup/cleanup
drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1926
Quoted 9 lines
drivers/net/ice/ice_ethdev.c +9
-0+{ +int ret; +uint16_t prof_id; +uint16_t prof_buf[ICE_MAX_RES_DESC_NUM ]; +uint16_t first_desc =1 ; +uint16_t num_prof =0 ; + + ret =ice_get_hw_res (hw, res_type,ICE_MAX_RES_DESC_NUM , + &first_desc, prof_buf, &num_prof);What is purpose of
first_desc? Seems there is no reference of it afterwards.Quoted 11 lines
drivers/net/ice/ice_ethdev.c +11
-0+if (ret) { +PMD_INIT_LOG (ERR ,"Failed to get fxp resource" ); +return ret; + } + +for (prof_id =0 ; prof_id < num_prof; prof_id++) { + ret =ice_free_hw_res (hw, res_type,1 , &prof_buf[prof_id]); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to free fxp resource" ); +return ret; + }drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on)
Quoted 10 lines
drivers/net/ice/ice_ethdev.c +10
-0+ } + +return 0 ; +} + +static int +ice_reset_fxp_resource (struct ice_hw *hw) { +int ret; + + ret = ice_clearup_resource(hw,
ICE_AQC_RES_TYPE_FD_PROF_BLDR_PROFID);drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on)
Quoted 6 lines
drivers/net/ice/ice_ethdev.c +6
-0+if (ret) { +PMD_INIT_LOG (ERR ,"Failed to clearup fdir resource" ); +return ret; + } + + ret = ice_clearup_resource(hw,
ICE_AQC_RES_TYPE_HASH_PROF_BLDR_PROFID);drivers/net/ice/ice_ethdev.c ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on) · line 1961
Quoted 7 lines
drivers/net/ice/ice_ethdev.c +7
-0+if (ret) { +PMD_INIT_LOG (ERR ,"Failed to clearup rss resource" ); +return ret; + } + +return 0 ; +}s/clearup/cleanup
Thanks,
XiaolongQuoted 20 lines
drivers/net/ice/ice_ethdev.c +1
-0+static int
ice_dev_init(struct rte_eth_dev *dev)
{drivers/net/ice/ice_ethdev.c +6
-0@@ -1983,6 +2092,12 @@ ice_dev_init(struct rte_eth_dev *dev)return ret; } + ret =ice_reset_fxp_resource (hw); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to reset fxp resource" ); +return ret; + } +return 0 ;
err_pf_setup:
--
2.15.1
PATCH v2 1/1 net/ice: cleanup RSS/FDIR profile when device init
In reply to Ying WangWhen app restart, RSS/FDIR profile ID will increase which may run out of all the profile resources.
The patch cleanup RSS/FDIR profile resources when device init to fix this issue.
---
---
v2: Modify patch according to comments.
--- drivers/net/ice/ice_ethdev.c | 94 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+)
drivers/net/ice/ice_ethdev.c +94 -0
@@ -13,6 +13,7 @@#include "base/ice_sched.h" #include "base/ice_flow.h" #include "base/ice_dcb.h" +#include "base/ice_common.h" #include "ice_ethdev.h" #include "ice_rxtx.h" #include "ice_generic_flow.h"
@@ -40,6 +41,7 @@ static const char * const ice_valid_args[] = {#define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package"#define ICE_COMMS_PKG_NAME "ICE COMMS Package"#define ICE_MAX_PKG_FILENAME_SIZE 256 +#define ICE_MAX_RES_DESC_NUM 1024int ice_logtype_init;int ice_logtype_driver;
@@ -1882,6 +1884,92 @@ ice_vsi_config_sw_lldp(struct ice_vsi *vsi, bool on)return ret; } +static enum ice_status +ice_get_hw_res (struct ice_hw *hw,uint16_t res_type, +uint16_t num,uint16_t desc_id, +uint16_t *prof_buf,uint16_t *num_prof) +{ +struct ice_aqc_get_allocd_res_desc_resp *resp_buf; +int ret; +uint16_t buf_len; +bool res_shared =1 ; +struct ice_aq_desc aq_desc; +struct ice_sq_cd *cd =NULL ; +struct ice_aqc_get_allocd_res_desc *cmd = + &aq_desc.params.get_res_desc; + + buf_len =sizeof (resp_buf->elem) * num; + resp_buf =ice_malloc (hw, buf_len); +if (!resp_buf) +return -ENOMEM ; + +ice_fill_dflt_direct_cmd_desc (&aq_desc, + ice_aqc_opc_get_allocd_res_desc); + + cmd->ops.cmd.res =CPU_TO_LE16 (((res_type <<ICE_AQC_RES_TYPE_S ) & +ICE_AQC_RES_TYPE_M ) | (res_shared ? +ICE_AQC_RES_TYPE_FLAG_SHARED :0 )); + cmd->ops.cmd.first_desc =CPU_TO_LE16 (desc_id); + + ret =ice_aq_send_cmd (hw, &aq_desc, resp_buf, buf_len, cd); +if (!ret) + *num_prof =LE16_TO_CPU (cmd->ops.resp.num_desc); +else + goto exit; + +ice_memcpy (prof_buf, resp_buf->elem,sizeof (resp_buf->elem) * + (*num_prof),ICE_NONDMA_TO_NONDMA ); + +exit: +rte_free (resp_buf); +return ret; +} +static int +ice_cleanup_resource (struct ice_hw *hw,uint16_t res_type) +{ +int ret; +uint16_t prof_id; +uint16_t prof_buf[ICE_MAX_RES_DESC_NUM ]; +uint16_t first_desc =1 ; +uint16_t num_prof =0 ; + + ret =ice_get_hw_res (hw, res_type,ICE_MAX_RES_DESC_NUM , + first_desc, prof_buf, &num_prof); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to get fxp resource" ); +return ret; + } + +for (prof_id =0 ; prof_id < num_prof; prof_id++) { + ret =ice_free_hw_res (hw, res_type,1 , &prof_buf[prof_id]); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to free fxp resource" ); +return ret; + } + } +return 0 ; +} + +static int +ice_reset_fxp_resource (struct ice_hw *hw) +{ +int ret; + + ret =ice_cleanup_resource (hw,ICE_AQC_RES_TYPE_FD_PROF_BLDR_PROFID ); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to clearup fdir resource" ); +return ret; + } + + ret =ice_cleanup_resource (hw,ICE_AQC_RES_TYPE_HASH_PROF_BLDR_PROFID ); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to clearup rss resource" ); +return ret; + } + +return 0 ; +} +static int ice_dev_init (struct rte_eth_dev *dev) {
@@ -2019,6 +2107,12 @@ ice_dev_init(struct rte_eth_dev *dev)return ret; } + ret =ice_reset_fxp_resource (hw); +if (ret) { +PMD_INIT_LOG (ERR ,"Failed to reset fxp resource" ); +return ret; + } +return 0 ; err_pf_setup:
Signature · 1 line
2.15.1
Quoted 6 lines · Ying Wang
When app restart, RSS/FDIR profile ID will increase which may run out of all the profile resources.
The patch cleanup RSS/FDIR profile resources when device init to fix this issue.
Quoted 8 lines
Fixes d7d150b93070 ("net/ice: enable RSS when device init")Signed-off-by Ying Wang <[email protected]>---
---
v2: Modify patch according to comments.
Minor nit, please be more specific about your changes rather than the general words.
Quoted 4 lines
---
drivers/net/ice/ice_ethdev.c| 94 ++++++++++++++++++++++++++++++++++++++++++++1 file changed, 94 insertions(+)
Applied to dpdk-next-net-intel.
Thanks,
Xiaolong