[dpdk-dev] [PATCH v2 3/6] net/mvpp2: fix array initialization

Ferruh Yigit ferruh.yigit at intel.com
Fri Aug 24 18:46:42 CEST 2018


On 8/24/2018 3:54 PM, Tomasz Duszynski wrote:
> Fix used_bpools array initialization by using range initializer.
> This way all necessary variables are properly initialized regardless
> of PP2_NUM_PKT_PROC value.
> 
> Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Tomasz Duszynski <tdu at semihalf.com>
> ---
>  drivers/net/mvpp2/mrvl_ethdev.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
> index 7ea8946..60ca6e0 100644
> --- a/drivers/net/mvpp2/mrvl_ethdev.c
> +++ b/drivers/net/mvpp2/mrvl_ethdev.c
> @@ -84,8 +84,7 @@ static const char * const valid_args[] = {
>  static int used_hifs = MRVL_MUSDK_HIFS_RESERVED;
>  static struct pp2_hif *hifs[RTE_MAX_LCORE];
>  static int used_bpools[PP2_NUM_PKT_PROC] = {
> -	MRVL_MUSDK_BPOOLS_RESERVED,
> -	MRVL_MUSDK_BPOOLS_RESERVED
> +	[0 ... PP2_NUM_PKT_PROC - 1] = MRVL_MUSDK_BPOOLS_RESERVED

range initializer is not part of standard, although I am sure this won't be
first GCC extension we rely on, and I don't have any other option than memset
for this.

So just a reminder about extension usage, if you are happy with this
implementation, lets keep it.


More information about the dev mailing list