From patchwork Tue Oct 22 09:32:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61632 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 6B8311BEB3; Tue, 22 Oct 2019 11:33:09 +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 02CA61BEA7 for ; Tue, 22 Oct 2019 11:33:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571736787; 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=RWffS7+M1W/1tgVe+Jy/AM3l6WDtfg1MseqgM9sTVtfXnx1tA8Go+vg4wb8gG0ni1sLEpe SJ309Us0PJgWI+VJ3qH9/C1s8DtrQGTgaqGWqezUCvp0/sBgHGHaIZkZOL4GCXjhHkDy+n YluErT3CTHF23m0G7PfMN8+kJucdwjc= 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-161-EHPYyWBgOUy4xG1u1wt-Gg-1; Tue, 22 Oct 2019 05:33:05 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 766A05E4; Tue, 22 Oct 2019 09:33: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 A0649601AF; Tue, 22 Oct 2019 09:32:59 +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: Tue, 22 Oct 2019 11:32:34 +0200 Message-Id: <1571736761-32134-2-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: EHPYyWBgOUy4xG1u1wt-Gg-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH 1/8] 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 Tue Oct 22 09:32:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61633 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 38E5E1BEC1; Tue, 22 Oct 2019 11:33:13 +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 2171F1BEB8 for ; Tue, 22 Oct 2019 11:33:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571736789; 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=ZBfDQmYKb/AKEBb8AAxsyx+hKWWlfHToEAy1+sl6fpXDmXMJ/VK9Rf9T0SoX/Pwl9IS7/6 UzK2OnNlRZ1WtPIZvoYGk1sSsxSBiW/7ecy71fPJD0Q0lZeJ/TAXhzJxYhRpIxX71xnvrI qwOc12SqljUkHN+xKu5G/NDxnom6XAg= 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-371-iPfX5fH2NL-dtIkjb0QJqw-1; Tue, 22 Oct 2019 05:33:08 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1F6B800D53; Tue, 22 Oct 2019 09:33: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 0C1EE6012C; Tue, 22 Oct 2019 09:33:03 +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: Tue, 22 Oct 2019 11:32:35 +0200 Message-Id: <1571736761-32134-3-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: iPfX5fH2NL-dtIkjb0QJqw-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH 2/8] 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 Tue Oct 22 09:32:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61635 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 1E57F1BE82; Tue, 22 Oct 2019 11:34:05 +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 369562BF5 for ; Tue, 22 Oct 2019 11:34:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571736843; 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=RTfnPmpM2PK66EibyQcipxqw/6m7Olfumx6fiST9XDAOG9RdCy9gAEt2GWXvKwsl6+eWam tdTRtgGQGAVU/ib4n+rLcqd/Ktkn0nROP8yBWnVkyRNp86up5zmwVPDRdi7s3VlRwZdAY3 6gnCuC3nNJmlD+OKeJx7fph7MiRi0/U= 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-308-cxRxm1enPK2bzGObyuxOYQ-1; Tue, 22 Oct 2019 05:33:10 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4CE99100551D; Tue, 22 Oct 2019 09:33: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 5973F60161; Tue, 22 Oct 2019 09:33:07 +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: Tue, 22 Oct 2019 11:32:36 +0200 Message-Id: <1571736761-32134-4-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: cxRxm1enPK2bzGObyuxOYQ-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH 3/8] 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 Tue Oct 22 09:32:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61637 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 0FE6B1BE82; Tue, 22 Oct 2019 11:35:07 +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 B5E4A2BF5 for ; Tue, 22 Oct 2019 11:35:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571736905; 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=HxOPjtpYt4Xa87d1lkfdEcrMFIO+iSU42iH+oMUChArMicg8/4lsHhJpmJVj+W5muEYF7t h90ouzCB6vBCVj2JFxswM4hQlZDrS8mhGDheyhVumQ6cD6x3u+jCrisg1pFYANvLzX8j9G bx9ofihyvMdyhPwK/nkZwlQ6U+5xta8= 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-292-bGd6F3YAPwGLQpSg1ckUig-1; Tue, 22 Oct 2019 05:33:13 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B90301005509; Tue, 22 Oct 2019 09:33:11 +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 D42626012C; Tue, 22 Oct 2019 09:33:09 +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: Tue, 22 Oct 2019 11:32:37 +0200 Message-Id: <1571736761-32134-5-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: bGd6F3YAPwGLQpSg1ckUig-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH 4/8] 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 Tue Oct 22 09:32:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61639 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 E6BCC1BEC3; Tue, 22 Oct 2019 11:35:12 +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 DEB141BEBC for ; Tue, 22 Oct 2019 11:35:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571736911; 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=Gwu233i7LxJuxxmDIwTxhKCv3noMjlOQW4LfahrWhqtNkGqlw0OdvB6dNbV77k8QBtUcXw OAtmOk+DlwGK7P7D/Q5YH0RsUDME5gsME5yFIHTK+bLFNSNVtxE6ZUkjpjEydyR6ly9HbI UJhOwYPwyzWgVkAxIzzwE6j4rGW2kBM= 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-142-GhfBOlH_NGmrInhFZ7-qtA-1; Tue, 22 Oct 2019 05:33:15 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E6F58107AD3D; Tue, 22 Oct 2019 09:33:13 +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 45DE8601AF; Tue, 22 Oct 2019 09:33:12 +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: Tue, 22 Oct 2019 11:32:38 +0200 Message-Id: <1571736761-32134-6-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: GhfBOlH_NGmrInhFZ7-qtA-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH 5/8] 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 Tue Oct 22 09:32:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61636 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 758291BEB0; Tue, 22 Oct 2019 11:34:08 +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 438BE1BEB0 for ; Tue, 22 Oct 2019 11:34:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571736846; 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=VltE9r6oaRghC8hKl8AMLKNnTW9vAHCkrLQT4QdoFZkAFTpYhVVv/NgE/yTduVMlAEo9cM 5Q8BOXLv8444ixN6ErF1qd2yV1ruHbnVRpHe8FVNn/3UV5t9DX78bCuXpXUOng4djY+X5z tJY1CG9RJTft5SSPl1AvsDatLI/BcBs= 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-129-zUGtwLdNM9uCA_VKEpWmoA-1; Tue, 22 Oct 2019 05:33:17 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8536C1800E03; Tue, 22 Oct 2019 09:33:16 +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 7395A60BAC; Tue, 22 Oct 2019 09:33:14 +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: Tue, 22 Oct 2019 11:32:39 +0200 Message-Id: <1571736761-32134-7-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: zUGtwLdNM9uCA_VKEpWmoA-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH 6/8] 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 Tue Oct 22 09:32:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61638 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 781451BEB3; Tue, 22 Oct 2019 11:35:10 +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 517A61BE98 for ; Tue, 22 Oct 2019 11:35:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571736906; 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=QGKZ65n9H4ZrNi2ydvKcg6X6kT42ybe5q71WVqfkh4k=; b=HK2+HVF7qLxBhh7rwPAy6lWwUAgdOkjtTmPK30AJN32KKMlxPEZ8JNDXZV6iJR1ZLvBKH0 ZWZ9vbwudGneJrwTQhgOSNDwerMp9xSPxbreimipT64IyM6taaKg2aGautPaHDlO4M/9Xe U9wRH7MrSsoHmzGJOI1OgAcJZMn3QgU= 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-277-wpWlxGZ6Od222kebNAjN7A-1; Tue, 22 Oct 2019 05:33:20 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EBBB4800D53; Tue, 22 Oct 2019 09:33:18 +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 142CB6012D; Tue, 22 Oct 2019 09:33:16 +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: Tue, 22 Oct 2019 11:32:40 +0200 Message-Id: <1571736761-32134-8-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: wpWlxGZ6Od222kebNAjN7A-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH 7/8] 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 --- drivers/common/qat/qat_logs.c | 3 +-- drivers/common/qat/qat_logs.h | 3 +-- lib/librte_eal/common/eal_common_log.c | 36 ++++++++++++++++++++------------- lib/librte_eal/common/include/rte_log.h | 13 ++++++++++++ lib/librte_eal/rte_eal_version.map | 3 +++ 5 files changed, 40 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..cfe9599 100644 --- a/lib/librte_eal/common/eal_common_log.c +++ b/lib/librte_eal/common/eal_common_log.c @@ -71,6 +71,27 @@ rte_openlog_stream(FILE *f) return 0; } +FILE * +rte_log_get_stream(void) +{ + 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; + } + } + return f; +} + /* Set global log level */ void rte_log_set_global_level(uint32_t level) @@ -396,21 +417,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 Tue Oct 22 09:32:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 61634 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 25C2E1BEBD; Tue, 22 Oct 2019 11:33:26 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by dpdk.org (Postfix) with ESMTP id 475711BEB5 for ; Tue, 22 Oct 2019 11:33:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571736804; 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=n9sZBS755SLRdw+nHNwHB3X5DIoduPOYixFfElc5oms=; b=MEzXDfz+kkle5ClNWLT6zHRHc+rBvYW/9MyccIDKCpetE6KhH1BVeDeGmymo4VO4PB5wiO vSUvSgwqNnN6IsvZOyL/TNDO00ZKgkRq1mwiIEYupDLOrzWIGsHbtxPg2hi6swwH5w5erU sqsHUvjtZMr0831Z4iLf7UKHnOA1juM= 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-276-KMJ60vrgOweKD6qW18i93g-1; Tue, 22 Oct 2019 05:33:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C7E215F0; Tue, 22 Oct 2019 09:33:20 +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 839D86012D; Tue, 22 Oct 2019 09:33:19 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: stephen@networkplumber.org, anatoly.burakov@intel.com, thomas@monjalon.net Date: Tue, 22 Oct 2019 11:32:41 +0200 Message-Id: <1571736761-32134-9-git-send-email-david.marchand@redhat.com> In-Reply-To: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> References: <1571736761-32134-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: KMJ60vrgOweKD6qW18i93g-1 X-Mimecast-Spam-Score: 0 Subject: [dpdk-dev] [PATCH 8/8] 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 --- 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 - 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c index cfe9599..3a7ab88 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;