From patchwork Wed Oct 23 18:54:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61782 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AC2C21C2EF; Wed, 23 Oct 2019 20:54:49 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 9FA471C2B4 for ; Wed, 23 Oct 2019 20:54:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856887; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X4lgP4l7RmDxVSI61jHQZTAnXfhwGWuH7O4KR3MOg6I=; b=GcMn/bX4nAUP5uWnFqvdBIXZ5VOP63qyqoYBnwb/D8JD/e5Z37+qMsFxiX985woJJ+W6b2 1n9j7C9wAh5n76haF07ktyxNtadbvxxf6nybmfCXNRdYaHQRHkls2tS3A1kkN5B3oqaQWh NYYD9b6IGDL6Po9ILMDG4/Bh0DwPllM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-381-xdwOUvGdMWWJjjAZE0Z_nQ-1; Wed, 23 Oct 2019 14:54:43 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 88DF31800D6B; Wed, 23 Oct 2019 18:54:40 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4A85760872; Wed, 23 Oct 2019 18:54:35 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, Neil Horman , John McNamara , Marko Kovacevic , Harry van Haaren , Harini Ramakrishnan , Omar Cardona , Anand Rawat , Ranjit Menon Date: Wed, 23 Oct 2019 20:54:13 +0200 Message-Id: <1571856864-8779-2-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: xdwOUvGdMWWJjjAZE0Z_nQ-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 01/12] eal: make lcore config private 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" From: Stephen Hemminger The internal structure of lcore_config does not need to be part of visible API/ABI. Make it private to EAL. Rearrange the structure so it takes less memory (and cache footprint). Signed-off-by: Stephen Hemminger Signed-off-by: David Marchand --- Based on Stephen v8: http://patchwork.dpdk.org/patch/60443/ Changes since Stephen v8: - do not change core_id, socket_id and core_index types, --- doc/guides/rel_notes/deprecation.rst | 4 ---- doc/guides/rel_notes/release_19_11.rst | 2 ++ lib/librte_eal/common/eal_common_launch.c | 2 ++ lib/librte_eal/common/eal_private.h | 25 +++++++++++++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 24 ------------------------ lib/librte_eal/common/rte_service.c | 2 ++ lib/librte_eal/rte_eal_version.map | 1 - lib/librte_eal/windows/eal/eal_thread.c | 1 + 8 files changed, 32 insertions(+), 29 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 237813b..e4a33e0 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -23,10 +23,6 @@ Deprecation Notices * eal: The function ``rte_eal_remote_launch`` will return new error codes after read or write error on the pipe, instead of calling ``rte_panic``. -* eal: The ``lcore_config`` struct and global symbol will be made private to - remove it from the externally visible ABI and allow it to be updated in the - future. - * eal: both declaring and identifying devices will be streamlined in v18.11. New functions will appear to query a specific port from buses, classes of device and device drivers. Device declaration will be made coherent with the diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index 40121b9..d7e14b4 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -202,6 +202,8 @@ ABI Changes Also, make sure to start the actual text at the margin. ========================================================= +* eal: made the ``lcore_config`` struct and global symbol private. + Shared Library Versions ----------------------- diff --git a/lib/librte_eal/common/eal_common_launch.c b/lib/librte_eal/common/eal_common_launch.c index fe0ba3f..cf52d71 100644 --- a/lib/librte_eal/common/eal_common_launch.c +++ b/lib/librte_eal/common/eal_common_launch.c @@ -15,6 +15,8 @@ #include #include +#include "eal_private.h" + /* * Wait until a lcore finished its job. */ diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 798ede5..0e4b033 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -10,6 +10,31 @@ #include #include +#include + +/** + * Structure storing internal configuration (per-lcore) + */ +struct lcore_config { + pthread_t thread_id; /**< pthread identifier */ + int pipe_master2slave[2]; /**< communication pipe with master */ + int pipe_slave2master[2]; /**< communication pipe with master */ + + lcore_function_t * volatile f; /**< function to call */ + void * volatile arg; /**< argument of function */ + volatile int ret; /**< return value of function */ + + volatile enum rte_lcore_state_t state; /**< lcore state */ + unsigned int socket_id; /**< physical socket id for this lcore */ + unsigned int core_id; /**< core number on socket for this lcore */ + int core_index; /**< relative index, starting from 0 */ + uint8_t core_role; /**< role of core eg: OFF, RTE, SERVICE */ + uint8_t detected; /**< true if lcore was detected */ + + rte_cpuset_t cpuset; /**< cpu set which the lcore affinity to */ +}; + +extern struct lcore_config lcore_config[RTE_MAX_LCORE]; /** * Initialize the memzone subsystem (private to eal). diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index c86f72e..0c68391 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -66,30 +66,6 @@ typedef cpuset_t rte_cpuset_t; } while (0) #endif -/** - * Structure storing internal configuration (per-lcore) - */ -struct lcore_config { - unsigned detected; /**< true if lcore was detected */ - pthread_t thread_id; /**< pthread identifier */ - int pipe_master2slave[2]; /**< communication pipe with master */ - int pipe_slave2master[2]; /**< communication pipe with master */ - lcore_function_t * volatile f; /**< function to call */ - void * volatile arg; /**< argument of function */ - volatile int ret; /**< return value of function */ - volatile enum rte_lcore_state_t state; /**< lcore state */ - unsigned socket_id; /**< physical socket id for this lcore */ - unsigned core_id; /**< core number on socket for this lcore */ - int core_index; /**< relative index, starting from 0 */ - rte_cpuset_t cpuset; /**< cpu set which the lcore affinity to */ - uint8_t core_role; /**< role of core eg: OFF, RTE, SERVICE */ -}; - -/** - * Internal configuration (per-lcore) - */ -extern struct lcore_config lcore_config[RTE_MAX_LCORE]; - RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */ RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */ diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index beb9691..79235c0 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -21,6 +21,8 @@ #include #include +#include "eal_private.h" + #define RTE_SERVICE_NUM_MAX 64 #define SERVICE_F_REGISTERED (1 << 0) diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 7cbf82d..aeedf39 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -4,7 +4,6 @@ DPDK_2.0 { __rte_panic; eal_parse_sysfs_value; eal_timer_source; - lcore_config; per_lcore__lcore_id; per_lcore__rte_errno; rte_calloc; diff --git a/lib/librte_eal/windows/eal/eal_thread.c b/lib/librte_eal/windows/eal/eal_thread.c index 906502f..0591d4c 100644 --- a/lib/librte_eal/windows/eal/eal_thread.c +++ b/lib/librte_eal/windows/eal/eal_thread.c @@ -12,6 +12,7 @@ #include #include +#include "eal_private.h" RTE_DEFINE_PER_LCORE(unsigned int, _lcore_id) = LCORE_ID_ANY; From patchwork Wed Oct 23 18:54:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61783 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C32B11C440; Wed, 23 Oct 2019 20:54:52 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id C939D1C2B8 for ; Wed, 23 Oct 2019 20:54:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OcXTvxCMrU2lMTlcxeViUI6FyPWdXnUAJ5C6XYBnmXs=; b=hNdPGJkDA7WZdLBjFt6uAGBh6LZBC5kDeRBESJzKZnipvGLoSrxh5AYgDdOf4K4JLKi7dv tN9pidaYeFLlgyLrJhiv+bCNkkzkIOb5zNG9B38hV2APC/sPiP8gCro9x0TK0orBqJgoAu 89d9x0CfxQbQGwfGQYsemeG5y1VLJug= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-263-DBHPUN4YPeWyY70XDWJHQg-1; Wed, 23 Oct 2019 14:54:45 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B6C6780183E; Wed, 23 Oct 2019 18:54:43 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C48F60624; Wed, 23 Oct 2019 18:54:40 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, Neil Horman , John McNamara , Marko Kovacevic Date: Wed, 23 Oct 2019 20:54:14 +0200 Message-Id: <1571856864-8779-3-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: DBHPUN4YPeWyY70XDWJHQg-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 02/12] eal: remove deprecated CPU flags check function 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" Remove rte_cpu_check_supported as announced previously. Signed-off-by: David Marchand --- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/eal_common_cpuflags.c | 11 ----------- lib/librte_eal/common/include/generic/rte_cpuflags.h | 9 --------- lib/librte_eal/rte_eal_version.map | 1 - 5 files changed, 3 insertions(+), 24 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index e4a33e0..50ac348 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -34,9 +34,6 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` -* eal: The ``rte_cpu_check_supported`` function has been deprecated since - v17.08 and will be removed. - * eal: The ``rte_malloc_virt2phy`` function has been deprecated and replaced by ``rte_malloc_virt2iova`` since v17.11 and will be removed. diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index d7e14b4..8bf2437 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -204,6 +204,9 @@ ABI Changes * eal: made the ``lcore_config`` struct and global symbol private. +* eal: removed the ``rte_cpu_check_supported`` function, replaced by + ``rte_cpu_is_supported`` since dpdk v17.08. + Shared Library Versions ----------------------- diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c index 3a055f7..dc5f75d 100644 --- a/lib/librte_eal/common/eal_common_cpuflags.c +++ b/lib/librte_eal/common/eal_common_cpuflags.c @@ -7,17 +7,6 @@ #include #include -/** - * Checks if the machine is adequate for running the binary. If it is not, the - * program exits with status 1. - */ -void -rte_cpu_check_supported(void) -{ - if (!rte_cpu_is_supported()) - exit(1); -} - int rte_cpu_is_supported(void) { diff --git a/lib/librte_eal/common/include/generic/rte_cpuflags.h b/lib/librte_eal/common/include/generic/rte_cpuflags.h index 156ea00..872f0eb 100644 --- a/lib/librte_eal/common/include/generic/rte_cpuflags.h +++ b/lib/librte_eal/common/include/generic/rte_cpuflags.h @@ -49,15 +49,6 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature); /** * This function checks that the currently used CPU supports the CPU features * that were specified at compile time. It is called automatically within the - * EAL, so does not need to be used by applications. - */ -__rte_deprecated -void -rte_cpu_check_supported(void); - -/** - * This function checks that the currently used CPU supports the CPU features - * that were specified at compile time. It is called automatically within the * EAL, so does not need to be used by applications. This version returns a * result so that decisions may be made (for instance, graceful shutdowns). */ diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index aeedf39..0887549 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -8,7 +8,6 @@ DPDK_2.0 { per_lcore__rte_errno; rte_calloc; rte_calloc_socket; - rte_cpu_check_supported; rte_cpu_get_flag_enabled; rte_cycles_vmware_tsc_map; rte_delay_us; From patchwork Wed Oct 23 18:54:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61784 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F1CF31D155; Wed, 23 Oct 2019 20:54:54 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 755FC1C2AB for ; Wed, 23 Oct 2019 20:54:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856892; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=08jaI+abKuulYG1fFmJGKBkW3031x2wtXjcArb/ncig=; b=glkSD8zCrUZh3KdOJBSrDibdbhTsr9BwWwDeOaIKPFC/lMg4AXc9oiE5a+0Z8HdejeONMh jK9fNtQdk08Y4CAYghPAhsU1zeRuKa5L5dgA/8GZDQBNTFTUlL6Gf1G071CDV8pTVPz98N i3fOn06CachSURfkEpk3tKv8qSduLas= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-9-77uiUXB-N9GHH-FNB3PbLA-1; Wed, 23 Oct 2019 14:54:48 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F263A1800D6B; Wed, 23 Oct 2019 18:54:46 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C3F060872; Wed, 23 Oct 2019 18:54:44 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, Neil Horman , John McNamara , Marko Kovacevic Date: Wed, 23 Oct 2019 20:54:15 +0200 Message-Id: <1571856864-8779-4-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 77uiUXB-N9GHH-FNB3PbLA-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 03/12] eal: remove deprecated malloc virt2phys function 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" Remove rte_malloc_virt2phy as announced previously. Signed-off-by: David Marchand --- doc/guides/rel_notes/deprecation.rst | 3 --- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/include/rte_malloc.h | 7 ------- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 50ac348..bbd5863 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -34,9 +34,6 @@ Deprecation Notices + ``rte_eal_devargs_type_count`` -* eal: The ``rte_malloc_virt2phy`` function has been deprecated and replaced - by ``rte_malloc_virt2iova`` since v17.11 and will be removed. - * vfio: removal of ``rte_vfio_dma_map`` and ``rte_vfio_dma_unmap`` APIs which have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02. diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index 8bf2437..0c61c1c 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -207,6 +207,9 @@ ABI Changes * eal: removed the ``rte_cpu_check_supported`` function, replaced by ``rte_cpu_is_supported`` since dpdk v17.08. +* eal: removed the ``rte_malloc_virt2phy`` function, replaced by + ``rte_malloc_virt2iova`` since v17.11. + Shared Library Versions ----------------------- diff --git a/lib/librte_eal/common/include/rte_malloc.h b/lib/librte_eal/common/include/rte_malloc.h index 3593fb4..42ca051 100644 --- a/lib/librte_eal/common/include/rte_malloc.h +++ b/lib/librte_eal/common/include/rte_malloc.h @@ -553,13 +553,6 @@ rte_malloc_set_limit(const char *type, size_t max); rte_iova_t rte_malloc_virt2iova(const void *addr); -__rte_deprecated -static inline phys_addr_t -rte_malloc_virt2phy(const void *addr) -{ - return rte_malloc_virt2iova(addr); -} - #ifdef __cplusplus } #endif From patchwork Wed Oct 23 18:54:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61785 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0E3AF1D169; Wed, 23 Oct 2019 20:54:59 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 49D191D159 for ; Wed, 23 Oct 2019 20:54:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JSg1k/tcO77lLMrH+fyv7mFqEh4FJCZyomcSUaRz3Mc=; b=QMkjkig9jpmaPOBnyO62G8P8+pwv/P/+ScJ9ZXyCwV+xA7/mYortuogVUkChrLWyCM3wqm e5wFfYE/Z6kM+MdQR8tSOc6VRasTdrOmW2O1MYPDEkU5M6oyqj0USM+l7dYlm4vZkhI9Qm 8uTrWyoOa2iQ0+AomR1/3vV+TzdoWNA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-274-8eCVGmaDPLSmDGqeOKkmpA-1; Wed, 23 Oct 2019 14:54:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B0161800D49; Wed, 23 Oct 2019 18:54:49 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A29C60872; Wed, 23 Oct 2019 18:54:47 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Date: Wed, 23 Oct 2019 20:54:16 +0200 Message-Id: <1571856864-8779-5-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 8eCVGmaDPLSmDGqeOKkmpA-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 04/12] mem: hide internal heap header 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" Let's avoid exporting structures without an identified usecase. Signed-off-by: David Marchand --- app/test-pmd/testpmd.c | 1 - lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_memcfg.h | 3 ++- lib/librte_eal/common/include/rte_malloc_heap.h | 35 ------------------------- lib/librte_eal/common/malloc_heap.h | 25 +++++++++++++++++- lib/librte_eal/common/meson.build | 1 - 6 files changed, 27 insertions(+), 40 deletions(-) delete mode 100644 lib/librte_eal/common/include/rte_malloc_heap.h diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 5701f31..2e530b6 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index a00d4fc..fb291f5 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -10,7 +10,7 @@ INC += rte_log.h rte_memory.h rte_memzone.h INC += rte_per_lcore.h rte_random.h INC += rte_tailq.h rte_interrupts.h rte_alarm.h INC += rte_string_fns.h rte_version.h -INC += rte_eal_memconfig.h rte_malloc_heap.h +INC += rte_eal_memconfig.h INC += rte_hexdump.h rte_devargs.h rte_bus.h rte_dev.h rte_class.h INC += rte_option.h INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h diff --git a/lib/librte_eal/common/eal_memcfg.h b/lib/librte_eal/common/eal_memcfg.h index 0e468bb..4d65002 100644 --- a/lib/librte_eal/common/eal_memcfg.h +++ b/lib/librte_eal/common/eal_memcfg.h @@ -6,7 +6,6 @@ #define EAL_MEMCFG_H #include -#include #include #include #include @@ -14,6 +13,8 @@ #include #include +#include "malloc_heap.h" + /** * Memory configuration shared across multiple processes. */ diff --git a/lib/librte_eal/common/include/rte_malloc_heap.h b/lib/librte_eal/common/include/rte_malloc_heap.h deleted file mode 100644 index 4a7e0eb..0000000 --- a/lib/librte_eal/common/include/rte_malloc_heap.h +++ /dev/null @@ -1,35 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * Copyright(c) 2010-2014 Intel Corporation - */ - -#ifndef _RTE_MALLOC_HEAP_H_ -#define _RTE_MALLOC_HEAP_H_ - -#include -#include -#include -#include - -/* Number of free lists per heap, grouped by size. */ -#define RTE_HEAP_NUM_FREELISTS 13 -#define RTE_HEAP_NAME_MAX_LEN 32 - -/* dummy definition, for pointers */ -struct malloc_elem; - -/** - * Structure to hold malloc heap - */ -struct malloc_heap { - rte_spinlock_t lock; - LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; - struct malloc_elem *volatile first; - struct malloc_elem *volatile last; - - unsigned alloc_count; - unsigned int socket_id; - size_t total_size; - char name[RTE_HEAP_NAME_MAX_LEN]; -} __rte_cache_aligned; - -#endif /* _RTE_MALLOC_HEAP_H_ */ diff --git a/lib/librte_eal/common/malloc_heap.h b/lib/librte_eal/common/malloc_heap.h index ca9ff66..772736b 100644 --- a/lib/librte_eal/common/malloc_heap.h +++ b/lib/librte_eal/common/malloc_heap.h @@ -6,9 +6,32 @@ #define MALLOC_HEAP_H_ #include +#include #include -#include +#include + +/* Number of free lists per heap, grouped by size. */ +#define RTE_HEAP_NUM_FREELISTS 13 +#define RTE_HEAP_NAME_MAX_LEN 32 + +/* dummy definition, for pointers */ +struct malloc_elem; + +/** + * Structure to hold malloc heap + */ +struct malloc_heap { + rte_spinlock_t lock; + LIST_HEAD(, malloc_elem) free_head[RTE_HEAP_NUM_FREELISTS]; + struct malloc_elem *volatile first; + struct malloc_elem *volatile last; + + unsigned int alloc_count; + unsigned int socket_id; + size_t total_size; + char name[RTE_HEAP_NAME_MAX_LEN]; +} __rte_cache_aligned; #ifdef __cplusplus extern "C" { diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build index 386577c..d6a149b 100644 --- a/lib/librte_eal/common/meson.build +++ b/lib/librte_eal/common/meson.build @@ -72,7 +72,6 @@ common_headers = files( 'include/rte_lcore.h', 'include/rte_log.h', 'include/rte_malloc.h', - 'include/rte_malloc_heap.h', 'include/rte_memory.h', 'include/rte_memzone.h', 'include/rte_option.h', From patchwork Wed Oct 23 18:54:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61786 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 38B0F1D178; Wed, 23 Oct 2019 20:55:02 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id D37411D169 for ; Wed, 23 Oct 2019 20:54:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EHBgfjAEsRlF+kygwZFYBRi3036zytg1glqn90EWAss=; b=Op+EmV3RPzp1e2X7f376Uz284sosouNrKg7BL2ylAgn7XJpVai/w6RX0w6ck6R7GFsMlky uOMYchnd0VwXQddghrxNp5u2m3HIbTxYGkjCoSuGtb1dqtCO4euE2sBrehK3pZGerzHBe0 +pK0cKcuKRIwjIx1pSPduBaRt892ioE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-171-5SzPjHLcNuOJRr70I8b4Pg-1; Wed, 23 Oct 2019 14:54:54 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F341A5EC; Wed, 23 Oct 2019 18:54:52 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9740B60872; Wed, 23 Oct 2019 18:54:50 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, stable@dpdk.org, Chas Williams Date: Wed, 23 Oct 2019 20:54:17 +0200 Message-Id: <1571856864-8779-6-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 5SzPjHLcNuOJRr70I8b4Pg-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 05/12] net/bonding: use non deprecated PCI API 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" rte_eal_compare_pci_addr has been deprecated since v17.11. Convert to rte_pci_addr_cmp. Fixes: c848b518bbc7 ("net/bonding: support bifurcated driver in eal") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/bonding/rte_eth_bond_args.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_args.c b/drivers/net/bonding/rte_eth_bond_args.c index f298ea0..bfe03c3 100644 --- a/drivers/net/bonding/rte_eth_bond_args.c +++ b/drivers/net/bonding/rte_eth_bond_args.c @@ -60,11 +60,10 @@ find_port_id_by_dev_name(const char *name) static inline int bond_pci_addr_cmp(const struct rte_device *dev, const void *_pci_addr) { - struct rte_pci_device *pdev; + const struct rte_pci_device *pdev = RTE_DEV_TO_PCI_CONST(dev); const struct rte_pci_addr *paddr = _pci_addr; - pdev = RTE_DEV_TO_PCI(*(struct rte_device **)(void *)&dev); - return rte_eal_compare_pci_addr(&pdev->addr, paddr); + return rte_pci_addr_cmp(&pdev->addr, paddr); } /** From patchwork Wed Oct 23 18:54:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61787 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BC4BB1D37D; Wed, 23 Oct 2019 20:55:05 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 365A41D150 for ; Wed, 23 Oct 2019 20:55:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856903; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PghRp0V9RKCXMHPNuLq88fvmUXHYSO27NnwJJjTwd44=; b=cwYAs/IWNqVRBIldhTZzHoqSd1BLd5Um+Yml+Qb4i0tCSMHcScMe0ducABa8AcgrEkYEVN Nwe91GOssM625Fx36ejZxrKH3Xe4pPIhZxNvErvAK+jizppberK4odDTVBeqXVS+/qX4W7 of5/gNM5fRjL2z0/7VGI7vHy2avDwss= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-cqFmFIFgOMajEV-qR1B_3g-1; Wed, 23 Oct 2019 14:54:59 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E143380183E; Wed, 23 Oct 2019 18:54:57 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0072A60872; Wed, 23 Oct 2019 18:54:53 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, Neil Horman , John McNamara , Marko Kovacevic , Gaetan Rivet Date: Wed, 23 Oct 2019 20:54:18 +0200 Message-Id: <1571856864-8779-7-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: cqFmFIFgOMajEV-qR1B_3g-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 06/12] pci: remove deprecated functions 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" Those functions have been deprecated since 17.11 and have 1:1 replacement. Signed-off-by: David Marchand --- doc/guides/rel_notes/deprecation.rst | 7 ----- doc/guides/rel_notes/release_19_11.rst | 6 +++++ lib/librte_pci/rte_pci.c | 19 -------------- lib/librte_pci/rte_pci.h | 47 ---------------------------------- lib/librte_pci/rte_pci_version.map | 3 --- 5 files changed, 6 insertions(+), 76 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index bbd5863..cf7744e 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -38,13 +38,6 @@ Deprecation Notices have been replaced with ``rte_dev_dma_map`` and ``rte_dev_dma_unmap`` functions. The due date for the removal targets DPDK 20.02. -* pci: Several exposed functions are misnamed. - The following functions are deprecated starting from v17.11 and are replaced: - - - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` - - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` - - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` - * dpaa2: removal of ``rte_dpaa2_memsegs`` structure which has been replaced by a pa-va search library. This structure was earlier being used for holding memory segments used by dpaa2 driver for faster pa->va translation. This diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index 0c61c1c..579311d 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -210,6 +210,12 @@ ABI Changes * eal: removed the ``rte_malloc_virt2phy`` function, replaced by ``rte_malloc_virt2iova`` since v17.11. +* pci: removed the following deprecated functions since dpdk: + + - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` + - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` + - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` + Shared Library Versions ----------------------- diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c index f400178..a753cf3 100644 --- a/lib/librte_pci/rte_pci.c +++ b/lib/librte_pci/rte_pci.c @@ -87,18 +87,6 @@ pci_dbdf_parse(const char *input, struct rte_pci_addr *dev_addr) return 0; } -int -eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr) -{ - return pci_bdf_parse(input, dev_addr); -} - -int -eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr) -{ - return pci_dbdf_parse(input, dev_addr); -} - void rte_pci_device_name(const struct rte_pci_addr *addr, char *output, size_t size) @@ -110,13 +98,6 @@ rte_pci_device_name(const struct rte_pci_addr *addr, } int -rte_eal_compare_pci_addr(const struct rte_pci_addr *addr, - const struct rte_pci_addr *addr2) -{ - return rte_pci_addr_cmp(addr, addr2); -} - -int rte_pci_addr_cmp(const struct rte_pci_addr *addr, const struct rte_pci_addr *addr2) { diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h index eaa9d07..c878914 100644 --- a/lib/librte_pci/rte_pci.h +++ b/lib/librte_pci/rte_pci.h @@ -106,37 +106,6 @@ struct mapped_pci_resource { TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource); /** - * @deprecated - * Utility function to produce a PCI Bus-Device-Function value - * given a string representation. Assumes that the BDF is provided without - * a domain prefix (i.e. domain returned is always 0) - * - * @param input - * The input string to be parsed. Should have the format XX:XX.X - * @param dev_addr - * The PCI Bus-Device-Function address to be returned. - * Domain will always be returned as 0 - * @return - * 0 on success, negative on error. - */ -int eal_parse_pci_BDF(const char *input, struct rte_pci_addr *dev_addr); - -/** - * @deprecated - * Utility function to produce a PCI Bus-Device-Function value - * given a string representation. Assumes that the BDF is provided including - * a domain prefix. - * - * @param input - * The input string to be parsed. Should have the format XXXX:XX:XX.X - * @param dev_addr - * The PCI Bus-Device-Function address to be returned - * @return - * 0 on success, negative on error. - */ -int eal_parse_pci_DomBDF(const char *input, struct rte_pci_addr *dev_addr); - -/** * Utility function to write a pci device name, this device name can later be * used to retrieve the corresponding rte_pci_addr using eal_parse_pci_* * BDF helpers. @@ -152,22 +121,6 @@ void rte_pci_device_name(const struct rte_pci_addr *addr, char *output, size_t size); /** - * @deprecated - * Utility function to compare two PCI device addresses. - * - * @param addr - * The PCI Bus-Device-Function address to compare - * @param addr2 - * The PCI Bus-Device-Function address to compare - * @return - * 0 on equal PCI address. - * Positive on addr is greater than addr2. - * Negative on addr is less than addr2, or error. - */ -int rte_eal_compare_pci_addr(const struct rte_pci_addr *addr, - const struct rte_pci_addr *addr2); - -/** * Utility function to compare two PCI device addresses. * * @param addr diff --git a/lib/librte_pci/rte_pci_version.map b/lib/librte_pci/rte_pci_version.map index c028027..03790cb 100644 --- a/lib/librte_pci/rte_pci_version.map +++ b/lib/librte_pci/rte_pci_version.map @@ -1,11 +1,8 @@ DPDK_17.11 { global: - eal_parse_pci_BDF; - eal_parse_pci_DomBDF; pci_map_resource; pci_unmap_resource; - rte_eal_compare_pci_addr; rte_pci_addr_cmp; rte_pci_addr_parse; rte_pci_device_name; From patchwork Wed Oct 23 18:54:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61788 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 78F8C1D405; Wed, 23 Oct 2019 20:55:10 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by dpdk.org (Postfix) with ESMTP id 818601D3F0 for ; Wed, 23 Oct 2019 20:55:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856905; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fhuZ/dmzGU6ozq8EsbDDsl/au8BbdzwYW6rIvmt7+fw=; b=Wt7qrTawxHEUjnKJSr8L5zvXW8q6FBEHxlEG0y6QpZHabaUR7qzqYQjsyZVfNA2y4CYQvn DVq5u35P549XG8aKvJMl9xAHJewJ5Jib4WGy3NvVCfqtQexBEeVICPc/ArnjvkYmoqi6wH MiYiSs2Jex1lMQ6WXSysbP7KtJ3yJA4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-75-UhXUAmV0OJaaDLqG-MpeEA-1; Wed, 23 Oct 2019 14:55:01 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A84181800D6B; Wed, 23 Oct 2019 18:55:00 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6166960872; Wed, 23 Oct 2019 18:54:58 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, John Griffin , Fiona Trahe , Deepak Kumar Jain Date: Wed, 23 Oct 2019 20:54:19 +0200 Message-Id: <1571856864-8779-8-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: UhXUAmV0OJaaDLqG-MpeEA-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 07/12] log: add log stream accessor 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" Define an accessor so that users can write their debug message to the same stream than the rte_log infrastructure. Use it in the qat infrastructure. Signed-off-by: David Marchand --- Changelog since v1: - use ternary operator, --- drivers/common/qat/qat_logs.c | 3 +-- drivers/common/qat/qat_logs.h | 3 +-- lib/librte_eal/common/eal_common_log.c | 33 +++++++++++++++++++-------------- lib/librte_eal/common/include/rte_log.h | 13 +++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/drivers/common/qat/qat_logs.c b/drivers/common/qat/qat_logs.c index 7a86170..f97aba1 100644 --- a/drivers/common/qat/qat_logs.c +++ b/drivers/common/qat/qat_logs.c @@ -19,8 +19,7 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title, if (level > (uint32_t)(rte_log_get_level(logtype))) return 0; - rte_hexdump(rte_logs.file == NULL ? stderr : rte_logs.file, - title, buf, len); + rte_hexdump(rte_log_get_stream(), title, buf, len); return 0; } diff --git a/drivers/common/qat/qat_logs.h b/drivers/common/qat/qat_logs.h index 4baea12..2e4d394 100644 --- a/drivers/common/qat/qat_logs.h +++ b/drivers/common/qat/qat_logs.h @@ -24,8 +24,7 @@ extern int qat_dp_logtype; * * Dump out the message buffer in a special hex dump output format with * characters printed for each line of 16 hex values. The message will be sent - * to the stream defined by rte_logs.file or to stderr in case of rte_logs.file - * is undefined. + * to the stream used by the rte_log infrastructure. */ int qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title, diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index 4f6f227..e0a7bef 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -71,6 +71,24 @@ rte_openlog_stream(FILE *f) return 0; } +FILE * +rte_log_get_stream(void) +{ + FILE *f = rte_logs.file; + + if (f == NULL) { + /* + * Grab the current value of stderr here, rather than + * just initializing default_log_stream to stderr. This + * ensures that we will always use the current value + * of stderr, even if the application closes and + * reopens it. + */ + return default_log_stream ? : stderr; + } + return f; +} + /* Set global log level */ void rte_log_set_global_level(uint32_t level) @@ -396,21 +414,8 @@ rte_log_dump(FILE *f) int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) { + FILE *f = rte_log_get_stream(); int ret; - FILE *f = rte_logs.file; - if (f == NULL) { - f = default_log_stream; - if (f == NULL) { - /* - * Grab the current value of stderr here, rather than - * just initializing default_log_stream to stderr. This - * ensures that we will always use the current value - * of stderr, even if the application closes and - * reopens it. - */ - f = stderr; - } - } if (level > rte_logs.level) return 0; diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index cbb4184..1bb0e66 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -102,6 +102,19 @@ extern struct rte_logs rte_logs; int rte_openlog_stream(FILE *f); /** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Retrieve the stream used by the logging system (see rte_openlog_stream() + * to change it). + * + * @return + * Pointer to the stream. + */ +__rte_experimental +FILE *rte_log_get_stream(void); + +/** * Set the global log level. * * After this call, logs with a level lower or equal than the level diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 0887549..6d7e0e4 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -417,4 +417,7 @@ EXPERIMENTAL { rte_mcfg_timer_lock; rte_mcfg_timer_unlock; rte_rand_max; + + # added in 19.11 + rte_log_get_stream; }; From patchwork Wed Oct 23 18:54:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61789 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AD4CD1D411; Wed, 23 Oct 2019 20:55:13 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 922991D405 for ; Wed, 23 Oct 2019 20:55:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T+fOwr/RvH53WM/9d2a7lJJKEo1TirGRuegQIXbabXo=; b=byaN65TGo2owEXSyE8gLBJUQ4lFvv05xNlM5u8Dq0JR60ktzmTNM9gVVf0yme0H7qu9VZq iAeUNmJlW2FCGgORldUCzaCpaVPv+9by8tQPOEKa1x0P1CLOTCR2BuB8RnR7gglOi5UG8g 6LTGBThK0AU3smMHjX0srUqY6l84n2I= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-376-963h-PITPSKCp8dAdjiqHg-1; Wed, 23 Oct 2019 14:55:04 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A9C19107AD31; Wed, 23 Oct 2019 18:55:03 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42DC660872; Wed, 23 Oct 2019 18:55:00 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, John McNamara , Marko Kovacevic Date: Wed, 23 Oct 2019 20:54:20 +0200 Message-Id: <1571856864-8779-9-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: 963h-PITPSKCp8dAdjiqHg-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 08/12] log: hide internal log structure 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" No need to expose rte_logs, hide it and remove it from the current ABI. Signed-off-by: David Marchand Acked-by: Stephen Hemminger Acked-by: Kevin Traynor --- Changelog since v1: - updated release notes, --- doc/guides/rel_notes/release_19_11.rst | 2 ++ lib/librte_eal/common/eal_common_log.c | 23 ++++++++++++++++------- lib/librte_eal/common/include/rte_log.h | 20 +++----------------- lib/librte_eal/rte_eal_version.map | 1 - 4 files changed, 21 insertions(+), 25 deletions(-) diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index 579311d..082c570 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -210,6 +210,8 @@ ABI Changes * eal: removed the ``rte_malloc_virt2phy`` function, replaced by ``rte_malloc_virt2iova`` since v17.11. +* eal: made the ``rte_logs`` struct and global symbol private. + * pci: removed the following deprecated functions since dpdk: - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index e0a7bef..57d35a4 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -17,13 +17,6 @@ #include "eal_private.h" -/* global log structure */ -struct rte_logs rte_logs = { - .type = ~0, - .level = RTE_LOG_DEBUG, - .file = NULL, -}; - struct rte_eal_opt_loglevel { /** Next list entry */ TAILQ_ENTRY(rte_eal_opt_loglevel) next; @@ -58,6 +51,22 @@ struct rte_log_dynamic_type { uint32_t loglevel; }; +/** The rte_log structure. */ +struct rte_logs { + uint32_t type; /**< Bitfield with enabled logs. */ + uint32_t level; /**< Log level. */ + FILE *file; /**< Output file set by rte_openlog_stream, or NULL. */ + size_t dynamic_types_len; + struct rte_log_dynamic_type *dynamic_types; +}; + +/* global log structure */ +static struct rte_logs rte_logs = { + .type = ~0, + .level = RTE_LOG_DEBUG, + .file = NULL, +}; + /* per core log */ static RTE_DEFINE_PER_LCORE(struct log_cur_msg, log_cur_msg); diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h index 1bb0e66..a8d0eb7 100644 --- a/lib/librte_eal/common/include/rte_log.h +++ b/lib/librte_eal/common/include/rte_log.h @@ -26,20 +26,6 @@ extern "C" { #include #include -struct rte_log_dynamic_type; - -/** The rte_log structure. */ -struct rte_logs { - uint32_t type; /**< Bitfield with enabled logs. */ - uint32_t level; /**< Log level. */ - FILE *file; /**< Output file set by rte_openlog_stream, or NULL. */ - size_t dynamic_types_len; - struct rte_log_dynamic_type *dynamic_types; -}; - -/** Global log information */ -extern struct rte_logs rte_logs; - /* SDK log type */ #define RTE_LOGTYPE_EAL 0 /**< Log related to eal. */ #define RTE_LOGTYPE_MALLOC 1 /**< Log related to malloc. */ @@ -260,7 +246,7 @@ void rte_log_dump(FILE *f); * to rte_openlog_stream(). * * The level argument determines if the log should be displayed or - * not, depending on the global rte_logs variable. + * not, depending on the global log level and the per logtype level. * * The preferred alternative is the RTE_LOG() because it adds the * level and type in the logged string. @@ -291,8 +277,8 @@ int rte_log(uint32_t level, uint32_t logtype, const char *format, ...) * to rte_openlog_stream(). * * The level argument determines if the log should be displayed or - * not, depending on the global rte_logs variable. A trailing - * newline may be added if needed. + * not, depending on the global log level and the per logtype level. + * A trailing newline may be added if needed. * * The preferred alternative is the RTE_LOG() because it adds the * level and type in the logged string. diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 6d7e0e4..ca9ace0 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -45,7 +45,6 @@ DPDK_2.0 { rte_log; rte_log_cur_msg_loglevel; rte_log_cur_msg_logtype; - rte_logs; rte_malloc; rte_malloc_dump_stats; rte_malloc_get_socket_stats; From patchwork Wed Oct 23 18:54:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61790 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ABE631D415; Wed, 23 Oct 2019 20:55:16 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id CB3381D40C for ; Wed, 23 Oct 2019 20:55:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1wPcidAhtRIC13CYsfRReaLfwRDSJAbR5jTManN0dLk=; b=Im8zqGVNK5NwO1xI7zZbFa3UsFIKgdy3Ex9htynotVcEnrlEJ5jpe8SePT/To2X4dVJ2FP 8z7GH0DNDas6fvAUULYUHmwg0Hyb2c5hXZ0OK+S/Qy+9gvHWG35NCuKLYQ0VFYtGnzzNI2 etgPB2hnT2pSaX1mltNafCqBnyVSWN0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-262-rFCcsthOObimLXYK8zsIuQ-1; Wed, 23 Oct 2019 14:55:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9C6EA80183E; Wed, 23 Oct 2019 18:55:06 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id B917E60872; Wed, 23 Oct 2019 18:55:04 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net Date: Wed, 23 Oct 2019 20:54:21 +0200 Message-Id: <1571856864-8779-10-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: rFCcsthOObimLXYK8zsIuQ-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 09/12] test/mem: remove dependency on EAL internals 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" Rather than dereference the mem_config internal structure, we can rely on the rte_memzone_walk API and count memzones. Signed-off-by: David Marchand --- app/test/test_memzone.c | 50 ++++++++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c index 7edfd06..4d87444 100644 --- a/app/test/test_memzone.c +++ b/app/test/test_memzone.c @@ -13,12 +13,12 @@ #include #include #include +#include #include #include #include #include #include "../../lib/librte_eal/common/malloc_elem.h" -#include "../../lib/librte_eal/common/eal_memcfg.h" #include "test.h" @@ -927,6 +927,16 @@ test_memzone_free(void) return 0; } +static int test_memzones_left; +static int memzone_walk_cnt; +static void memzone_walk_clb(const struct rte_memzone *mz, + void *arg __rte_unused) +{ + memzone_walk_cnt++; + if (!strncmp(TEST_MEMZONE_NAME(""), mz->name, RTE_MEMZONE_NAMESIZE)) + test_memzones_left++; +} + static int test_memzone_basic(void) { @@ -936,8 +946,12 @@ test_memzone_basic(void) const struct rte_memzone *memzone4; const struct rte_memzone *mz; int memzone_cnt_after, memzone_cnt_expected; - int memzone_cnt_before = - rte_eal_get_configuration()->mem_config->memzones.count; + int memzone_cnt_before; + + memzone_walk_cnt = 0; + test_memzones_left = 0; + rte_memzone_walk(memzone_walk_clb, NULL); + memzone_cnt_before = memzone_walk_cnt; memzone1 = rte_memzone_reserve(TEST_MEMZONE_NAME("testzone1"), 100, SOCKET_ID_ANY, 0); @@ -960,8 +974,10 @@ test_memzone_basic(void) (memzone1 != NULL) + (memzone2 != NULL) + (memzone3 != NULL) + (memzone4 != NULL); - memzone_cnt_after = - rte_eal_get_configuration()->mem_config->memzones.count; + memzone_walk_cnt = 0; + test_memzones_left = 0; + rte_memzone_walk(memzone_walk_clb, NULL); + memzone_cnt_after = memzone_walk_cnt; if (memzone_cnt_after != memzone_cnt_expected) return -1; @@ -1039,30 +1055,26 @@ test_memzone_basic(void) return -1; } - memzone_cnt_after = - rte_eal_get_configuration()->mem_config->memzones.count; + memzone_walk_cnt = 0; + test_memzones_left = 0; + rte_memzone_walk(memzone_walk_clb, NULL); + memzone_cnt_after = memzone_walk_cnt; if (memzone_cnt_after != memzone_cnt_before) return -1; return 0; } -static int test_memzones_left; -static int memzone_walk_cnt; -static void memzone_walk_clb(const struct rte_memzone *mz, - void *arg __rte_unused) -{ - memzone_walk_cnt++; - if (!strncmp(TEST_MEMZONE_NAME(""), mz->name, RTE_MEMZONE_NAMESIZE)) - test_memzones_left++; -} - static int test_memzone(void) { /* take note of how many memzones were allocated before running */ - int memzone_cnt = - rte_eal_get_configuration()->mem_config->memzones.count; + int memzone_cnt; + + memzone_walk_cnt = 0; + test_memzones_left = 0; + rte_memzone_walk(memzone_walk_clb, NULL); + memzone_cnt = memzone_walk_cnt; printf("test basic memzone API\n"); if (test_memzone_basic() < 0) From patchwork Wed Oct 23 18:54:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61791 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9B25A1D410; Wed, 23 Oct 2019 20:55:20 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id D9CF41D415 for ; Wed, 23 Oct 2019 20:55:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DgRbD52LTAx3TtN6GaNzKi8yEI4r4Gf48b4yPJcUamM=; b=NaOqYwjjFtW9EXVP25VVvz4vJc/pTDjtkLJS/ZxNx+CkKjVr6IBzkTHLG98xd4VGj6haFV lONzrwiZTNPnIGQRGgKmpwd5e3zNSyTQipY+cM6kf/8p/ZrzCDWd/t+gZcV/gs8Wfv/iL1 6OqK/VB9HloP/l6ESCBLjIgcC8jFL2w= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-vKvIopoNOJWXr6Yh3IWdGw-1; Wed, 23 Oct 2019 14:55:10 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1BB8C1005500; Wed, 23 Oct 2019 18:55:09 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4CB8560872; Wed, 23 Oct 2019 18:55:07 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net Date: Wed, 23 Oct 2019 20:54:22 +0200 Message-Id: <1571856864-8779-11-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: vKvIopoNOJWXr6Yh3IWdGw-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 10/12] eal: deinline lcore APIs 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" Those functions are used to setup or take control decisions. Move them into the EAL common code and put them directly in the stable ABI. Signed-off-by: David Marchand --- lib/librte_eal/common/eal_common_lcore.c | 38 ++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 41 +++---------------------------- lib/librte_eal/rte_eal_version.map | 10 ++++++++ 3 files changed, 52 insertions(+), 37 deletions(-) diff --git a/lib/librte_eal/common/eal_common_lcore.c b/lib/librte_eal/common/eal_common_lcore.c index 38af260..abd2cf8 100644 --- a/lib/librte_eal/common/eal_common_lcore.c +++ b/lib/librte_eal/common/eal_common_lcore.c @@ -16,6 +16,16 @@ #include "eal_private.h" #include "eal_thread.h" +unsigned int rte_get_master_lcore(void) +{ + return rte_eal_get_configuration()->master_lcore; +} + +unsigned int rte_lcore_count(void) +{ + return rte_eal_get_configuration()->lcore_count; +} + int rte_lcore_index(int lcore_id) { if (unlikely(lcore_id >= RTE_MAX_LCORE)) @@ -43,6 +53,34 @@ rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id) return lcore_config[lcore_id].cpuset; } +int rte_lcore_is_enabled(unsigned int lcore_id) +{ + struct rte_config *cfg = rte_eal_get_configuration(); + + if (lcore_id >= RTE_MAX_LCORE) + return 0; + return cfg->lcore_role[lcore_id] == ROLE_RTE; +} + +unsigned int rte_get_next_lcore(unsigned int i, int skip_master, int wrap) +{ + i++; + if (wrap) + i %= RTE_MAX_LCORE; + + while (i < RTE_MAX_LCORE) { + if (!rte_lcore_is_enabled(i) || + (skip_master && (i == rte_get_master_lcore()))) { + i++; + if (wrap) + i %= RTE_MAX_LCORE; + continue; + } + break; + } + return i; +} + unsigned int rte_lcore_to_socket_id(unsigned int lcore_id) { diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index 0c68391..ea40c25 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -93,11 +93,7 @@ rte_lcore_id(void) * @return * the id of the master lcore */ -static inline unsigned -rte_get_master_lcore(void) -{ - return rte_eal_get_configuration()->master_lcore; -} +unsigned int rte_get_master_lcore(void); /** * Return the number of execution units (lcores) on the system. @@ -105,12 +101,7 @@ rte_get_master_lcore(void) * @return * the number of execution units (lcores) on the system. */ -static inline unsigned -rte_lcore_count(void) -{ - const struct rte_config *cfg = rte_eal_get_configuration(); - return cfg->lcore_count; -} +unsigned int rte_lcore_count(void); /** * Return the index of the lcore starting from zero. @@ -215,14 +206,7 @@ rte_lcore_cpuset(unsigned int lcore_id); * @return * True if the given lcore is enabled; false otherwise. */ -static inline int -rte_lcore_is_enabled(unsigned int lcore_id) -{ - struct rte_config *cfg = rte_eal_get_configuration(); - if (lcore_id >= RTE_MAX_LCORE) - return 0; - return cfg->lcore_role[lcore_id] == ROLE_RTE; -} +int rte_lcore_is_enabled(unsigned int lcore_id); /** * Get the next enabled lcore ID. @@ -237,25 +221,8 @@ rte_lcore_is_enabled(unsigned int lcore_id) * @return * The next lcore_id or RTE_MAX_LCORE if not found. */ -static inline unsigned int -rte_get_next_lcore(unsigned int i, int skip_master, int wrap) -{ - i++; - if (wrap) - i %= RTE_MAX_LCORE; +unsigned int rte_get_next_lcore(unsigned int i, int skip_master, int wrap); - while (i < RTE_MAX_LCORE) { - if (!rte_lcore_is_enabled(i) || - (skip_master && (i == rte_get_master_lcore()))) { - i++; - if (wrap) - i %= RTE_MAX_LCORE; - continue; - } - break; - } - return i; -} /** * Macro to browse all running lcores. */ diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index ca9ace0..e7422d4 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -309,6 +309,16 @@ DPDK_19.08 { } DPDK_19.05; +DPDK_19.11 { + global: + + rte_get_master_lcore; + rte_get_next_lcore; + rte_lcore_count; + rte_lcore_is_enabled; + +} DPDK_19.08; + EXPERIMENTAL { global: From patchwork Wed Oct 23 18:54:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61792 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D76F1D41B; Wed, 23 Oct 2019 20:55:23 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 0DFB81D157 for ; Wed, 23 Oct 2019 20:55:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856915; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X2zCgztgUH4K7qMe9i0XP2RvmUNyE4amqdicIfdGx8Q=; b=iqKpIYfpudRhBsR/NmvUieBE5aCoQAkebVDph3k2JoXejc6WsXby5hSfTeJ6WkCAG+t0S/ efgbMIUI1vQLJ3jpMsAgtdGCoNBd5O69RwxsL/BEPi+A+ZNaGqY49X+qFUfFraVq2mEirN 2Lf9qcRr+zb+LhaNJl7zYFtzG/dYRXU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-166-gkxpVkLAOUCqjHBAt5i8iA-1; Wed, 23 Oct 2019 14:55:13 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15D151005500; Wed, 23 Oct 2019 18:55:12 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9FB360872; Wed, 23 Oct 2019 18:55:09 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, Bruce Richardson Date: Wed, 23 Oct 2019 20:54:23 +0200 Message-Id: <1571856864-8779-12-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: gkxpVkLAOUCqjHBAt5i8iA-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 11/12] eal: factorize lcore role code in common code 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" This code belongs to the lcore API, move the prototype to the right header, then factorize the code into the common code. Signed-off-by: David Marchand --- lib/librte_eal/common/eal_common_lcore.c | 10 ++++++++++ lib/librte_eal/common/include/rte_eal.h | 11 ----------- lib/librte_eal/common/include/rte_lcore.h | 10 ++++++++++ lib/librte_eal/freebsd/eal/eal.c | 7 ------- lib/librte_eal/linux/eal/eal.c | 7 ------- 5 files changed, 20 insertions(+), 25 deletions(-) diff --git a/lib/librte_eal/common/eal_common_lcore.c b/lib/librte_eal/common/eal_common_lcore.c index abd2cf8..343d9b4 100644 --- a/lib/librte_eal/common/eal_common_lcore.c +++ b/lib/librte_eal/common/eal_common_lcore.c @@ -53,6 +53,16 @@ rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id) return lcore_config[lcore_id].cpuset; } +enum rte_lcore_role_t +rte_eal_lcore_role(unsigned int lcore_id) +{ + struct rte_config *cfg = rte_eal_get_configuration(); + + if (lcore_id >= RTE_MAX_LCORE) + return ROLE_OFF; + return cfg->lcore_role[lcore_id]; +} + int rte_lcore_is_enabled(unsigned int lcore_id) { struct rte_config *cfg = rte_eal_get_configuration(); diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index b7cf912..ea3c9df 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -84,17 +84,6 @@ struct rte_config { struct rte_config *rte_eal_get_configuration(void); /** - * Get a lcore's role. - * - * @param lcore_id - * The identifier of the lcore. - * @return - * The role of the lcore. - */ -enum rte_lcore_role_t rte_eal_lcore_role(unsigned lcore_id); - - -/** * Get the process type in a multi-process setup * * @return diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index ea40c25..555b692 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -70,6 +70,16 @@ RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); /**< Per thread "lcore id". */ RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */ /** + * Get a lcore's role. + * + * @param lcore_id + * The identifier of the lcore, which MUST be between 0 and RTE_MAX_LCORE-1. + * @return + * The role of the lcore. + */ +enum rte_lcore_role_t rte_eal_lcore_role(unsigned int lcore_id); + +/** * Return the Application thread ID of the execution unit. * * Note: in most cases the lcore id returned here will also correspond diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c index f86e9aa..40d8f57 100644 --- a/lib/librte_eal/freebsd/eal/eal.c +++ b/lib/librte_eal/freebsd/eal/eal.c @@ -943,13 +943,6 @@ rte_eal_cleanup(void) return 0; } -/* get core role */ -enum rte_lcore_role_t -rte_eal_lcore_role(unsigned lcore_id) -{ - return rte_config.lcore_role[lcore_id]; -} - enum rte_proc_type_t rte_eal_process_type(void) { diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c index f397206..5769489 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -1348,13 +1348,6 @@ rte_eal_cleanup(void) return 0; } -/* get core role */ -enum rte_lcore_role_t -rte_eal_lcore_role(unsigned lcore_id) -{ - return rte_config.lcore_role[lcore_id]; -} - enum rte_proc_type_t rte_eal_process_type(void) { From patchwork Wed Oct 23 18:54:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61793 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A597C1D449; Wed, 23 Oct 2019 20:55:25 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id C36DB1D175 for ; Wed, 23 Oct 2019 20:55:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571856919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=U5qRUXLnr7YKIqFD9daArkiOvIIlYjHdxZMzTWRLF5I=; b=X82AOnCc1dV3T5cIzfqMnqyNo9iDlSk63DerpsKv15LA4YiT3exGk0EEWtCuMEfSv1djq2 5sAsOg7e04T3eCFMpT1r4q4lK5+Lu8/R0BS4bKXqauxtLO/cEZDUZ5xsR8rYebe9qNuzTo C503HaOCq1DlqZPpIp8wXGRfgikZuTM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-68-Omo89_nkPlSOTChiraBllQ-1; Wed, 23 Oct 2019 14:55:16 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B096080183E; Wed, 23 Oct 2019 18:55:14 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-129.brq.redhat.com [10.40.204.129]) by smtp.corp.redhat.com (Postfix) with ESMTP id A11B860872; Wed, 23 Oct 2019 18:55:12 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net, John McNamara , Marko Kovacevic Date: Wed, 23 Oct 2019 20:54:24 +0200 Message-Id: <1571856864-8779-13-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571856864-8779-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> <1571856864-8779-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-MC-Unique: Omo89_nkPlSOTChiraBllQ-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH v2 12/12] eal: make the global configuration private 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" Now that all elements of the rte_config structure have (deinlined) accessors, we can hide it. Signed-off-by: David Marchand --- doc/guides/rel_notes/release_19_11.rst | 3 +++ lib/librte_eal/common/eal_common_mcfg.c | 1 + lib/librte_eal/common/eal_private.h | 32 ++++++++++++++++++++++++++++++++ lib/librte_eal/common/include/rte_eal.h | 32 -------------------------------- lib/librte_eal/common/malloc_heap.c | 1 + lib/librte_eal/common/rte_malloc.c | 1 + lib/librte_eal/rte_eal_version.map | 1 - 7 files changed, 38 insertions(+), 33 deletions(-) diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index 082c570..ae0f21e 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -212,6 +212,9 @@ ABI Changes * eal: made the ``rte_logs`` struct and global symbol private. +* eal: made the ``rte_config`` struct and ``rte_eal_get_configuration`` + function private. + * pci: removed the following deprecated functions since dpdk: - ``eal_parse_pci_BDF`` replaced by ``rte_pci_addr_parse`` diff --git a/lib/librte_eal/common/eal_common_mcfg.c b/lib/librte_eal/common/eal_common_mcfg.c index 0665494..0cf9a62 100644 --- a/lib/librte_eal/common/eal_common_mcfg.c +++ b/lib/librte_eal/common/eal_common_mcfg.c @@ -8,6 +8,7 @@ #include "eal_internal_cfg.h" #include "eal_memcfg.h" +#include "eal_private.h" void eal_mcfg_complete(void) diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 0e4b033..52eea9a 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -37,6 +37,38 @@ struct lcore_config { extern struct lcore_config lcore_config[RTE_MAX_LCORE]; /** + * The global RTE configuration structure. + */ +struct rte_config { + uint32_t master_lcore; /**< Id of the master lcore */ + uint32_t lcore_count; /**< Number of available logical cores. */ + uint32_t numa_node_count; /**< Number of detected NUMA nodes. */ + uint32_t numa_nodes[RTE_MAX_NUMA_NODES]; /**< List of detected NUMA nodes. */ + uint32_t service_lcore_count;/**< Number of available service cores. */ + enum rte_lcore_role_t lcore_role[RTE_MAX_LCORE]; /**< State of cores. */ + + /** Primary or secondary configuration */ + enum rte_proc_type_t process_type; + + /** PA or VA mapping mode */ + enum rte_iova_mode iova_mode; + + /** + * Pointer to memory configuration, which may be shared across multiple + * DPDK instances + */ + struct rte_mem_config *mem_config; +} __attribute__((__packed__)); + +/** + * Get the global configuration structure. + * + * @return + * A pointer to the global configuration structure. + */ +struct rte_config *rte_eal_get_configuration(void); + +/** * Initialize the memzone subsystem (private to eal). * * @return diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index ea3c9df..2f9ed29 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -52,38 +52,6 @@ enum rte_proc_type_t { }; /** - * The global RTE configuration structure. - */ -struct rte_config { - uint32_t master_lcore; /**< Id of the master lcore */ - uint32_t lcore_count; /**< Number of available logical cores. */ - uint32_t numa_node_count; /**< Number of detected NUMA nodes. */ - uint32_t numa_nodes[RTE_MAX_NUMA_NODES]; /**< List of detected NUMA nodes. */ - uint32_t service_lcore_count;/**< Number of available service cores. */ - enum rte_lcore_role_t lcore_role[RTE_MAX_LCORE]; /**< State of cores. */ - - /** Primary or secondary configuration */ - enum rte_proc_type_t process_type; - - /** PA or VA mapping mode */ - enum rte_iova_mode iova_mode; - - /** - * Pointer to memory configuration, which may be shared across multiple - * DPDK instances - */ - struct rte_mem_config *mem_config; -} __attribute__((__packed__)); - -/** - * Get the global configuration structure. - * - * @return - * A pointer to the global configuration structure. - */ -struct rte_config *rte_eal_get_configuration(void); - -/** * Get the process type in a multi-process setup * * @return diff --git a/lib/librte_eal/common/malloc_heap.c b/lib/librte_eal/common/malloc_heap.c index 634ca21..842eb9d 100644 --- a/lib/librte_eal/common/malloc_heap.c +++ b/lib/librte_eal/common/malloc_heap.c @@ -27,6 +27,7 @@ #include "eal_internal_cfg.h" #include "eal_memalloc.h" #include "eal_memcfg.h" +#include "eal_private.h" #include "malloc_elem.h" #include "malloc_heap.h" #include "malloc_mp.h" diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c index fecd9a9..044d3a9 100644 --- a/lib/librte_eal/common/rte_malloc.c +++ b/lib/librte_eal/common/rte_malloc.c @@ -26,6 +26,7 @@ #include "malloc_heap.h" #include "eal_memalloc.h" #include "eal_memcfg.h" +#include "eal_private.h" /* Free the memory space back to heap */ diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index e7422d4..009641f 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -17,7 +17,6 @@ DPDK_2.0 { rte_dump_tailq; rte_eal_alarm_cancel; rte_eal_alarm_set; - rte_eal_get_configuration; rte_eal_get_lcore_state; rte_eal_get_physmem_size; rte_eal_has_hugepages;