From: Ian Stokes <ian.stokes@intel.com>
Allow PF RSS LUT to be sized 128.
Recent refactor simplified code and made it impossible.
Also clean up unused defines.
Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
drivers/net/ice/base/ice_adminq_cmd.h | 12 +++---------
drivers/net/ice/base/ice_common.c | 10 +++++++---
drivers/net/ice/ice_ethdev.c | 12 ++++++------
3 files changed, 16 insertions(+), 18 deletions(-)
On 6/12/24 17:00, Anatoly Burakov wrote:
> From: Ian Stokes <ian.stokes@intel.com>
>
> Allow PF RSS LUT to be sized 128.
>
> Recent refactor simplified code and made it impossible.
>
> Also clean up unused defines.
>
> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
> ---
> drivers/net/ice/base/ice_adminq_cmd.h | 12 +++---------
> drivers/net/ice/base/ice_common.c | 10 +++++++---
> drivers/net/ice/ice_ethdev.c | 12 ++++++------
> 3 files changed, 16 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h
> index 3549fc28f1..ab3dfd8685 100644
> --- a/drivers/net/ice/base/ice_adminq_cmd.h
> +++ b/drivers/net/ice/base/ice_adminq_cmd.h
> @@ -2230,11 +2230,13 @@ enum ice_lut_type {
> ICE_LUT_VSI = 0,
> ICE_LUT_PF = 1,
> ICE_LUT_GLOBAL = 2,
> - ICE_LUT_TYPE_MASK = 3
> + ICE_LUT_TYPE_MASK = 3,
> + ICE_LUT_PF_SMALL = 5, /* yields ICE_LUT_PF when &= ICE_LUT_TYPE_MASK */
> };
>
> enum ice_lut_size {
> ICE_LUT_VSI_SIZE = 64,
> + ICE_LUT_PF_SMALL_SIZE = 128,
This size is disallowed for both "upstream kernel ice" and "OOT ice",
I added it only for Windows, so please disallow it.
> ICE_LUT_GLOBAL_SIZE = 512,
> ICE_LUT_PF_SIZE = 2048,
> };
> @@ -2249,19 +2251,11 @@ struct ice_aqc_get_set_rss_lut {
> #define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M \
> (ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
>
> -#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI 0
> -#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF 1
> -#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL 2
> -
> #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S 2
> #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M \
> (ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
>
> -#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128 128
> -#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG 0
> -#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512 512
> #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG 1
> -#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K 2048
> #define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG 2
>
> #define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S 4
> diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
> index f88ced7a5d..34a4b74956 100644
> --- a/drivers/net/ice/base/ice_common.c
> +++ b/drivers/net/ice/base/ice_common.c
> @@ -4143,6 +4143,8 @@ static u16 ice_lut_type_to_size(u16 lut_type)
> return ICE_LUT_GLOBAL_SIZE;
> case ICE_LUT_PF:
> return ICE_LUT_PF_SIZE;
> + case ICE_LUT_PF_SMALL:
> + return ICE_LUT_PF_SMALL_SIZE;
removing this two lines would do what I want
(but then you have to replace the title, as 128 will be disallowed)
> default:
> return 0;
> }
> @@ -4174,6 +4176,8 @@ int ice_lut_size_to_type(int lut_size)
> return ICE_LUT_GLOBAL;
> case ICE_LUT_PF_SIZE:
> return ICE_LUT_PF;
> + case ICE_LUT_PF_SMALL_SIZE:
> + return ICE_LUT_PF_SMALL;
> default:
> return -1;
> }
> @@ -4201,10 +4205,10 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params
>
> vsi_handle = params->vsi_handle;
> lut = params->lut;
> - lut_type = params->lut_type;
> - lut_size = ice_lut_type_to_size(lut_type);
> + lut_size = ice_lut_type_to_size(params->lut_type);
> + lut_type = params->lut_type & ICE_LUT_TYPE_MASK;
> cmd_resp = &desc.params.get_set_rss_lut;
> - if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL)
> + if (lut_type == ICE_LUT_GLOBAL)
> glob_lut_idx = params->global_lut_id;
>
> if (!lut || !lut_size || !ice_is_vsi_valid(hw, vsi_handle))
> diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
> index 87385d2649..56adc3a3d9 100644
> --- a/drivers/net/ice/ice_ethdev.c
> +++ b/drivers/net/ice/ice_ethdev.c
> @@ -3468,7 +3468,7 @@ static int ice_init_rss(struct ice_pf *pf)
>
> lut_params.vsi_handle = vsi->idx;
> lut_params.lut_size = vsi->rss_lut_size;
> - lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
> + lut_params.lut_type = ICE_LUT_PF;
> lut_params.lut = vsi->rss_lut;
> lut_params.global_lut_id = 0;
> ret = ice_aq_set_rss_lut(hw, &lut_params);
> @@ -4928,7 +4928,7 @@ ice_get_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
> if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
> lut_params.vsi_handle = vsi->idx;
> lut_params.lut_size = lut_size;
> - lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
> + lut_params.lut_type = ICE_LUT_PF;
> lut_params.lut = lut;
> lut_params.global_lut_id = 0;
> ret = ice_aq_get_rss_lut(hw, &lut_params);
> @@ -4964,7 +4964,7 @@ ice_set_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
> if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
> lut_params.vsi_handle = vsi->idx;
> lut_params.lut_size = lut_size;
> - lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
> + lut_params.lut_type = ICE_LUT_PF;
> lut_params.lut = lut;
> lut_params.global_lut_id = 0;
> ret = ice_aq_set_rss_lut(hw, &lut_params);
> @@ -4996,9 +4996,9 @@ ice_rss_reta_update(struct rte_eth_dev *dev,
> uint8_t *lut;
> int ret;
>
> - if (reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128 &&
> - reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512 &&
> - reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K) {
> + if (reta_size != ICE_LUT_PF_SMALL_SIZE &&
perhaps this one too,
but only if you agree
> + reta_size != ICE_LUT_GLOBAL_SIZE &&
> + reta_size != ICE_LUT_PF_SIZE) {
> PMD_DRV_LOG(ERR,
> "The size of hash lookup table configured (%d)"
> "doesn't match the number hardware can "
@@ -2230,11 +2230,13 @@ enum ice_lut_type {
ICE_LUT_VSI = 0,
ICE_LUT_PF = 1,
ICE_LUT_GLOBAL = 2,
- ICE_LUT_TYPE_MASK = 3
+ ICE_LUT_TYPE_MASK = 3,
+ ICE_LUT_PF_SMALL = 5, /* yields ICE_LUT_PF when &= ICE_LUT_TYPE_MASK */
};
enum ice_lut_size {
ICE_LUT_VSI_SIZE = 64,
+ ICE_LUT_PF_SMALL_SIZE = 128,
ICE_LUT_GLOBAL_SIZE = 512,
ICE_LUT_PF_SIZE = 2048,
};
@@ -2249,19 +2251,11 @@ struct ice_aqc_get_set_rss_lut {
#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_M \
(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_S)
-#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_VSI 0
-#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF 1
-#define ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL 2
-
#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S 2
#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_M \
(ICE_LUT_TYPE_MASK << ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_S)
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128 128
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG 0
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512 512
#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512_FLAG 1
-#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K 2048
#define ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K_FLAG 2
#define ICE_AQC_GSET_RSS_LUT_GLOBAL_IDX_S 4
@@ -4143,6 +4143,8 @@ static u16 ice_lut_type_to_size(u16 lut_type)
return ICE_LUT_GLOBAL_SIZE;
case ICE_LUT_PF:
return ICE_LUT_PF_SIZE;
+ case ICE_LUT_PF_SMALL:
+ return ICE_LUT_PF_SMALL_SIZE;
default:
return 0;
}
@@ -4174,6 +4176,8 @@ int ice_lut_size_to_type(int lut_size)
return ICE_LUT_GLOBAL;
case ICE_LUT_PF_SIZE:
return ICE_LUT_PF;
+ case ICE_LUT_PF_SMALL_SIZE:
+ return ICE_LUT_PF_SMALL;
default:
return -1;
}
@@ -4201,10 +4205,10 @@ __ice_aq_get_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params
vsi_handle = params->vsi_handle;
lut = params->lut;
- lut_type = params->lut_type;
- lut_size = ice_lut_type_to_size(lut_type);
+ lut_size = ice_lut_type_to_size(params->lut_type);
+ lut_type = params->lut_type & ICE_LUT_TYPE_MASK;
cmd_resp = &desc.params.get_set_rss_lut;
- if (lut_type == ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_GLOBAL)
+ if (lut_type == ICE_LUT_GLOBAL)
glob_lut_idx = params->global_lut_id;
if (!lut || !lut_size || !ice_is_vsi_valid(hw, vsi_handle))
@@ -3468,7 +3468,7 @@ static int ice_init_rss(struct ice_pf *pf)
lut_params.vsi_handle = vsi->idx;
lut_params.lut_size = vsi->rss_lut_size;
- lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
+ lut_params.lut_type = ICE_LUT_PF;
lut_params.lut = vsi->rss_lut;
lut_params.global_lut_id = 0;
ret = ice_aq_set_rss_lut(hw, &lut_params);
@@ -4928,7 +4928,7 @@ ice_get_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
lut_params.vsi_handle = vsi->idx;
lut_params.lut_size = lut_size;
- lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
+ lut_params.lut_type = ICE_LUT_PF;
lut_params.lut = lut;
lut_params.global_lut_id = 0;
ret = ice_aq_get_rss_lut(hw, &lut_params);
@@ -4964,7 +4964,7 @@ ice_set_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t lut_size)
if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
lut_params.vsi_handle = vsi->idx;
lut_params.lut_size = lut_size;
- lut_params.lut_type = ICE_AQC_GSET_RSS_LUT_TABLE_TYPE_PF;
+ lut_params.lut_type = ICE_LUT_PF;
lut_params.lut = lut;
lut_params.global_lut_id = 0;
ret = ice_aq_set_rss_lut(hw, &lut_params);
@@ -4996,9 +4996,9 @@ ice_rss_reta_update(struct rte_eth_dev *dev,
uint8_t *lut;
int ret;
- if (reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128 &&
- reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_512 &&
- reta_size != ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_2K) {
+ if (reta_size != ICE_LUT_PF_SMALL_SIZE &&
+ reta_size != ICE_LUT_GLOBAL_SIZE &&
+ reta_size != ICE_LUT_PF_SIZE) {
PMD_DRV_LOG(ERR,
"The size of hash lookup table configured (%d)"
"doesn't match the number hardware can "