[PATCH v5 2/2] drivers/net: return number of types in get supported types

Ferruh Yigit ferruh.yigit at amd.com
Fri Jan 19 15:51:05 CET 2024


On 1/18/2024 12:07 PM, Sivaramakrishnan Venkat wrote:
> Missing "RTE_PTYPE_UNKNOWN" ptype causes buffer overflow.
> Enhance code such that the dev_supported_ptypes_get()
> function pointer now returns  the number of elements to
> eliminate the need for "RTE_PTYPE_UNKNOWN" as the last item.
> 
> Signed-off-by: Sivaramakrishnan Venkat <venkatx.sivaramakrishnan at intel.com>
> 
> --
>   v5:
>      - modified commit message.
>      - tidied formatting of code.
>      - added doxygen comment.
>   v4:
>      - split into two patches, one for backporting and another one for
>        upstream rework.
>   v3:
>      - reworked the function to return number of elements and remove the
>        need for RTE_PTYPE_UNKNOWN in list.
>   v2:
>      - extended fix for multiple drivers.
> ---

<...>

>  59 files changed, 188 insertions(+), 141 deletions(-)
> 

Some driver still have the flag:
- drivers/net/mvneta/mvneta_ethdev.c
- drivers/net/mvpp2/mrvl_ethdev.c
- pfe
- dpaa
- drivers/net/thunderx/nicvf_ethdev.c
- drivers/net/nfp/nfp_net_common.c

Above seems the ones updated in previous patch, flags added in previous
patch should be removed in this one.


And following seems missed and still has the flag:

- drivers/net/ngbe/ngbe_ptypes.c

<...>

> @@ -3971,9 +3975,6 @@ rte_eth_dev_set_ptypes(uint16_t port_id, uint32_t ptype_mask,
>  		}
>  	}
>  
> -	if (set_ptypes != NULL && j < num)
> -		set_ptypes[j] = RTE_PTYPE_UNKNOWN;
> -
> 

This change is new in this version and not mentioned in the changelog.

'rte_eth_dev_set_ptypes()' returns 'set_ptypes' that terminated with
'RTE_PTYPE_UNKNOWN', this is how that API works.
Why changing it in this patch?



More information about the dev mailing list