[dpdk-dev] [dpdk-stable] [PATCH v3 6/6] examples/tep_termination: rework the port setup logic

Ferruh Yigit ferruh.yigit at intel.com
Fri Apr 10 18:16:47 CEST 2020


On 4/2/2020 6:19 PM, Stephen Hemminger wrote:
> The handling of ports in this application had many problems.
> It was checking for things that can never happen with current
> DPDK library (like rte_ethdev_avail_count() >= RTE_MAX_ETHPORTS)
> and it was not checking if the port was owned and should
> not be used directly. Also the variable nb_ports was used
> as both local and global variable.
> 
> Fix by rewriting the initialization logic to iterate over
> valid ports and check if there are any leftovers.
> 
> Fixes: a50245ede72a ("examples/tep_term: initialize VXLAN sample")
> Cc: jijiang.liu at intel.com
> Cc: stable at dpdk.org
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  examples/tep_termination/Makefile    |  2 +
>  examples/tep_termination/main.c      | 70 ++++++++++------------------
>  examples/tep_termination/meson.build |  1 +
>  3 files changed, 28 insertions(+), 45 deletions(-)
> 
> diff --git a/examples/tep_termination/Makefile b/examples/tep_termination/Makefile
> index 645112498d33..f55331fb24c2 100644
> --- a/examples/tep_termination/Makefile
> +++ b/examples/tep_termination/Makefile
> @@ -26,6 +26,7 @@ CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)
>  LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
>  LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)
>  
> +CFLAGS += -DALLOW_EXPERIMENTAL_API
>  CFLAGS += -Wno-deprecated-declarations
>  
>  build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
> @@ -61,6 +62,7 @@ endif
>  CFLAGS += -O3
>  CFLAGS += $(WERROR_FLAGS)
>  CFLAGS += -Wno-deprecated-declarations
> +CFLAGS += -DALLOW_EXPERIMENTAL_API

Why 'ALLOW_EXPERIMENTAL_API' added in this patch, what is the experimental API
started to use?

<...>

>  
> -	for (portid = 0; portid < nb_ports; portid++) {
> -		if (!rte_eth_dev_is_valid_port(ports[portid])) {
> -			RTE_LOG(INFO, VHOST_PORT,
> -				"\nSpecified port ID(%u) is not valid\n",
> -				ports[portid]);
> -			ports[portid] = INVALID_PORT_ID;

'INVALID_PORT_ID' macro seems can be removed now.


More information about the dev mailing list