From patchwork Sat Jan 4 01:33:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 64208 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C6839A04DD; Sat, 4 Jan 2020 02:35:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 42DA21D55D; Sat, 4 Jan 2020 02:34:13 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id 07E8A1D548 for ; Sat, 4 Jan 2020 02:34:05 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id 6so24152328pgk.0 for ; Fri, 03 Jan 2020 17:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UzpwGaFD1a8sIn4IGdBsPyohrZzhEIRlfOR5b6UrJzc=; b=kLiqD0Q2kPVP1k2rK4hUARfyFt441Evfdcf98xoiljhIAaGR8YdCcKOuIa9KqsYalx JbkojIzJjoatJseZqdnjpbtfWpeWMSj69/yabHMdlf5JIjhAuQjUJm5T0dLNSakDo4D3 1Ro7qTdnoJrOh9sVO0SKvL3eMhFU3oEhTrn/NIy2Pq3vNefWa6Hb/W3a/u6O+k0p24mq nazGvPb59T/sfjBYO0pMZu/9ZWKbGX1jx5tON69iYRJyV5Xe8f0LtXiJQjnHhWETAskl cpUHBSh2rk+pqbDu0nb1T5c/dW8C8+FRaJ/+gUs9qJNN8ZgX3F41/4+c3+XxyVZBUefG EDaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UzpwGaFD1a8sIn4IGdBsPyohrZzhEIRlfOR5b6UrJzc=; b=j+nTudaSzy1yqKtPfyufcwxXwyS7Q8h1lPuMksYiQY/hb+T0jyp7EvmfiYDcIv4Wb7 Yb5Jwd68wQua1j87bf8YgN6jAkiq82LlBh2NnR2qeYi0JtgYNshwYoZyBF86yYViMsh7 eurOF6PeHX2w0TWIrs3/aIuoQ6zDDKrxpoGXkI4onnlz5w7QfQsXXgvMabE4mX4nB9FJ 7RBYicS0b4bN0LtAQXkb9H+hjiBdJ+G3a4CuBJvrNCcES10qdrKp/9XzaotCYc2FP5wS 78fjd7U1+/9yKyeHnhB/AJloXI6qUw41h7/rXISZslIu78hfzco1+jIzm/igrE59XGht NYMA== X-Gm-Message-State: APjAAAVqpaJPN8d0BBzfwgh9IJ+jIskGjDZRnnyaomAB+gY5W7kQx4s+ X6N7dvDAYCcVfz8oc0/SyO5bI/rivrk= X-Google-Smtp-Source: APXvYqyGad+0+RNeegqBrkD5NZULBKYd2To2faBJo2CE2ejxUJTxUfW82+B/u/Y1S0AwdolDOfFpeA== X-Received: by 2002:a63:6b07:: with SMTP id g7mr82309858pgc.243.1578101643852; Fri, 03 Jan 2020 17:34:03 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id j6sm16212934pjv.10.2020.01.03.17.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2020 17:34:03 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 Jan 2020 17:33:38 -0800 Message-Id: <20200104013341.19809-12-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200104013341.19809-1-stephen@networkplumber.org> References: <20200104013341.19809-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 11/14] eal: cleanup plugins data X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When rte_eal_cleanup is called walk through the list of shared objects loaded, and close them and free the data structure. Signed-off-by: Stephen Hemminger --- lib/librte_eal/common/eal_common_options.c | 12 ++++++++++++ lib/librte_eal/common/eal_options.h | 1 + lib/librte_eal/linux/eal/eal.c | 1 + 3 files changed, 14 insertions(+) diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index a7f9c5f9bdfa..58c364d896f8 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -308,6 +308,18 @@ eal_plugins_init(void) return 0; } +void +eal_plugins_cleanup(void) +{ + struct shared_driver *solib, *tmp; + + TAILQ_FOREACH_SAFE(solib, &solib_list, next, tmp) { + if (solib->lib_handle) + dlclose(solib->lib_handle); + free(solib); + } +} + /* * Parse the coremask given as argument (hexadecimal string) and fill * the global configuration (core role and core count) with the parsed diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index 9855429e5813..67d3ba0d4491 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -84,5 +84,6 @@ int eal_check_common_options(struct internal_config *internal_cfg); void eal_common_usage(void); enum rte_proc_type_t eal_proc_type_detect(void); int eal_plugins_init(void); +void eal_plugins_cleanup(void); #endif /* EAL_OPTIONS_H */ diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index e5c2a24322e9..9a00a3ed43ab 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1344,6 +1344,7 @@ rte_eal_cleanup(void) rte_eal_intr_cleanup(); rte_eal_alarm_cleanup(); rte_mp_channel_cleanup(); + eal_plugins_cleanup(); eal_cleanup_config(&internal_config); rte_eal_log_cleanup();