[dpdk-dev,1/3] lib/librte_ether: remove requirement of aligned RETA size

Message ID 20170316224056.19685-2-yskoh@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Yongseok Koh March 16, 2017, 10:40 p.m. UTC
  In rte_eth_check_reta_mask(), it is required to align the size of the RETA
table to RTE_RETA_GROUP_SIZE but as the size can be less than the limit,
this should be removed. The change is also applied to a command of testpmd.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 app/test-pmd/cmdline.c        | 4 +++-
 lib/librte_ether/rte_ethdev.c | 8 +-------
 2 files changed, 4 insertions(+), 8 deletions(-)
  

Comments

Yongseok Koh March 17, 2017, 5:19 p.m. UTC | #1
On Thu, Mar 16, 2017 at 03:40:54PM -0700, Yongseok Koh wrote:
> In rte_eth_check_reta_mask(), it is required to align the size of the RETA
> table to RTE_RETA_GROUP_SIZE but as the size can be less than the limit,
> this should be removed. The change is also applied to a command of testpmd.
> 
> Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
> ---
>  app/test-pmd/cmdline.c        | 4 +++-
>  lib/librte_ether/rte_ethdev.c | 8 +-------
>  2 files changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index 47f935d20..463a77e5a 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -2063,7 +2063,9 @@ showport_parse_reta_config(struct rte_eth_rss_reta_entry64 *conf,
>  	char s[256];
>  	char *end;
>  	char *str_fld[8];
> -	uint16_t i, num = nb_entries / RTE_RETA_GROUP_SIZE;
> +	uint16_t i;
> +	uint16_t num = (nb_entries + RTE_RETA_GROUP_SIZE - 1) /
> +			RTE_RETA_GROUP_SIZE;
>  	int ret;
>  
>  	p = strchr(p0, '(');
> diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
> index eb0a94a9a..806fff6ec 100644
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -1935,13 +1935,7 @@ rte_eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf,
>  	if (!reta_conf)
>  		return -EINVAL;
>  
> -	if (reta_size != RTE_ALIGN(reta_size, RTE_RETA_GROUP_SIZE)) {
> -		RTE_PMD_DEBUG_TRACE("Invalid reta size, should be %u aligned\n",
> -							RTE_RETA_GROUP_SIZE);
> -		return -EINVAL;
> -	}
> -
> -	num = reta_size / RTE_RETA_GROUP_SIZE;
> +	num = (reta_size + RTE_RETA_GROUP_SIZE - 1) / RTE_RETA_GROUP_SIZE;
>  	for (i = 0; i < num; i++) {
>  		if (reta_conf[i].mask)
>  			return 0;
> -- 
> 2.11.0
> 

I'm sorry, I forgot to include the maintainer of librte_ether, Thomas.

Thanks,
Yongseok
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 47f935d20..463a77e5a 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -2063,7 +2063,9 @@  showport_parse_reta_config(struct rte_eth_rss_reta_entry64 *conf,
 	char s[256];
 	char *end;
 	char *str_fld[8];
-	uint16_t i, num = nb_entries / RTE_RETA_GROUP_SIZE;
+	uint16_t i;
+	uint16_t num = (nb_entries + RTE_RETA_GROUP_SIZE - 1) /
+			RTE_RETA_GROUP_SIZE;
 	int ret;
 
 	p = strchr(p0, '(');
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index eb0a94a9a..806fff6ec 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -1935,13 +1935,7 @@  rte_eth_check_reta_mask(struct rte_eth_rss_reta_entry64 *reta_conf,
 	if (!reta_conf)
 		return -EINVAL;
 
-	if (reta_size != RTE_ALIGN(reta_size, RTE_RETA_GROUP_SIZE)) {
-		RTE_PMD_DEBUG_TRACE("Invalid reta size, should be %u aligned\n",
-							RTE_RETA_GROUP_SIZE);
-		return -EINVAL;
-	}
-
-	num = reta_size / RTE_RETA_GROUP_SIZE;
+	num = (reta_size + RTE_RETA_GROUP_SIZE - 1) / RTE_RETA_GROUP_SIZE;
 	for (i = 0; i < num; i++) {
 		if (reta_conf[i].mask)
 			return 0;