From patchwork Sat Jul 9 08:26:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 113877 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F1E07A00C5; Sat, 9 Jul 2022 10:29:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2883542825; Sat, 9 Jul 2022 10:28:53 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 9F9974280C for ; Sat, 9 Jul 2022 10:28:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1657355332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uMMeLypNVlrLVgFJLA3kw15vZwmLwFbhT3prj9nL1BY=; b=CZ6YsZsh4nCjprAPqztxiqb5YNYoYfvjg02bZXYXY1+jnDw24s6qJJAhB1giLB6ejmE2YG AYboiCCyuOzxMYffM+ufAGbAFpDdsWRYkV54ejdwHPPIRcBsxCDOC7fjjmij2IR1omzBod 2WB2tlksrj2VkX9vqSqJv4OpJopCk7k= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-467-uVYSEj6qOmu_9j6bV5Lb0g-1; Sat, 09 Jul 2022 04:28:47 -0400 X-MC-Unique: uVYSEj6qOmu_9j6bV5Lb0g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B075C801590; Sat, 9 Jul 2022 08:28:46 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.192.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id BFF232026985; Sat, 9 Jul 2022 08:28:45 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Rosen Xu , Ray Kinsella , Tianfei zhang Subject: [RFC v2 v2 21/29] bus/ifpga: cleanup exported symbols Date: Sat, 9 Jul 2022 10:26:36 +0200 Message-Id: <20220709082644.664675-22-david.marchand@redhat.com> In-Reply-To: <20220709082644.664675-1-david.marchand@redhat.com> References: <20220628144643.1213026-1-david.marchand@redhat.com> <20220709082644.664675-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Remove unused symbols (exposed only in an internal header which guarantees that no application out there relied on them). Remove rte_ prefix and inline the rest to avoid having to expose them as global symbols for a relatively small added value. Signed-off-by: David Marchand --- drivers/bus/ifpga/ifpga_bus.c | 13 +++-- drivers/bus/ifpga/ifpga_common.c | 87 -------------------------------- drivers/bus/ifpga/ifpga_common.h | 54 ++++++++++++++++---- drivers/bus/ifpga/meson.build | 2 +- drivers/bus/ifpga/version.map | 2 - drivers/raw/ifpga/ifpga_rawdev.c | 2 +- 6 files changed, 53 insertions(+), 107 deletions(-) delete mode 100644 drivers/bus/ifpga/ifpga_common.c diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index d962fb8362..988e336a1b 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -117,9 +117,9 @@ ifpga_scan_one(struct rte_rawdev *rawdev, if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) { if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT, - &rte_ifpga_get_integer32_arg, &afu_pr_conf.afu_id.port) < 0) { - IFPGA_BUS_ERR("error to parse %s", - IFPGA_ARG_PORT); + ifpga_get_integer32_arg, + &afu_pr_conf.afu_id.port) < 0) { + IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_PORT); goto end; } } else { @@ -130,9 +130,8 @@ ifpga_scan_one(struct rte_rawdev *rawdev, if (rte_kvargs_count(kvlist, IFPGA_AFU_BTS) == 1) { if (rte_kvargs_process(kvlist, IFPGA_AFU_BTS, - &rte_ifpga_get_string_arg, &path) < 0) { - IFPGA_BUS_ERR("Failed to parse %s", - IFPGA_AFU_BTS); + ifpga_get_string_arg, &path) < 0) { + IFPGA_BUS_ERR("Failed to parse %s", IFPGA_AFU_BTS); goto end; } afu_pr_conf.pr_enable = 1; @@ -228,7 +227,7 @@ ifpga_scan(void) if (rte_kvargs_count(kvlist, IFPGA_ARG_NAME) == 1) { if (rte_kvargs_process(kvlist, IFPGA_ARG_NAME, - &rte_ifpga_get_string_arg, &name) < 0) { + ifpga_get_string_arg, &name) < 0) { IFPGA_BUS_ERR("error to parse %s", IFPGA_ARG_NAME); goto end; diff --git a/drivers/bus/ifpga/ifpga_common.c b/drivers/bus/ifpga/ifpga_common.c deleted file mode 100644 index 223660d6ff..0000000000 --- a/drivers/bus/ifpga/ifpga_common.c +++ /dev/null @@ -1,87 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2018 Intel Corporation - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "rte_bus_ifpga.h" -#include "ifpga_logs.h" -#include "ifpga_common.h" - -int rte_ifpga_get_string_arg(const char *key __rte_unused, - const char *value, void *extra_args) -{ - if (!value || !extra_args) - return -EINVAL; - - *(char **)extra_args = strdup(value); - - if (!*(char **)extra_args) - return -ENOMEM; - - return 0; -} -int rte_ifpga_get_integer32_arg(const char *key __rte_unused, - const char *value, void *extra_args) -{ - if (!value || !extra_args) - return -EINVAL; - - *(int *)extra_args = strtoull(value, NULL, 0); - - return 0; -} -int ifpga_get_integer64_arg(const char *key __rte_unused, - const char *value, void *extra_args) -{ - if (!value || !extra_args) - return -EINVAL; - - *(uint64_t *)extra_args = strtoull(value, NULL, 0); - - return 0; -} -int ifpga_get_unsigned_long(const char *str, int base) -{ - unsigned long num; - char *end = NULL; - - errno = 0; - - num = strtoul(str, &end, base); - if ((str[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0)) - return -1; - - return num; -} - -int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0, - const struct rte_afu_id *afu_id1) -{ - if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) && - (afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) && - (afu_id0->port == afu_id1->port)) { - return 0; - } else - return 1; -} diff --git a/drivers/bus/ifpga/ifpga_common.h b/drivers/bus/ifpga/ifpga_common.h index f9254b9d5d..bb6524030f 100644 --- a/drivers/bus/ifpga/ifpga_common.h +++ b/drivers/bus/ifpga/ifpga_common.h @@ -5,14 +5,50 @@ #ifndef _IFPGA_COMMON_H_ #define _IFPGA_COMMON_H_ -int rte_ifpga_get_string_arg(const char *key __rte_unused, - const char *value, void *extra_args); -int rte_ifpga_get_integer32_arg(const char *key __rte_unused, - const char *value, void *extra_args); -int ifpga_get_integer64_arg(const char *key __rte_unused, - const char *value, void *extra_args); -int ifpga_get_unsigned_long(const char *str, int base); -int ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0, - const struct rte_afu_id *afu_id1); +#include +#include +#include + +#include +#include + +static inline int +ifpga_get_string_arg(const char *key __rte_unused, const char *value, + void *extra_args) +{ + if (!value || !extra_args) + return -EINVAL; + + *(char **)extra_args = strdup(value); + + if (!*(char **)extra_args) + return -ENOMEM; + + return 0; +} + +static inline int +ifpga_get_integer32_arg(const char *key __rte_unused, const char *value, + void *extra_args) +{ + if (!value || !extra_args) + return -EINVAL; + + *(int *)extra_args = strtoull(value, NULL, 0); + + return 0; +} + +static inline int +ifpga_afu_id_cmp(const struct rte_afu_id *afu_id0, + const struct rte_afu_id *afu_id1) +{ + if ((afu_id0->uuid.uuid_low == afu_id1->uuid.uuid_low) && + (afu_id0->uuid.uuid_high == afu_id1->uuid.uuid_high) && + (afu_id0->port == afu_id1->port)) { + return 0; + } else + return 1; +} #endif /* _IFPGA_COMMON_H_ */ diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build index cc5047e3ce..9d56a4bb2b 100644 --- a/drivers/bus/ifpga/meson.build +++ b/drivers/bus/ifpga/meson.build @@ -9,4 +9,4 @@ endif deps += ['pci', 'kvargs', 'rawdev'] headers = files('rte_bus_ifpga.h') -sources = files('ifpga_common.c', 'ifpga_bus.c') +sources = files('ifpga_bus.c') diff --git a/drivers/bus/ifpga/version.map b/drivers/bus/ifpga/version.map index 8ac3a4d258..c33537d39d 100644 --- a/drivers/bus/ifpga/version.map +++ b/drivers/bus/ifpga/version.map @@ -4,8 +4,6 @@ DPDK_22 { rte_ifpga_driver_register; rte_ifpga_driver_unregister; rte_ifpga_find_afu_by_name; - rte_ifpga_get_integer32_arg; - rte_ifpga_get_string_arg; local: *; }; diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index 78a7123528..93a7e74959 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -1752,7 +1752,7 @@ ifpga_vdev_parse_devargs(struct rte_devargs *devargs, if (rte_kvargs_count(kvlist, IFPGA_ARG_PORT) == 1) { if (rte_kvargs_process(kvlist, IFPGA_ARG_PORT, - &rte_ifpga_get_integer32_arg, &port) < 0) { + ifpga_get_integer32_arg, &port) < 0) { IFPGA_RAWDEV_PMD_ERR("error to parse %s", IFPGA_ARG_PORT); goto end;