From patchwork Thu Nov 7 15:03:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62664 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 90397A034E; Thu, 7 Nov 2019 16:03:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1C9AD1BF33; Thu, 7 Nov 2019 16:03:27 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 35CE81BF22 for ; Thu, 7 Nov 2019 16:03:25 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7EskbC023769; Thu, 7 Nov 2019 07:03:24 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=4ZxUpSevNR6qAfZe7wiBS+ZCZ8cCSZIB3bTwq3EzPbE=; b=X1ceMS1/lCq3Wyw3O8XCF91GE3TGxhrPfgu023Uo6a2FkFVBePhXBaotTby1yL7zJxL5 r5boJlABdEJhGgWYImfSdV0V/9bYqMCw0ZKfPkQ5vK65Kqy5z8vaAnpGbcACdK59exwG StsT8Au8Zgr49VBSQtfYjeFHoPBUL//0C+UYsmzNa6h5PennVXTXMSaZksz36Co57DxH +Qw3L5+TGJQd+wmHk326Hy+Xz6Vda0dM+38hsQ0s1mrowu5Jq0PEvQ3KVY1tNpDO9gAA MkAOU3wprwrxCAPNdGm5xcHPI1VGD5ZsU3M8nKB2Fm32jem3yQctRC1tB4HZSu71HlW8 kQ== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvrd3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:24 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:23 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:23 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id 8CB803F7040; Thu, 7 Nov 2019 07:03:21 -0800 (PST) From: Andrzej Ostruszka To: , John McNamara , Marko Kovacevic , Neil Horman CC: , Date: Thu, 7 Nov 2019 16:03:07 +0100 Message-ID: <20191107150318.3677-2-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 01/12] doc: fix description of versioning macros 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 patch fixes documentation of versioning macros so that they are aligned with their implementation (no underscore is added by macros). Signed-off-by: Andrzej Ostruszka Fixes: f1ef9794f9bd ("doc: add ABI guidelines") Acked-by: Neil Horman --- doc/guides/contributing/versioning.rst | 4 ++-- lib/librte_eal/common/include/rte_function_versioning.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/guides/contributing/versioning.rst b/doc/guides/contributing/versioning.rst index 64984c54e..8a38928c0 100644 --- a/doc/guides/contributing/versioning.rst +++ b/doc/guides/contributing/versioning.rst @@ -215,11 +215,11 @@ library so that older binaries need not be immediately recompiled. The macros exported are: * ``VERSION_SYMBOL(b, e, n)``: Creates a symbol version table entry binding - versioned symbol ``b@DPDK_n`` to the internal function ``b_e``. + versioned symbol ``b@DPDK_n`` to the internal function ``be``. * ``BIND_DEFAULT_SYMBOL(b, e, n)``: Creates a symbol version entry instructing the linker to bind references to symbol ``b`` to the internal symbol - ``b_e``. + ``be``. * ``MAP_STATIC_SYMBOL(f, p)``: Declare the prototype ``f``, and map it to the fully qualified function ``p``, so that if a symbol becomes versioned, it diff --git a/lib/librte_eal/common/include/rte_function_versioning.h b/lib/librte_eal/common/include/rte_function_versioning.h index 55e88ffae..eae619d60 100644 --- a/lib/librte_eal/common/include/rte_function_versioning.h +++ b/lib/librte_eal/common/include/rte_function_versioning.h @@ -42,14 +42,14 @@ /* * VERSION_SYMBOL * Creates a symbol version table entry binding symbol @DPDK_ to the internal - * function name _ + * function name */ #define VERSION_SYMBOL(b, e, n) __asm__(".symver " RTE_STR(b) RTE_STR(e) ", " RTE_STR(b) "@DPDK_" RTE_STR(n)) /* * BIND_DEFAULT_SYMBOL * Creates a symbol version entry instructing the linker to bind references to - * symbol to the internal symbol _ + * symbol to the internal symbol */ #define BIND_DEFAULT_SYMBOL(b, e, n) __asm__(".symver " RTE_STR(b) RTE_STR(e) ", " RTE_STR(b) "@@DPDK_" RTE_STR(n)) #define __vsym __attribute__((used)) From patchwork Thu Nov 7 15:03:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62665 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 220E4A034E; Thu, 7 Nov 2019 16:03:41 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DDFF61BF4A; Thu, 7 Nov 2019 16:03:32 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 585F21BF49 for ; Thu, 7 Nov 2019 16:03:31 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7Etm9t028469; Thu, 7 Nov 2019 07:03:29 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=/w3g9aWy6//wLp7OKFU9YEFgB2VYjPJ6uGfL5WahvzA=; b=ZZr1vmbO63SuE1aaprUuBWlEXZkXU+Z7zHDTJrVusp/fl360j0PW0advs1jXEps8hwJa Cw6BhmKuToT4LM2DHfLkpnpIRKEPGMQlnbOaGE8/CN8RxaQsiXvCGbCIMEwFtNFRMssa lF/Vd/rTnAnml+tVTlGpA9OGUN6hhSCze0/CK3s6T8shd2dibFUI6bjXejBZ1CVkiko0 rdk3IoqLktyemSdr+d3n+AXqwtzoYQeyrQnFfN3Srw1K9vWqqhb6BQGPZpddNhzbOmC/ s7WBfDkrmwgZP9Ee0T8+xvcGKFrOy77OUEo5nOcL5ZYhALJqi0tVqxEs34+ivJD7kA0S +g== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2w4fq6sbvh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:28 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:27 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:27 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id BD2663F7043; Thu, 7 Nov 2019 07:03:23 -0800 (PST) From: Andrzej Ostruszka To: , John McNamara , Marko Kovacevic , David Hunt , Neil Horman , Bruce Richardson , Vladimir Medvedkin , Robert Sanford , Erik Gabriel Carrillo CC: , Date: Thu, 7 Nov 2019 16:03:08 +0100 Message-ID: <20191107150318.3677-3-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 02/12] build: annotate versioned symbols with __vsym macro 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" Every implementation of a particular version of given symbol needs to be marked in its declaration as such (using `__vsym` macro). This patch fixes this and also clarifies the documentation about that. Signed-off-by: Andrzej Ostruszka Acked-by: Neil Horman --- doc/guides/contributing/versioning.rst | 14 +++++++--- lib/librte_distributor/rte_distributor.c | 18 ++++++------ lib/librte_distributor/rte_distributor_v20.c | 18 ++++++------ .../common/include/rte_function_versioning.h | 7 +++++ lib/librte_lpm/rte_lpm.c | 28 +++++++++---------- lib/librte_lpm/rte_lpm6.c | 16 +++++------ lib/librte_timer/rte_timer.c | 20 ++++++------- 7 files changed, 67 insertions(+), 54 deletions(-) diff --git a/doc/guides/contributing/versioning.rst b/doc/guides/contributing/versioning.rst index 8a38928c0..fcd2d50f1 100644 --- a/doc/guides/contributing/versioning.rst +++ b/doc/guides/contributing/versioning.rst @@ -225,6 +225,10 @@ The macros exported are: fully qualified function ``p``, so that if a symbol becomes versioned, it can still be mapped back to the public symbol name. +* ``__vsym``: Annotation to be used in a declaration of the internal symbol + ``be`` to signal that it is being used as an implementation of a particular + version of symbol ``b``. + Examples of ABI Macro use ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -345,8 +349,9 @@ with the public symbol name .. code-block:: c - struct rte_acl_ctx * + -struct rte_acl_ctx * -rte_acl_create(const struct rte_acl_param *param) + +struct rte_acl_ctx * __vsym +rte_acl_create_v20(const struct rte_acl_param *param) { size_t sz; @@ -354,7 +359,8 @@ with the public symbol name ... Note that the base name of the symbol was kept intact, as this is conducive to -the macros used for versioning symbols. That is our next step, mapping this new +the macros used for versioning symbols and we have annotated the function as an +implementation of versioned symbol. That is our next step, mapping this new symbol name to the initial symbol name at version node 2.0. Immediately after the function, we add this line of code @@ -374,7 +380,7 @@ name, with a different suffix, and implement it appropriately .. code-block:: c - struct rte_acl_ctx * + struct rte_acl_ctx * __vsym rte_acl_create_v21(const struct rte_acl_param *param, int debug); { struct rte_acl_ctx *ctx = rte_acl_create_v20(param); @@ -423,7 +429,7 @@ defined, we add this .. code-block:: c - struct rte_acl_ctx * + struct rte_acl_ctx * __vsym rte_acl_create_v21(const struct rte_acl_param *param, int debug) { ... diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index 7df97df92..2cc32ddba 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -32,7 +32,7 @@ EAL_REGISTER_TAILQ(rte_dist_burst_tailq) /**** Burst Packet APIs called by workers ****/ -void +void __vsym rte_distributor_request_pkt_v1705(struct rte_distributor *d, unsigned int worker_id, struct rte_mbuf **oldpkt, unsigned int count) @@ -89,7 +89,7 @@ MAP_STATIC_SYMBOL(void rte_distributor_request_pkt(struct rte_distributor *d, unsigned int count), rte_distributor_request_pkt_v1705); -int +int __vsym rte_distributor_poll_pkt_v1705(struct rte_distributor *d, unsigned int worker_id, struct rte_mbuf **pkts) { @@ -134,7 +134,7 @@ MAP_STATIC_SYMBOL(int rte_distributor_poll_pkt(struct rte_distributor *d, unsigned int worker_id, struct rte_mbuf **pkts), rte_distributor_poll_pkt_v1705); -int +int __vsym rte_distributor_get_pkt_v1705(struct rte_distributor *d, unsigned int worker_id, struct rte_mbuf **pkts, struct rte_mbuf **oldpkt, unsigned int return_count) @@ -169,7 +169,7 @@ MAP_STATIC_SYMBOL(int rte_distributor_get_pkt(struct rte_distributor *d, struct rte_mbuf **oldpkt, unsigned int return_count), rte_distributor_get_pkt_v1705); -int +int __vsym rte_distributor_return_pkt_v1705(struct rte_distributor *d, unsigned int worker_id, struct rte_mbuf **oldpkt, int num) { @@ -359,7 +359,7 @@ release(struct rte_distributor *d, unsigned int wkr) /* process a set of packets to distribute them to workers */ -int +int __vsym rte_distributor_process_v1705(struct rte_distributor *d, struct rte_mbuf **mbufs, unsigned int num_mbufs) { @@ -506,7 +506,7 @@ MAP_STATIC_SYMBOL(int rte_distributor_process(struct rte_distributor *d, rte_distributor_process_v1705); /* return to the caller, packets returned from workers */ -int +int __vsym rte_distributor_returned_pkts_v1705(struct rte_distributor *d, struct rte_mbuf **mbufs, unsigned int max_mbufs) { @@ -556,7 +556,7 @@ total_outstanding(const struct rte_distributor *d) * Flush the distributor, so that there are no outstanding packets in flight or * queued up. */ -int +int __vsym rte_distributor_flush_v1705(struct rte_distributor *d) { unsigned int flushed; @@ -591,7 +591,7 @@ MAP_STATIC_SYMBOL(int rte_distributor_flush(struct rte_distributor *d), rte_distributor_flush_v1705); /* clears the internal returns array in the distributor */ -void +void __vsym rte_distributor_clear_returns_v1705(struct rte_distributor *d) { unsigned int wkr; @@ -613,7 +613,7 @@ MAP_STATIC_SYMBOL(void rte_distributor_clear_returns(struct rte_distributor *d), rte_distributor_clear_returns_v1705); /* creates a distributor instance */ -struct rte_distributor * +struct rte_distributor * __vsym rte_distributor_create_v1705(const char *name, unsigned int socket_id, unsigned int num_workers, diff --git a/lib/librte_distributor/rte_distributor_v20.c b/lib/librte_distributor/rte_distributor_v20.c index db6c49258..7a6fddf55 100644 --- a/lib/librte_distributor/rte_distributor_v20.c +++ b/lib/librte_distributor/rte_distributor_v20.c @@ -27,7 +27,7 @@ EAL_REGISTER_TAILQ(rte_distributor_tailq) /**** APIs called by workers ****/ -void +void __vsym rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d, unsigned worker_id, struct rte_mbuf *oldpkt) { @@ -43,7 +43,7 @@ rte_distributor_request_pkt_v20(struct rte_distributor_v20 *d, } VERSION_SYMBOL(rte_distributor_request_pkt, _v20, 2.0); -struct rte_mbuf * +struct rte_mbuf * __vsym rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d, unsigned worker_id) { @@ -59,7 +59,7 @@ rte_distributor_poll_pkt_v20(struct rte_distributor_v20 *d, } VERSION_SYMBOL(rte_distributor_poll_pkt, _v20, 2.0); -struct rte_mbuf * +struct rte_mbuf * __vsym rte_distributor_get_pkt_v20(struct rte_distributor_v20 *d, unsigned worker_id, struct rte_mbuf *oldpkt) { @@ -71,7 +71,7 @@ rte_distributor_get_pkt_v20(struct rte_distributor_v20 *d, } VERSION_SYMBOL(rte_distributor_get_pkt, _v20, 2.0); -int +int __vsym rte_distributor_return_pkt_v20(struct rte_distributor_v20 *d, unsigned worker_id, struct rte_mbuf *oldpkt) { @@ -204,7 +204,7 @@ process_returns(struct rte_distributor_v20 *d) } /* process a set of packets to distribute them to workers */ -int +int __vsym rte_distributor_process_v20(struct rte_distributor_v20 *d, struct rte_mbuf **mbufs, unsigned num_mbufs) { @@ -321,7 +321,7 @@ rte_distributor_process_v20(struct rte_distributor_v20 *d, VERSION_SYMBOL(rte_distributor_process, _v20, 2.0); /* return to the caller, packets returned from workers */ -int +int __vsym rte_distributor_returned_pkts_v20(struct rte_distributor_v20 *d, struct rte_mbuf **mbufs, unsigned max_mbufs) { @@ -359,7 +359,7 @@ total_outstanding(const struct rte_distributor_v20 *d) /* flush the distributor, so that there are no outstanding packets in flight or * queued up. */ -int +int __vsym rte_distributor_flush_v20(struct rte_distributor_v20 *d) { const unsigned flushed = total_outstanding(d); @@ -372,7 +372,7 @@ rte_distributor_flush_v20(struct rte_distributor_v20 *d) VERSION_SYMBOL(rte_distributor_flush, _v20, 2.0); /* clears the internal returns array in the distributor */ -void +void __vsym rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d) { d->returns.start = d->returns.count = 0; @@ -383,7 +383,7 @@ rte_distributor_clear_returns_v20(struct rte_distributor_v20 *d) VERSION_SYMBOL(rte_distributor_clear_returns, _v20, 2.0); /* creates a distributor instance */ -struct rte_distributor_v20 * +struct rte_distributor_v20 * __vsym rte_distributor_create_v20(const char *name, unsigned socket_id, unsigned num_workers) diff --git a/lib/librte_eal/common/include/rte_function_versioning.h b/lib/librte_eal/common/include/rte_function_versioning.h index eae619d60..c924351d5 100644 --- a/lib/librte_eal/common/include/rte_function_versioning.h +++ b/lib/librte_eal/common/include/rte_function_versioning.h @@ -52,6 +52,13 @@ * symbol to the internal symbol */ #define BIND_DEFAULT_SYMBOL(b, e, n) __asm__(".symver " RTE_STR(b) RTE_STR(e) ", " RTE_STR(b) "@@DPDK_" RTE_STR(n)) + +/* + * __vsym + * Annotation to be used in declaration of the internal symbol to signal + * that it is being used as an implementation of a particular version of symbol + * . + */ #define __vsym __attribute__((used)) /* diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index c96395e26..106916dc8 100644 --- a/lib/librte_lpm/rte_lpm.c +++ b/lib/librte_lpm/rte_lpm.c @@ -90,7 +90,7 @@ depth_to_range(uint8_t depth) /* * Find an existing lpm table and return a pointer to it. */ -struct rte_lpm_v20 * +struct rte_lpm_v20 * __vsym rte_lpm_find_existing_v20(const char *name) { struct rte_lpm_v20 *l = NULL; @@ -116,7 +116,7 @@ rte_lpm_find_existing_v20(const char *name) } VERSION_SYMBOL(rte_lpm_find_existing, _v20, 2.0); -struct rte_lpm * +struct rte_lpm * __vsym rte_lpm_find_existing_v1604(const char *name) { struct rte_lpm *l = NULL; @@ -147,7 +147,7 @@ MAP_STATIC_SYMBOL(struct rte_lpm *rte_lpm_find_existing(const char *name), /* * Allocates memory for LPM object */ -struct rte_lpm_v20 * +struct rte_lpm_v20 * __vsym rte_lpm_create_v20(const char *name, int socket_id, int max_rules, __rte_unused int flags) { @@ -220,7 +220,7 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules, } VERSION_SYMBOL(rte_lpm_create, _v20, 2.0); -struct rte_lpm * +struct rte_lpm * __vsym rte_lpm_create_v1604(const char *name, int socket_id, const struct rte_lpm_config *config) { @@ -329,7 +329,7 @@ MAP_STATIC_SYMBOL( /* * Deallocates memory for given LPM table. */ -void +void __vsym rte_lpm_free_v20(struct rte_lpm_v20 *lpm) { struct rte_lpm_list *lpm_list; @@ -358,7 +358,7 @@ rte_lpm_free_v20(struct rte_lpm_v20 *lpm) } VERSION_SYMBOL(rte_lpm_free, _v20, 2.0); -void +void __vsym rte_lpm_free_v1604(struct rte_lpm *lpm) { struct rte_lpm_list *lpm_list; @@ -1177,7 +1177,7 @@ add_depth_big_v1604(struct rte_lpm *lpm, uint32_t ip_masked, uint8_t depth, /* * Add a route */ -int +int __vsym rte_lpm_add_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth, uint8_t next_hop) { @@ -1218,7 +1218,7 @@ rte_lpm_add_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth, } VERSION_SYMBOL(rte_lpm_add, _v20, 2.0); -int +int __vsym rte_lpm_add_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint32_t next_hop) { @@ -1264,7 +1264,7 @@ MAP_STATIC_SYMBOL(int rte_lpm_add(struct rte_lpm *lpm, uint32_t ip, /* * Look for a rule in the high-level rules table */ -int +int __vsym rte_lpm_is_rule_present_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth, uint8_t *next_hop) { @@ -1291,7 +1291,7 @@ uint8_t *next_hop) } VERSION_SYMBOL(rte_lpm_is_rule_present, _v20, 2.0); -int +int __vsym rte_lpm_is_rule_present_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth, uint32_t *next_hop) { @@ -1844,7 +1844,7 @@ delete_depth_big_v1604(struct rte_lpm *lpm, uint32_t ip_masked, /* * Deletes a rule */ -int +int __vsym rte_lpm_delete_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth) { int32_t rule_to_delete_index, sub_rule_index; @@ -1898,7 +1898,7 @@ rte_lpm_delete_v20(struct rte_lpm_v20 *lpm, uint32_t ip, uint8_t depth) } VERSION_SYMBOL(rte_lpm_delete, _v20, 2.0); -int +int __vsym rte_lpm_delete_v1604(struct rte_lpm *lpm, uint32_t ip, uint8_t depth) { int32_t rule_to_delete_index, sub_rule_index; @@ -1957,7 +1957,7 @@ MAP_STATIC_SYMBOL(int rte_lpm_delete(struct rte_lpm *lpm, uint32_t ip, /* * Delete all rules from the LPM table. */ -void +void __vsym rte_lpm_delete_all_v20(struct rte_lpm_v20 *lpm) { /* Zero rule information. */ @@ -1974,7 +1974,7 @@ rte_lpm_delete_all_v20(struct rte_lpm_v20 *lpm) } VERSION_SYMBOL(rte_lpm_delete_all, _v20, 2.0); -void +void __vsym rte_lpm_delete_all_v1604(struct rte_lpm *lpm) { /* Zero rule information. */ diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index e20f82460..0d161dc32 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -812,7 +812,7 @@ add_step(struct rte_lpm6 *lpm, struct rte_lpm6_tbl_entry *tbl, /* * Add a route */ -int +int __vsym rte_lpm6_add_v20(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, uint8_t next_hop) { @@ -862,7 +862,7 @@ simulate_add(struct rte_lpm6 *lpm, const uint8_t *masked_ip, uint8_t depth) return 0; } -int +int __vsym rte_lpm6_add_v1705(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, uint32_t next_hop) { @@ -955,7 +955,7 @@ lookup_step(const struct rte_lpm6 *lpm, const struct rte_lpm6_tbl_entry *tbl, /* * Looks up an IP */ -int +int __vsym rte_lpm6_lookup_v20(const struct rte_lpm6 *lpm, uint8_t *ip, uint8_t *next_hop) { uint32_t next_hop32 = 0; @@ -973,7 +973,7 @@ rte_lpm6_lookup_v20(const struct rte_lpm6 *lpm, uint8_t *ip, uint8_t *next_hop) } VERSION_SYMBOL(rte_lpm6_lookup, _v20, 2.0); -int +int __vsym rte_lpm6_lookup_v1705(const struct rte_lpm6 *lpm, uint8_t *ip, uint32_t *next_hop) { @@ -1008,7 +1008,7 @@ MAP_STATIC_SYMBOL(int rte_lpm6_lookup(const struct rte_lpm6 *lpm, uint8_t *ip, /* * Looks up a group of IP addresses */ -int +int __vsym rte_lpm6_lookup_bulk_func_v20(const struct rte_lpm6 *lpm, uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], int16_t * next_hops, unsigned n) @@ -1049,7 +1049,7 @@ rte_lpm6_lookup_bulk_func_v20(const struct rte_lpm6 *lpm, } VERSION_SYMBOL(rte_lpm6_lookup_bulk_func, _v20, 2.0); -int +int __vsym rte_lpm6_lookup_bulk_func_v1705(const struct rte_lpm6 *lpm, uint8_t ips[][RTE_LPM6_IPV6_ADDR_SIZE], int32_t *next_hops, unsigned int n) @@ -1099,7 +1099,7 @@ MAP_STATIC_SYMBOL(int rte_lpm6_lookup_bulk_func(const struct rte_lpm6 *lpm, /* * Look for a rule in the high-level rules table */ -int +int __vsym rte_lpm6_is_rule_present_v20(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, uint8_t *next_hop) { @@ -1119,7 +1119,7 @@ rte_lpm6_is_rule_present_v20(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, } VERSION_SYMBOL(rte_lpm6_is_rule_present, _v20, 2.0); -int +int __vsym rte_lpm6_is_rule_present_v1705(struct rte_lpm6 *lpm, uint8_t *ip, uint8_t depth, uint32_t *next_hop) { diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c index 3834c9473..381a9f43f 100644 --- a/lib/librte_timer/rte_timer.c +++ b/lib/librte_timer/rte_timer.c @@ -131,7 +131,7 @@ rte_timer_data_dealloc(uint32_t id) return 0; } -void +void __vsym rte_timer_subsystem_init_v20(void) { unsigned lcore_id; @@ -153,7 +153,7 @@ VERSION_SYMBOL(rte_timer_subsystem_init, _v20, 2.0); * secondary processes should be empty, the zeroth entry can be shared by * multiple processes. */ -int +int __vsym rte_timer_subsystem_init_v1905(void) { const struct rte_memzone *mz; @@ -551,7 +551,7 @@ __rte_timer_reset(struct rte_timer *tim, uint64_t expire, } /* Reset and start the timer associated with the timer handle tim */ -int +int __vsym rte_timer_reset_v20(struct rte_timer *tim, uint64_t ticks, enum rte_timer_type type, unsigned int tim_lcore, rte_timer_cb_t fct, void *arg) @@ -574,7 +574,7 @@ rte_timer_reset_v20(struct rte_timer *tim, uint64_t ticks, } VERSION_SYMBOL(rte_timer_reset, _v20, 2.0); -int +int __vsym rte_timer_reset_v1905(struct rte_timer *tim, uint64_t ticks, enum rte_timer_type type, unsigned int tim_lcore, rte_timer_cb_t fct, void *arg) @@ -657,14 +657,14 @@ __rte_timer_stop(struct rte_timer *tim, int local_is_locked, } /* Stop the timer associated with the timer handle tim */ -int +int __vsym rte_timer_stop_v20(struct rte_timer *tim) { return __rte_timer_stop(tim, 0, &default_timer_data); } VERSION_SYMBOL(rte_timer_stop, _v20, 2.0); -int +int __vsym rte_timer_stop_v1905(struct rte_timer *tim) { return rte_timer_alt_stop(default_data_id, tim); @@ -817,14 +817,14 @@ __rte_timer_manage(struct rte_timer_data *timer_data) priv_timer[lcore_id].running_tim = NULL; } -void +void __vsym rte_timer_manage_v20(void) { __rte_timer_manage(&default_timer_data); } VERSION_SYMBOL(rte_timer_manage, _v20, 2.0); -int +int __vsym rte_timer_manage_v1905(void) { struct rte_timer_data *timer_data; @@ -1074,14 +1074,14 @@ __rte_timer_dump_stats(struct rte_timer_data *timer_data __rte_unused, FILE *f) #endif } -void +void __vsym rte_timer_dump_stats_v20(FILE *f) { __rte_timer_dump_stats(&default_timer_data, f); } VERSION_SYMBOL(rte_timer_dump_stats, _v20, 2.0); -int +int __vsym rte_timer_dump_stats_v1905(FILE *f) { return rte_timer_alt_dump_stats(default_data_id, f); From patchwork Thu Nov 7 15:03:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62666 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id F3289A034E; Thu, 7 Nov 2019 16:03:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 49E811BF52; Thu, 7 Nov 2019 16:03:34 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 7F3D31BF4A for ; Thu, 7 Nov 2019 16:03:31 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7EskbE023769; Thu, 7 Nov 2019 07:03:30 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=pFJrhBHsqWbpdefVdj3HhunWGxclN2jUR7Ik4T0j3bU=; b=yZM96aM2tVIQta9AkRi+6p8iIhcWPGfmJ4MgmMgccHmVy8QVjsPzy1sVZQlDR8++ku8X Lvy3snclWXt+CwYVYhP+HFJ90uDktj2ut0U79NrAQn6MWnMFuSqR4kI+ns1sQ1dk8pbV ejNLA0/0vWahX4vwbZt4smhMQH61dbgJklOI5ol2mOL4xkVYyvydw4NTAYqXaH29yfes uz0MlfeWYeLCMAYEfzxjpnIzMTgQ2VaKeCZ5a1TB/3zRVc8GaZpOyw9x8yMAXAyA2ZnK AdFRd6Tw/3qlNySv76IJvfizsWMzOPzuE3Ii9DshrAJjmCvwYJ9mxTRB+pMkooPkscqF iQ== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvrdk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:30 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:29 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:29 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id 398FE3F703F; Thu, 7 Nov 2019 07:03:27 -0800 (PST) From: Andrzej Ostruszka To: , Aaron Conole , Michael Santana , Thomas Monjalon , John McNamara , Marko Kovacevic CC: , Date: Thu, 7 Nov 2019 16:03:09 +0100 Message-ID: <20191107150318.3677-4-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 03/12] build: add an option to enable LTO build 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 patch adds an option to enable link time optimization. In addition to LTO option itself (-flto) fat-lto-objects are being used. This is because during the build pmdinfogen scans the generated ELF objects to find this_pmd_name* symbol in symbol table. Without fat-lto-objects gcc produces ELF only with extra symbols for internal use during linking. Signed-off-by: Andrzej Ostruszka Acked-by: Bruce Richardson --- .travis.yml | 9 ++++++ config/common_base | 5 +++ config/meson.build | 13 ++++++++ doc/guides/prog_guide/index.rst | 1 + doc/guides/prog_guide/lto.rst | 40 ++++++++++++++++++++++++ doc/guides/rel_notes/release_19_11.rst | 9 ++++++ mk/toolchain/gcc/rte.toolchain-compat.mk | 4 +++ mk/toolchain/gcc/rte.vars.mk | 12 +++++++ mk/toolchain/icc/rte.vars.mk | 8 +++++ 9 files changed, 101 insertions(+) create mode 100644 doc/guides/prog_guide/lto.rst diff --git a/.travis.yml b/.travis.yml index 3d6ef2959..a1c31d407 100644 --- a/.travis.yml +++ b/.travis.yml @@ -105,6 +105,15 @@ matrix: apt: packages: - *extra_packages + - env: DEF_LIB="static" OPTS="-Db_lto=true" EXTRA_PACKAGES=1 CC=gcc-7 + compiler: gcc + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - *extra_packages + - gcc-7 script: ./.ci/${TRAVIS_OS_NAME}-build.sh diff --git a/config/common_base b/config/common_base index b2be3d96a..0d1207166 100644 --- a/config/common_base +++ b/config/common_base @@ -49,6 +49,11 @@ CONFIG_RTE_FORCE_INTRINSICS=n # CONFIG_RTE_ARCH_STRICT_ALIGN=n +# +# Enable link time optimization +# +CONFIG_RTE_ENABLE_LTO=n + # # Compile to share library # diff --git a/config/meson.build b/config/meson.build index e1ebdad26..2b1cb92e7 100644 --- a/config/meson.build +++ b/config/meson.build @@ -225,3 +225,16 @@ add_project_arguments('-D_GNU_SOURCE', language: 'c') if is_freebsd add_project_arguments('-D__BSD_VISIBLE', language: 'c') endif + +if get_option('b_lto') + if cc.has_argument('-ffat-lto-objects') + add_project_arguments('-ffat-lto-objects', language: 'c') + else + error('compiler does not support fat LTO objects - please turn LTO off') + endif + # workaround for gcc bug 81440 + if cc.get_id() == 'gcc' and cc.version().version_compare('<8.0') + add_project_arguments('-Wno-lto-type-mismatch', language: 'c') + add_project_link_arguments('-Wno-lto-type-mismatch', language: 'c') + endif +endif diff --git a/doc/guides/prog_guide/index.rst b/doc/guides/prog_guide/index.rst index 692409af8..dc4851c57 100644 --- a/doc/guides/prog_guide/index.rst +++ b/doc/guides/prog_guide/index.rst @@ -65,5 +65,6 @@ Programmer's Guide ext_app_lib_make_help perf_opt_guidelines writing_efficient_code + lto profile_app glossary diff --git a/doc/guides/prog_guide/lto.rst b/doc/guides/prog_guide/lto.rst new file mode 100644 index 000000000..50aecc9e5 --- /dev/null +++ b/doc/guides/prog_guide/lto.rst @@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2019 Marvell International Ltd. + +Link Time Optimization +====================== + +The DPDK supports compilation with link time optimization turned on. +This depends obviously on the ability of the compiler to do "whole +program" optimization at link time and is available only for compilers +that support that feature. +To be more specific, compiler (in addition to performing LTO) have to +support creation of ELF objects containing both normal code and internal +representation (called fat-lto-objects in gcc and icc). +This is required since during build some code is generated by parsing +produced ELF objects (pmdinfogen). + +The amount of performance gain that one can get from LTO depends on the +compiler and the code that is being compiled. +However LTO is also useful for additional code analysis done by the +compiler. +In particular due to interprocedural analysis compiler can produce +additional warnings about variables that might be used uninitialized. +Some of these warnings might be "false positives" though and you might +need to explicitly initialize variable in order to silence the compiler. + +Please note that turning LTO on causes considerable extension of +build time. + +When using make based build, link time optimization can be enabled for +the whole DPDK by setting: + +.. code-block:: console + CONFIG_ENABLE_LTO=y + +in config file. +For the meson based build it can be enabled by setting meson built-in +'b_lto' option: + +.. code-block:: console + meson build -Db_lto=true diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index ae8e7b2f0..b11abe2fe 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -231,6 +231,15 @@ New Features * Added a console command to testpmd app, ``show port (port_id) ptypes`` which gives ability to print port supported ptypes in different protocol layers. +* **Added build support for Link Time Optimization.** + + LTO is an optimization technique used by the compiler to perform whole + program analysis and optimization at link time. In order to do that + compilers store their internal representation of the source code that + the linker uses at the final stage of compilation process. + + See :doc:`../prog_guide/lto` for more information: + Removed Items ------------- diff --git a/mk/toolchain/gcc/rte.toolchain-compat.mk b/mk/toolchain/gcc/rte.toolchain-compat.mk index ea40a11c0..69a53e5d0 100644 --- a/mk/toolchain/gcc/rte.toolchain-compat.mk +++ b/mk/toolchain/gcc/rte.toolchain-compat.mk @@ -88,6 +88,10 @@ else MACHINE_CFLAGS := $(filter-out -march% -mtune% -msse%,$(MACHINE_CFLAGS)) endif + ifeq ($(shell test $(GCC_VERSION) -lt 74 && echo 1), 1) + CONFIG_RTE_ENABLE_LTO=n + endif + # Disable thunderx PMD for gcc < 4.7 ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1) CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=d diff --git a/mk/toolchain/gcc/rte.vars.mk b/mk/toolchain/gcc/rte.vars.mk index b852fcfd7..9fc704193 100644 --- a/mk/toolchain/gcc/rte.vars.mk +++ b/mk/toolchain/gcc/rte.vars.mk @@ -62,6 +62,18 @@ endif # process cpu flags include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk +ifeq ($(CONFIG_RTE_ENABLE_LTO),y) +# 'fat-lto' is used since pmdinfogen needs to have 'this_pmd_nameX' +# exported in symbol table and without this option only internal +# representation is present. +TOOLCHAIN_CFLAGS += -flto -ffat-lto-objects +TOOLCHAIN_LDFLAGS += -flto +# workaround for GCC bug 81440 +ifeq ($(shell test $(GCC_VERSION) -lt 80 && echo 1), 1) +WERROR_FLAGS += -Wno-lto-type-mismatch +endif +endif + # workaround GCC bug with warning "missing initializer" for "= {0}" ifeq ($(shell test $(GCC_VERSION) -lt 47 && echo 1), 1) WERROR_FLAGS += -Wno-missing-field-initializers diff --git a/mk/toolchain/icc/rte.vars.mk b/mk/toolchain/icc/rte.vars.mk index aa1422bf1..8aa87aa1e 100644 --- a/mk/toolchain/icc/rte.vars.mk +++ b/mk/toolchain/icc/rte.vars.mk @@ -54,5 +54,13 @@ endif # process cpu flags include $(RTE_SDK)/mk/toolchain/$(RTE_TOOLCHAIN)/rte.toolchain-compat.mk +ifeq ($(CONFIG_RTE_ENABLE_LTO),y) +# 'fat-lto' is used since pmdinfogen needs to have 'this_pmd_nameX' +# exported in symbol table and without this option only internal +# representation is present. +TOOLCHAIN_CFLAGS += -flto -ffat-lto-objects +TOOLCHAIN_LDFLAGS += -flto +endif + export CC AS AR LD OBJCOPY OBJDUMP STRIP READELF export TOOLCHAIN_CFLAGS TOOLCHAIN_LDFLAGS TOOLCHAIN_ASFLAGS From patchwork Thu Nov 7 15:03:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62667 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 09A9FA034E; Thu, 7 Nov 2019 16:04:07 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1D6DB1BF66; Thu, 7 Nov 2019 16:03:36 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 27CCA1BF4E for ; Thu, 7 Nov 2019 16:03:33 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7Eslt2023790; Thu, 7 Nov 2019 07:03:32 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=pk9RtfnfNEJMJO0DXdEDbG7LkYNx29JxmxXFwUW+rOI=; b=YUlKkmrsuycrPVgqownAMXK8bsPgnDwcaAxqAEA4QrM4CKnfJPvitX/o3Y1vhkM5LKGu iEHlWDsUPWj2LSr6FLV5mmFKUVn5wR5JYli4szCM+cakqlhoALQaScsgf9qwvEUl9no9 d2AUKjja2s0zN6Vu/507r8eppJzBIFQK8/t/XdfZklYjD1h0gcgcW0ULb1GPgB00zBYl JP6KlYY0gMjCzNQPa18UV7jjkHiat1c7kO4yaFvnjXxe/5kcutekoxXCKryfZiHXPhZ3 sXqbh54/v/Gl4ThCQv34MFWnbw0AZpVyupF+22nE3FjUabrjl6qioVzHQ7nx3woySfZN eg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvrdr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:32 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:31 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:31 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id C7BDE3F7040; Thu, 7 Nov 2019 07:03:29 -0800 (PST) From: Andrzej Ostruszka To: , Erik Gabriel Carrillo , "Jerin Jacob" CC: , Date: Thu, 7 Nov 2019 16:03:10 +0100 Message-ID: <20191107150318.3677-5-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 04/12] eventdev: fix possible use of uninitialized var 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" Fix the logic for the case of event queue allowing all schedule types. Compiler warning pointing to this error (with LTO enabled): error: ‘sched_type’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if ((ret < 0 && ret != -EOVERFLOW) || Fixes: 6750b21bd6af ("eventdev: add default software timer adapter") Signed-off-by: Andrzej Ostruszka Reviewed-by: Jerin Jacob --- lib/librte_eventdev/rte_event_timer_adapter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eventdev/rte_event_timer_adapter.c b/lib/librte_eventdev/rte_event_timer_adapter.c index 5ce399eca..161e21a68 100644 --- a/lib/librte_eventdev/rte_event_timer_adapter.c +++ b/lib/librte_eventdev/rte_event_timer_adapter.c @@ -706,11 +706,11 @@ check_destination_event_queue(struct rte_event_timer *evtim, RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE, &sched_type); - if ((ret < 0 && ret != -EOVERFLOW) || - evtim->ev.sched_type != sched_type) - return -1; + if ((ret == 0 && evtim->ev.sched_type == sched_type) || + ret == -EOVERFLOW) + return 0; - return 0; + return -1; } static int From patchwork Thu Nov 7 15:03:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62668 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 58EB8A034E; Thu, 7 Nov 2019 16:04:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 59CEC1BF71; Thu, 7 Nov 2019 16:03:37 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 126031BF49 for ; Thu, 7 Nov 2019 16:03:34 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7EslQr023773; Thu, 7 Nov 2019 07:03:34 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=WL4awkoCPfA9/PSD7PrvjFy1rcOh+V0LstcbsynwMSo=; b=Pk7IrHH/cfjga0uE+2HlHZFlN2dpXI1rEIGKON7jjgh8eSJYiV2JFIjafTCM5UPaQXtb XcYQSQXlkKU9GWCJWIqdIGGg+tdO1/1nE9Iq+C9ZOQOoSSTRhO6lNsH2jM0bbPDXI4CI wcgnK2cK6QE0TB5Lmtl8bl1+fVai4+nzeJeYiNuh5FlIDQbxlXcr9WZlN63uHtKSHkS6 RfMKUEoAJ65ybt/IH3+W2pE3TttI1a9U1jYo17g2DG05+sFeW7b9zgiWt+EBnXoZMTbi bpIQxNNk73cfolwWi03/WBWhqzDDt5PQGsc2ipeeJJbObNIAlGcaMZKxP/2OoRVSJk2P fw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvre1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:34 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:33 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:33 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id C97CF3F703F; Thu, 7 Nov 2019 07:03:31 -0800 (PST) From: Andrzej Ostruszka To: , Jerin Jacob CC: , Date: Thu, 7 Nov 2019 16:03:11 +0100 Message-ID: <20191107150318.3677-6-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 05/12] app/eventdev: clean LTO build warnings (maybe-uninitialized) 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" During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: ‘service_id’ may be used uninitialized in this function [-Werror=maybe-uninitialized] ret = evt_service_setup(service_id); Signed-off-by: Andrzej Ostruszka Reviewed-by: Jerin Jacob --- app/test-eventdev/test_perf_common.c | 2 +- app/test-eventdev/test_pipeline_common.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/test-eventdev/test_perf_common.c b/app/test-eventdev/test_perf_common.c index e24519179..e7cf75a7d 100644 --- a/app/test-eventdev/test_perf_common.c +++ b/app/test-eventdev/test_perf_common.c @@ -439,7 +439,7 @@ perf_event_timer_adapter_setup(struct test_perf *t) if (!(adapter_info.caps & RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT)) { - uint32_t service_id; + uint32_t service_id = -1U; rte_event_timer_adapter_service_id_get(wl, &service_id); diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index 386aca299..160461fb2 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -326,7 +326,7 @@ pipeline_event_rx_adapter_setup(struct evt_options *opt, uint8_t stride, } if (!(cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT)) { - uint32_t service_id; + uint32_t service_id = -1U; rte_event_eth_rx_adapter_service_id_get(prod, &service_id); @@ -378,7 +378,7 @@ pipeline_event_tx_adapter_setup(struct evt_options *opt, } if (!(cap & RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT)) { - uint32_t service_id; + uint32_t service_id = -1U; rte_event_eth_tx_adapter_service_id_get(consm, &service_id); From patchwork Thu Nov 7 15:03:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62669 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 489E0A034E; Thu, 7 Nov 2019 16:04:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A3C131BF6F; Thu, 7 Nov 2019 16:03:38 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 0124E1BF6A for ; Thu, 7 Nov 2019 16:03:36 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7Eslt4023790; Thu, 7 Nov 2019 07:03:36 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=WtvEUYqBckyrkeuEw6xumA+/HgwP3du6EeauYxeRtMw=; b=ZR7MFse1A7TkNYZSKJ0mEh5bfpPjZIEDnVJXvXaKTwZXxFBZRlbM1/QP2+OTatyGiqKs RrjMCj/gj+QyuLJFAIsbWp6RPbZgsZF6wQQHxV7Ac/J3Kl02FnxhEAVqE6GAbGn1+f8W X0sWGZsk0ZBJE3+EAQN+Ceqy4OAxjjU+pccLm6el2kDsCddnMubTbFeKXjq2HS/KY4m9 u107tUXwBK/nuO6USyEMI/hJT8hGHN/gCQepDE3g88MBTV58NkZIfls7qxAvPp+RM1ZZ rM5SvjeaxizEp/hpV9fP22teMYOml43wR+Sc6GAOM55Xod48VAwZrV/UESPhIU/oJd/c 8Q== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvre8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:36 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:35 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:35 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id 8F74A3F7040; Thu, 7 Nov 2019 07:03:33 -0800 (PST) From: Andrzej Ostruszka To: , Pavan Nikhilesh , Jerin Jacob CC: , Date: Thu, 7 Nov 2019 16:03:12 +0100 Message-ID: <20191107150318.3677-7-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 06/12] event/octeontx2: clean LTO build warnings (maybe-uninitialized) 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" During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: ‘chunk’ may be used uninitialized in this function [-Werror=maybe-uninitialized] bkt->current_chunk = (uintptr_t)chunk; Signed-off-by: Andrzej Ostruszka --- drivers/event/octeontx2/otx2_tim_worker.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/event/octeontx2/otx2_tim_worker.h b/drivers/event/octeontx2/otx2_tim_worker.h index b193e2cab..50db6543c 100644 --- a/drivers/event/octeontx2/otx2_tim_worker.h +++ b/drivers/event/octeontx2/otx2_tim_worker.h @@ -337,7 +337,7 @@ tim_add_entry_brst(struct otx2_tim_ring * const tim_ring, const struct otx2_tim_ent *ents, const uint16_t nb_timers, const uint8_t flags) { - struct otx2_tim_ent *chunk; + struct otx2_tim_ent *chunk = NULL; struct otx2_tim_bkt *bkt; uint16_t chunk_remainder; uint16_t index = 0; From patchwork Thu Nov 7 15:03:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62675 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4BD9EA034E; Thu, 7 Nov 2019 16:05:34 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5E00F1BFB6; Thu, 7 Nov 2019 16:04:02 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id E54E61BFB3 for ; Thu, 7 Nov 2019 16:03:59 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7EttXJ028512; Thu, 7 Nov 2019 07:03:39 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=+keO6+G2eKOic0AOcp56HbUUyBi1xb7utLeSJN+jgcQ=; b=uhxov8c0+/oj0GYX1ovHXccP5EHk7a1HNlBbha2jTa26+g3NfUdi3td1zVJEgMxbMntE rCfFgdD5pCv5hxSA4LsJGWBJJS70gcsftALuzhcm8OtpIlkkKo8GoGVeLLxrqq0/xOqv yHx36jGRjDr3wZSNCfuUpDbtrbPQna0W/VZ15ad33+88Y8ji6jx8zd+JD8ndrr0JVqgU mrOS0R7PMIGNpptIHK3YJj57qeoBDNwR1B206smD+x8zvicmGmVo9XwYuDhW9YtMjB0z Bv8F3NnIlum1N228dxvWOsaeVrY7crkSGKMiYjqtIBIJvwZg6p00O66xIsikvtRIN9Kt vw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2w4fq6sbwy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:39 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:38 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:37 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id 9289D3F703F; Thu, 7 Nov 2019 07:03:35 -0800 (PST) From: Andrzej Ostruszka To: , Yipeng Wang , Sameh Gobriel , Bruce Richardson , Chas Williams , Anatoly Burakov CC: , Date: Thu, 7 Nov 2019 16:03:13 +0100 Message-ID: <20191107150318.3677-8-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 07/12] app/test: clean LTO build warnings (maybe-uninitialized) 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" During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: ‘stats.greatest_free_size’ may be used uninitialized in this function [-Werror=maybe-uninitialized] return len - overhead; Signed-off-by: Andrzej Ostruszka Acked-by: Yipeng Wang --- app/test/test_hash_readwrite.c | 2 +- app/test/test_link_bonding_mode4.c | 8 +++++++- app/test/test_memzone.c | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/test/test_hash_readwrite.c b/app/test/test_hash_readwrite.c index 4376b099b..615767fb6 100644 --- a/app/test/test_hash_readwrite.c +++ b/app/test/test_hash_readwrite.c @@ -298,7 +298,7 @@ test_rw_reader(void *arg) begin = rte_rdtsc_precise(); for (i = 0; i < read_cnt; i++) { - void *data; + void *data = arg; rte_hash_lookup_data(tbl_rw_test_param.h, tbl_rw_test_param.keys + i, &data); diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index ff54d7b91..cf12f026d 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -585,7 +585,13 @@ bond_get_update_timeout_ms(void) { struct rte_eth_bond_8023ad_conf conf; - rte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf); + if (rte_eth_bond_8023ad_conf_get(test_params.bonded_port_id, &conf) < 0) { + RTE_LOG(DEBUG, EAL, "Failed to get bonding configuration: " + "%s at %d\n", __func__, __LINE__); + RTE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__); + return 0; + } + return conf.update_timeout_ms; } diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c index 4d8744455..0343b0326 100644 --- a/app/test/test_memzone.c +++ b/app/test/test_memzone.c @@ -475,7 +475,8 @@ find_max_block_free_size(unsigned int align, unsigned int socket_id) struct rte_malloc_socket_stats stats; size_t len, overhead; - rte_malloc_get_socket_stats(socket_id, &stats); + if (rte_malloc_get_socket_stats(socket_id, &stats) < 0) + return 0; len = stats.greatest_free_size; overhead = MALLOC_ELEM_OVERHEAD; From patchwork Thu Nov 7 15:03:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62670 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9384FA034E; Thu, 7 Nov 2019 16:04:35 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E4A751BF86; Thu, 7 Nov 2019 16:03:42 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 649781BF82 for ; Thu, 7 Nov 2019 16:03:41 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7Et5ul023864; Thu, 7 Nov 2019 07:03:40 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=G57MditZ3bILW6FE6qNqHB55xaQtT1qkRrqAG+rAFhA=; b=JU6rSnnjMuteVq3YPC6W0cR1vxYChZ9m2SY+W6RD3yXfDQ9Dv4ztsHdU/k39QLFZGpl2 i4bbb9rsf6a59fEeGl7VKHbZH/iasejOyfOfd/+b7WXVYXOR8j600K6rqjQx/dXNf0xV E6ZbwhTndAmzRvmTL+Mr3gk5V3xuVbOdk38R5T+9ZKSMUWJMFfbpbqwJH8F7rXJ7PJxB 4QNPAAPBNqXTfKm3wvBw6/pgkecwAQdR9JjoREpsdqd2w1QXFQEun3E4WAothot2X1rk 3AdfwaQFs5vIgkVeAjko9HsTTMENqPnDDg1l7gKWRxy8mqPFKIpU4BWLxjfGCrSh8Zzh zw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvrfs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:40 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:39 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:39 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id 2DA2C3F7040; Thu, 7 Nov 2019 07:03:37 -0800 (PST) From: Andrzej Ostruszka To: , Hemant Agrawal , Sachin Saxena CC: , Date: Thu, 7 Nov 2019 16:03:14 +0100 Message-ID: <20191107150318.3677-9-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 08/12] net/dpaa2: fix possible use of uninitialized vars 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 patch fixes 'maybe-uninitialized' warnings reported by compiler when using LTO. Compiler warning pointing to this error (with LTO enabled): error: ‘kg_cfg.extracts[0].masks[0].mask’ may be used uninitialized in this function [-Werror=maybe-uninitialized] extr->masks[j].mask = cfg->extracts[i].masks[j].mask; Fixes: 16bbc98a3e63 ("bus/fslmc: update MC to 10.3.x") Signed-off-by: Andrzej Ostruszka --- drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 1 + drivers/net/dpaa2/mc/dpkg.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index 16555d7b0..47a8bda6a 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -51,6 +51,7 @@ rte_pmd_dpaa2_set_custom_hash(uint16_t port_id, kg_cfg.extracts[0].type = DPKG_EXTRACT_FROM_DATA; kg_cfg.extracts[0].extract.from_data.offset = offset; kg_cfg.extracts[0].extract.from_data.size = size; + kg_cfg.extracts[0].num_of_byte_masks = 0; kg_cfg.num_extracts = 1; ret = dpkg_prepare_key_cfg(&kg_cfg, p_params); diff --git a/drivers/net/dpaa2/mc/dpkg.c b/drivers/net/dpaa2/mc/dpkg.c index 80f94f40e..1e171eedc 100644 --- a/drivers/net/dpaa2/mc/dpkg.c +++ b/drivers/net/dpaa2/mc/dpkg.c @@ -63,7 +63,10 @@ dpkg_prepare_key_cfg(const struct dpkg_profile_cfg *cfg, uint8_t *key_cfg_buf) dpkg_set_field(extr->extract_type, EXTRACT_TYPE, cfg->extracts[i].type); - for (j = 0; j < DPKG_NUM_OF_MASKS; j++) { + if (extr->num_of_byte_masks > DPKG_NUM_OF_MASKS) + return -EINVAL; + + for (j = 0; j < extr->num_of_byte_masks; j++) { extr->masks[j].mask = cfg->extracts[i].masks[j].mask; extr->masks[j].offset = cfg->extracts[i].masks[j].offset; From patchwork Thu Nov 7 15:03:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62671 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E8DFA034E; Thu, 7 Nov 2019 16:04:44 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 875721BF8F; Thu, 7 Nov 2019 16:03:45 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 2BFEF1BF89 for ; Thu, 7 Nov 2019 16:03:43 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7Esquw023813; Thu, 7 Nov 2019 07:03:42 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=RETDJ72H+sFGrRYB8z/HJt4ON0TykTqv8NA9rJqqQtw=; b=oK9mIaffw2/aD3XPslTrnWd2RIGGTAOyNimlm+U+nLN90BZTfZ97Sncq1EQGpYwqZLpP VJKDhW6yrOCe0vPnN4nLcC8ne7LuOPJZk92TxP0xdJnvNr9fy/etLsDj3+BDEiVcvdcS F4LVPH+06W1CKotpi15wUlZrA8/YKp7crLBRi2PsuvFsrgFfES+r6QA9KWbie1lZIb0W DbGmnNaOD9JfC3mgJGB4HH3MBqBFcpz/PZQFO5Ba1UE+h7ZG1SaXRAE+unMc2dAqC9AP V0nSYM/0+W8h1zs0MdAUaRr6fm5xPSaUF0DzcoyVC3qdR9s0ytBMJYEbxgn+Gjt1MtPj VA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvrfw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:42 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:41 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:41 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id 232DC3F703F; Thu, 7 Nov 2019 07:03:39 -0800 (PST) From: Andrzej Ostruszka To: , Wenzhuo Lu CC: , Date: Thu, 7 Nov 2019 16:03:15 +0100 Message-ID: <20191107150318.3677-10-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 09/12] net/e1000: clean LTO build warnings (maybe-uninitialized) 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" During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: ‘link’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if (link) { Signed-off-by: Andrzej Ostruszka --- drivers/net/e1000/base/e1000_82543.c | 2 +- drivers/net/e1000/base/e1000_ich8lan.c | 2 +- drivers/net/e1000/base/e1000_phy.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/e1000/base/e1000_82543.c b/drivers/net/e1000/base/e1000_82543.c index 810899eb6..dfde2a8b9 100644 --- a/drivers/net/e1000/base/e1000_82543.c +++ b/drivers/net/e1000/base/e1000_82543.c @@ -1027,7 +1027,7 @@ STATIC s32 e1000_setup_copper_link_82543(struct e1000_hw *hw) { u32 ctrl; s32 ret_val; - bool link; + bool link = true; DEBUGFUNC("e1000_setup_copper_link_82543"); diff --git a/drivers/net/e1000/base/e1000_ich8lan.c b/drivers/net/e1000/base/e1000_ich8lan.c index accc6ea01..5241cf698 100644 --- a/drivers/net/e1000/base/e1000_ich8lan.c +++ b/drivers/net/e1000/base/e1000_ich8lan.c @@ -5533,7 +5533,7 @@ void e1000_igp3_phy_powerdown_workaround_ich8lan(struct e1000_hw *hw) void e1000_gig_downshift_workaround_ich8lan(struct e1000_hw *hw) { s32 ret_val; - u16 reg_data; + u16 reg_data = 0; DEBUGFUNC("e1000_gig_downshift_workaround_ich8lan"); diff --git a/drivers/net/e1000/base/e1000_phy.c b/drivers/net/e1000/base/e1000_phy.c index 7d08f836f..956c06747 100644 --- a/drivers/net/e1000/base/e1000_phy.c +++ b/drivers/net/e1000/base/e1000_phy.c @@ -1664,7 +1664,7 @@ s32 e1000_copper_link_autoneg(struct e1000_hw *hw) s32 e1000_setup_copper_link_generic(struct e1000_hw *hw) { s32 ret_val; - bool link; + bool link = true; DEBUGFUNC("e1000_setup_copper_link_generic"); From patchwork Thu Nov 7 15:03:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62672 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D061DA034E; Thu, 7 Nov 2019 16:04:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A68971BF91; Thu, 7 Nov 2019 16:03:47 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 7565B1BF8D for ; Thu, 7 Nov 2019 16:03:45 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7Etm31028456; Thu, 7 Nov 2019 07:03:44 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=D81CQAI19s7DZkJJhi+P3sRqOsN3QBMZIMIHbidIu8I=; b=u6QbTrzPEaWMfQykJqAz0RKiZS4bUgZ/nFij62jxnZi0p5MfJ+EKHmC+MYOqdtydaRXF rc1ZxygTvHbAzle4DgktotdLzTVpgCnryht8eAR/RkLEY8pILRDGHbmy7mrUJcygmsHB naL8D+pvJ4MgeKq3g5EWGEt392Cx5iy3rq6ktkeVTjtc3QgwI6/Y9new9LO0Es/QtWGu zWjkoKKzYL6eIEBeVaTP6vznU293O+TXx8X5BsAshi6YrOhKnw4ITz+x+ShHuXG7e3/u 2vVrciBw4ciXE2HnpcJDeSY2aQ8Jdxgn4jZY8SoWFfc/QLFySsQWvXPP+yw2bjsT9pSA vw== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2w4fq6sbxr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:44 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:43 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:43 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id DC5BC3F7040; Thu, 7 Nov 2019 07:03:41 -0800 (PST) From: Andrzej Ostruszka To: , Beilei Xing , Qi Zhang CC: , Date: Thu, 7 Nov 2019 16:03:16 +0100 Message-ID: <20191107150318.3677-11-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 10/12] net/i40e: clean LTO build warnings (maybe-uninitialized) 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" During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: ‘filter_idx’ may be used uninitialized in this function [-Werror=maybe-uninitialized] PMD_DRV_LOG(INFO, "Added port %d with AQ command with index %d", Signed-off-by: Andrzej Ostruszka --- drivers/net/i40e/i40e_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 77a46832c..91d529b2f 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -8480,7 +8480,7 @@ static int i40e_add_vxlan_port(struct i40e_pf *pf, uint16_t port, int udp_type) { int idx, ret; - uint8_t filter_idx; + uint8_t filter_idx = 0; struct i40e_hw *hw = I40E_PF_TO_HW(pf); idx = i40e_get_vxlan_port_idx(pf, port); From patchwork Thu Nov 7 15:03:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62673 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id BFE55A034E; Thu, 7 Nov 2019 16:05:05 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F76C1BFA0; Thu, 7 Nov 2019 16:03:49 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id F227C1BF91 for ; Thu, 7 Nov 2019 16:03:46 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7EskbI023769; Thu, 7 Nov 2019 07:03:46 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=3MSB39sY0jvBs9Jk+rsFl6QE6Dr6vrO6NuZEJihQ4UY=; b=EK1PPAcc8s0OCX7OfDQ4zpErxlwVnMJ7mIQQnhYcQeoi9PNX2M4MaX+LBhZrzgn5GEg4 9wWH3+U8zq+34ek1b9z1qTsoK/2Wu1IiuSAJU6Zyq2hW43VwWrnfGTrEDVoMzo7E6Dq+ Uzji02EJ7qAHsaxAwFRu7PyzY8oM7MXi3kCqpJWd0gEmgC9/6ipMbVbTkBzUhdTs+Bvo 8dCJNOFjxEH4n8L220tkOeXmcv1MNggi/AgzgIgrePF2mOiU/Gx9RSG8LpWXpZmCTBHE MX09hG1CcqDzV7KNLqhr/5LEYcNXJOvaVjRSCLQ7igALh8c0OJAt+XAwwaJWxesLlHOP Iw== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 2w41uwvrgn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:46 -0800 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:45 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:45 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id DB30B3F7041; Thu, 7 Nov 2019 07:03:43 -0800 (PST) From: Andrzej Ostruszka To: , Xiao Wang CC: , Date: Thu, 7 Nov 2019 16:03:17 +0100 Message-ID: <20191107150318.3677-12-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 11/12] net/ifc: clean LTO build warnings (maybe-uninitialized) 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" During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: ‘features’ may be used uninitialized in this function [-Werror=maybe-uninitialized] if (RTE_VHOST_NEED_LOG(features)) { Signed-off-by: Andrzej Ostruszka --- drivers/net/ifc/ifcvf_vdpa.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c index 8de9ef199..9c562def0 100644 --- a/drivers/net/ifc/ifcvf_vdpa.c +++ b/drivers/net/ifc/ifcvf_vdpa.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -304,8 +305,8 @@ vdpa_ifcvf_stop(struct ifcvf_internal *internal) struct ifcvf_hw *hw = &internal->hw; uint32_t i; int vid; - uint64_t features; - uint64_t log_base, log_size; + uint64_t features = 0; + uint64_t log_base = 0, log_size = 0; uint64_t len; vid = internal->vid; @@ -348,6 +349,8 @@ vdpa_enable_vfio_intr(struct ifcvf_internal *internal, bool m_rx) struct rte_vhost_vring vring; int fd; + vring.callfd = -1; + nr_vring = rte_vhost_get_vring_num(internal->vid); irq_set = (struct vfio_irq_set *)irq_set_buf; @@ -442,6 +445,7 @@ notify_relay(void *arg) } internal->epfd = epfd; + vring.kickfd = -1; for (qid = 0; qid < q_num; qid++) { ev.events = EPOLLIN | EPOLLPRI; rte_vhost_get_vhost_vring(internal->vid, qid, &vring); @@ -583,6 +587,7 @@ m_ifcvf_start(struct ifcvf_internal *internal) uint64_t size; uint64_t gpa; + memset(&vq, 0, sizeof(vq)); vid = internal->vid; nr_vring = rte_vhost_get_vring_num(vid); rte_vhost_get_negotiated_features(vid, &hw->req_features); @@ -721,6 +726,7 @@ vring_relay(void *arg) } internal->epfd = epfd; + vring.kickfd = -1; for (qid = 0; qid < q_num; qid++) { ev.events = EPOLLIN | EPOLLPRI; rte_vhost_get_vhost_vring(vid, qid, &vring); @@ -930,11 +936,11 @@ ifcvf_dev_close(int vid) static int ifcvf_set_features(int vid) { - uint64_t features; + uint64_t features = 0; int did; struct internal_list *list; struct ifcvf_internal *internal; - uint64_t log_base, log_size; + uint64_t log_base = 0, log_size = 0; did = rte_vhost_get_vdpa_device_id(vid); list = find_internal_resource_by_did(did); From patchwork Thu Nov 7 15:03:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andrzej Ostruszka [C]" X-Patchwork-Id: 62674 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45B1BA034E; Thu, 7 Nov 2019 16:05:21 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B10EE1BFAC; Thu, 7 Nov 2019 16:03:52 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 7AEBA1BFA4 for ; Thu, 7 Nov 2019 16:03:49 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA7EuHBi028573; Thu, 7 Nov 2019 07:03:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type : content-transfer-encoding; s=pfpt0818; bh=2hXUR5T8rVrq832LQOtqGEb/zCGdTKkniqomGqQYu1I=; b=aFBC7PQKQ/cXwf3TW5tysizzrMWGUGNLDmiAI3fEukiWNF9MxEXtex79uNo2JO2O5GmL tUQGxXj5vQ9ygyF5zu8c3Apn6EEbMFuWKmyM/ERaZDM42FGEEGujhgqSRjyZqXzredtR Pv2RkNKcWqfhpJsRCelS3tcPy5QiuzPqjf9uUAn0LhufV0ZWJMR5/nrtoXuw3VX7NnTb jXg7Di50SbK7R2qHwjKZNRvMPNxYfRZ3b8ss+TjrOatahGDtGyNpptEeNQg4gm5i+j5x zWD6U87+TGJ0cH/fZVezz6P8uxB53/+2nit/BpO7SIQ0RNrvK/33plG8zBUV/5if4qdP Ng== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2w4fq6sby2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Nov 2019 07:03:48 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 7 Nov 2019 07:03:47 -0800 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 7 Nov 2019 07:03:47 -0800 Received: from amok.marvell.com (unknown [10.95.130.48]) by maili.marvell.com (Postfix) with ESMTP id A07CA3F703F; Thu, 7 Nov 2019 07:03:45 -0800 (PST) From: Andrzej Ostruszka To: , Rasesh Mody , Shahed Shaikh CC: , Date: Thu, 7 Nov 2019 16:03:18 +0100 Message-ID: <20191107150318.3677-13-aostruszka@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191107150318.3677-1-aostruszka@marvell.com> References: <20191029141212.4907-1-aostruszka@marvell.com> <20191107150318.3677-1-aostruszka@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-11-07_05:2019-11-07,2019-11-07 signatures=0 Subject: [dpdk-dev] [PATCH v7 12/12] net/qede: clean LTO build warnings (maybe-uninitialized) 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" During LTO build compiler reports some 'false positive' warnings about variables being possibly used uninitialized. This patch silences these warnings. Exemplary compiler warning to suppress (with LTO enabled): error: ‘transceiver_type’ may be used uninitialized in this function [-Werror=maybe-uninitialized] switch (transceiver_type) { Signed-off-by: Andrzej Ostruszka --- drivers/net/qede/base/ecore_mcp.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c index a5aa07438..7518765a0 100644 --- a/drivers/net/qede/base/ecore_mcp.c +++ b/drivers/net/qede/base/ecore_mcp.c @@ -2328,7 +2328,7 @@ enum _ecore_status_t ecore_mcp_trans_speed_mask(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, u32 *p_speed_mask) { - u32 transceiver_type, transceiver_state; + u32 transceiver_type = ETH_TRANSCEIVER_TYPE_NONE, transceiver_state; ecore_mcp_get_transceiver_data(p_hwfn, p_ptt, &transceiver_state, &transceiver_type); @@ -3223,7 +3223,8 @@ enum _ecore_status_t ecore_mcp_nvm_put_file_begin(struct ecore_dev *p_dev, enum _ecore_status_t ecore_mcp_nvm_write(struct ecore_dev *p_dev, u32 cmd, u32 addr, u8 *p_buf, u32 len) { - u32 buf_idx, buf_size, nvm_cmd, nvm_offset, resp, param; + u32 buf_idx, buf_size, nvm_cmd, nvm_offset; + u32 resp = FW_MSG_CODE_ERROR, param; struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev); enum _ecore_status_t rc = ECORE_INVAL; struct ecore_ptt *p_ptt; @@ -3322,7 +3323,7 @@ enum _ecore_status_t ecore_mcp_nvm_set_secure_mode(struct ecore_dev *p_dev, { struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev); struct ecore_ptt *p_ptt; - u32 resp, param; + u32 resp = 0, param; enum _ecore_status_t rc; p_ptt = ecore_ptt_acquire(p_hwfn); @@ -3430,7 +3431,7 @@ enum _ecore_status_t ecore_mcp_gpio_read(struct ecore_hwfn *p_hwfn, u16 gpio, u32 *gpio_val) { enum _ecore_status_t rc = ECORE_SUCCESS; - u32 drv_mb_param = 0, rsp; + u32 drv_mb_param = 0, rsp = 0; drv_mb_param = (gpio << DRV_MB_PARAM_GPIO_NUMBER_OFFSET); @@ -3451,7 +3452,7 @@ enum _ecore_status_t ecore_mcp_gpio_write(struct ecore_hwfn *p_hwfn, u16 gpio, u16 gpio_val) { enum _ecore_status_t rc = ECORE_SUCCESS; - u32 drv_mb_param = 0, param, rsp; + u32 drv_mb_param = 0, param, rsp = 0; drv_mb_param = (gpio << DRV_MB_PARAM_GPIO_NUMBER_OFFSET) | (gpio_val << DRV_MB_PARAM_GPIO_VALUE_OFFSET); @@ -3541,7 +3542,7 @@ enum _ecore_status_t ecore_mcp_bist_clock_test(struct ecore_hwfn *p_hwfn, enum _ecore_status_t ecore_mcp_bist_nvm_test_get_num_images( struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, u32 *num_images) { - u32 drv_mb_param = 0, rsp; + u32 drv_mb_param = 0, rsp = 0; enum _ecore_status_t rc = ECORE_SUCCESS; drv_mb_param = (DRV_MB_PARAM_BIST_NVM_TEST_NUM_IMAGES << @@ -3925,7 +3926,7 @@ enum _ecore_status_t __ecore_mcp_resc_lock(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, struct ecore_resc_lock_params *p_params) { - u32 param = 0, mcp_resp, mcp_param; + u32 param = 0, mcp_resp = 0, mcp_param = 0; u8 opcode; enum _ecore_status_t rc;