08/04/2021 12:14, Min Hu (Connor):
> From: Huisong Li <lihuis...@huawei.com>
> 
> Currently, ethtool directly ends the process after 'quit' cmd. In this
> case, software resources are not released and hardware resources of the
> device are not uninstalled.
> 
> This patch adds closing port operation to release resources.
> 
> Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample 
> application")
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Huisong Li <lihuis...@huawei.com>
> Signed-off-by: Min Hu (Connor) <humi...@huawei.com>
> ---
> --- a/examples/ethtool/ethtool-app/main.c
> +++ b/examples/ethtool/ethtool-app/main.c
> +static void close_ports(void)
> +{
> +     uint16_t portid;
> +     int ret;
> +
> +     for (portid = 0; portid < app_cfg.cnt_ports; portid++) {
> +             printf("Closing port %d...", portid);
> +             ret = rte_eth_dev_stop(portid);
> +             if (ret != 0)
> +                     rte_exit(EXIT_FAILURE, "rte_eth_dev_stop: err=%s, 
> port=%u\n",
> +                              strerror(-ret), portid);
> +             rte_eth_dev_close(portid);
> +             printf(" Done\n");
> +     }
> +
> +     ret = rte_eal_cleanup();
> +     if (ret != 0)
> +             rte_exit(EXIT_FAILURE, "EAL cleanup failed: %s\n",
> +                      strerror(-ret));

It would be better to add EAL cleanup in the main function.


Reply via email to