From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id 37A152BF3 for ; Wed, 23 May 2018 14:11:35 +0200 (CEST) Received: by mail-wm0-f65.google.com with SMTP id o78-v6so8630927wmg.0 for ; Wed, 23 May 2018 05:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PGJfY3FjZ0tWCXApwxtc2SAsHic00YWRhEKPX8iYhqY=; b=AHOUi2em9q3K0S019ZeHten66+h6V8aj52X+OHoqFFP4JEs11heOs3YJycxJlvfuQw XzXbNtdxzg4MRFu7O9At3RNz/uFFcC0EhmKfNbMSZBdSmB+bb0ov/tYaIv10ZjDw6tTa UpclirxfnrQKCvFM2fBT9ibt2yuku/xjwygfsRd9+nnNB1g0CBnBG5pbH3IzUMCRVGQr hDXdWFnVv2kiyylyjISU4fnHtCKFfs2piAkHwrKb/liHwlPb4cTzVOeIC37xqvMLx+3Y HHJH6uA/3f1sDFy+OqY/lB4zFzkiuYajjDFqGyeonyGcgnigvsm5eV36no4A3gVOJZwu zPCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PGJfY3FjZ0tWCXApwxtc2SAsHic00YWRhEKPX8iYhqY=; b=ZqtWRh8JLnZoX6QdwJX3C4BTbL2INVeDMrhmA0+Nk6/VnGroBSAXke4WqqwZ/G2o+s 77rb+ySBeCLLVZB5VI3UL25k5N0T6d81WbeBO+prTMqDc7uwyYuK9TXz3Bg2iYcqDcUa KtPhvNm6y7RnpqulJpZQDj7J+7eckYlURFBt/wwFKeFH39qC0r7WJxjEAKQS6GOlOI+J 9vG/B1CtEbusTayCqwKRDFdHUIdbnpLpDM5PQTc55TFjfqNud+/poVB7uWtv8EvJq7Bf LL+G2l5CkMIU2D+RPY7yJ/5DFANaFh03LRNxwkVWomGrwkTia3Cs0VTRo3PqysczG7BX DS1Q== X-Gm-Message-State: ALKqPwd42w8GxYTh7D6toy/AhV6Brdh0yZeqI7LpWz+vbrf5ouNOCpZS hC7U0Ybg8b+oiPwnkv+oRB4= X-Google-Smtp-Source: AB8JxZoGRLLDSsgb+OSp5mZwwlDVzYtmEUKKwoeYQbLLoXuq87en3rOj6xqx+jfJJfl9A9X9eCPLPQ== X-Received: by 2002:a1c:ae50:: with SMTP id x77-v6mr4594893wme.64.1527077494816; Wed, 23 May 2018 05:11:34 -0700 (PDT) Received: from localhost ([2a00:23c5:be9a:5200:ce4c:82c0:d567:ecbb]) by smtp.gmail.com with ESMTPSA id v111-v6sm20507930wrb.30.2018.05.23.05.11.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 23 May 2018 05:11:33 -0700 (PDT) From: luca.boccassi@gmail.com To: Harry van Haaren Cc: Vipin Varghese , dpdk stable Date: Wed, 23 May 2018 13:10:00 +0100 Message-Id: <20180523121010.8385-49-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180523121010.8385-1-luca.boccassi@gmail.com> References: <20180516101323.2234-2-luca.boccassi@gmail.com> <20180523121010.8385-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'net/e1000: fix build of igb only' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2018 12:11:35 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/25/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From 8ac2743ed3c0c1c47d35a47181517787e038ce7f Mon Sep 17 00:00:00 2001 From: Harry van Haaren Date: Mon, 21 May 2018 10:31:41 +0100 Subject: [PATCH] net/e1000: fix build of igb only [ upstream commit 4ebbe84dae82290ed2e49e36bf894efec0dc2123 ] This commit fixes a compilation error if EM_PMD is not defined, bug IGB_PMD is. The root cause of the issue was that log init variables are declared as extern in a header file, while the definition of the variables was in e1000_ethdev.c. Hence, the definitions were not available if the e1000 PMD is disabled. To fix this, a new file is added e1000_logs.c, which matches the e1000_logs.h header. The log variables are always compiled in, but the PMD logs are only registered if a PMD is enabled in the configuration. Extra checks are added in order to avoid duplicate registering. Fixes: ed5bbb767c3e ("net/e1000: implement dynamic logging") Reported-by: Vipin Varghese Signed-off-by: Harry van Haaren Acked-by: Vipin Varghese --- drivers/net/e1000/Makefile | 1 + drivers/net/e1000/e1000_logs.c | 26 ++++++++++++++++++++++++++ drivers/net/e1000/e1000_logs.h | 6 ++++++ drivers/net/e1000/em_ethdev.c | 16 ++++------------ drivers/net/e1000/igb_ethdev.c | 8 ++++++++ drivers/net/e1000/meson.build | 1 + 6 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 drivers/net/e1000/e1000_logs.c diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile index 87cfb265d..9c87e883b 100644 --- a/drivers/net/e1000/Makefile +++ b/drivers/net/e1000/Makefile @@ -62,6 +62,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000_82575.c SRCS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000_i210.c SRCS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000_api.c SRCS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000_ich8lan.c +SRCS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000_logs.c SRCS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000_mac.c SRCS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000_manage.c SRCS-$(CONFIG_RTE_LIBRTE_E1000_PMD) += e1000_mbx.c diff --git a/drivers/net/e1000/e1000_logs.c b/drivers/net/e1000/e1000_logs.c new file mode 100644 index 000000000..22173939f --- /dev/null +++ b/drivers/net/e1000/e1000_logs.c @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Intel Corporation + */ + +#include "e1000_logs.h" + +/* declared as extern in e1000_logs.h */ +int e1000_logtype_init; +int e1000_logtype_driver; + +/* avoids double registering of logs if EM and IGB drivers are in use */ +static int e1000_log_initialized; + +void +e1000_igb_init_log(void) +{ + if (!e1000_log_initialized) { + e1000_logtype_init = rte_log_register("pmd.net.e1000.init"); + if (e1000_logtype_init >= 0) + rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE); + e1000_logtype_driver = rte_log_register("pmd.net.e1000.driver"); + if (e1000_logtype_driver >= 0) + rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE); + e1000_log_initialized = 1; + } +} diff --git a/drivers/net/e1000/e1000_logs.h b/drivers/net/e1000/e1000_logs.h index 50348e9ed..69d3d3118 100644 --- a/drivers/net/e1000/e1000_logs.h +++ b/drivers/net/e1000/e1000_logs.h @@ -5,6 +5,8 @@ #ifndef _E1000_LOGS_H_ #define _E1000_LOGS_H_ +#include + extern int e1000_logtype_init; #define PMD_INIT_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, e1000_logtype_init, \ @@ -41,4 +43,8 @@ extern int e1000_logtype_driver; #define PMD_DRV_LOG(level, fmt, args...) \ PMD_DRV_LOG_RAW(level, fmt "\n", ## args) + +/* log init function shared by e1000 and igb drivers */ +void e1000_igb_init_log(void); + #endif /* _E1000_LOGS_H_ */ diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index 242375ff1..f84914032 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -105,9 +104,6 @@ static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, static enum e1000_fc_mode em_fc_setting = e1000_fc_full; -int e1000_logtype_init; -int e1000_logtype_driver; - /* * The set of PCI devices this driver supports */ @@ -1864,14 +1860,10 @@ RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map); RTE_PMD_REGISTER_KMOD_DEP(net_e1000_em, "* igb_uio | uio_pci_generic | vfio-pci"); -RTE_INIT(e1000_init_log); +/* see e1000_logs.c */ +RTE_INIT(igb_init_log); static void -e1000_init_log(void) +igb_init_log(void) { - e1000_logtype_init = rte_log_register("pmd.net.e1000.init"); - if (e1000_logtype_init >= 0) - rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE); - e1000_logtype_driver = rte_log_register("pmd.net.e1000.driver"); - if (e1000_logtype_driver >= 0) - rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE); + e1000_igb_init_log(); } diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 3c5138dea..d0aa1ef8f 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -5654,3 +5654,11 @@ RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb, "* igb_uio | uio_pci_generic | vfio-pci RTE_PMD_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_e1000_igb_vf, pci_id_igbvf_map); RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb_vf, "* igb_uio | vfio-pci"); + +/* see e1000_logs.c */ +RTE_INIT(e1000_init_log); +static void +e1000_init_log(void) +{ + e1000_igb_init_log(); +} diff --git a/drivers/net/e1000/meson.build b/drivers/net/e1000/meson.build index 3a1bf5af2..cf456995c 100644 --- a/drivers/net/e1000/meson.build +++ b/drivers/net/e1000/meson.build @@ -5,6 +5,7 @@ subdir('base') objs = [base_objs] sources = files( + 'e1000_logs.c', 'em_ethdev.c', 'em_rxtx.c', 'igb_ethdev.c', -- 2.14.2