From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f65.google.com (mail-pg0-f65.google.com [74.125.83.65]) by dpdk.org (Postfix) with ESMTP id F1C658E63 for ; Wed, 25 Apr 2018 17:56:56 +0200 (CEST) Received: by mail-pg0-f65.google.com with SMTP id e12so13634968pgn.9 for ; Wed, 25 Apr 2018 08:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z00KzAx0dVxrqV9jH6d5YO0qgRiUYhJbEw+x3B88mSs=; b=jw5nk8AIDQsF077E/sP+4K1OJqRovFotkG4fX1ENwrfKm6keFeOwgi253ShZw0bj/v lDqxav5b+mTnSitykSzGuloshR4nVdG4DBeEY1zdjgmFq2aDogcUUTfZL5vldHMzLvPG OktLUhVe8pVctdQFzWTrKxoFWGL2HF6qEMeRO7m+KLPSiikmmNMxVCP82MOaD+gKbChE X/CPDezGX/nS0vS9O625gaP+XXbEZZ5tmm2JrsnmBUiEIzXmounlxkd9f6f0V+lPohRE +ym/whFDBjPh8hOqsJIREvlxqQdFHECl+rtCj1L9FXbAnn1yAH5aLpxMKgrSG75RzFTb hOMA== 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=Z00KzAx0dVxrqV9jH6d5YO0qgRiUYhJbEw+x3B88mSs=; b=kCix6sbyXiaGPadWM/U4QL5ShSKcYyA2hBSv3ur0rSWyXNGSFafLzfDmnOTt68NIB0 DedBWQ0UrSwvHdbSDN5VpumyVQa5qbifIh0eDRTHwLJITHEmim1xGn55q9dM9KM61oRJ Fz8Kd/77PD00nvLXdjnpv3gD4fPJBYDeWcjfEbNUZDVoUIobf0fHaWtJ10OOpfPp55Hk w9piRCqY50+QZjkE8dvP33zi+CmSjxi2M+HQRTLA9xLlHBf86PQDOmskS1XIJaASjFIj 1MV/lLO46ZHJ6PIaw7XJdn8q/pV97icdCRJmUneUivWU9a1/R5tA5s6kuxTO+cB5F+o0 /36g== X-Gm-Message-State: ALQs6tCxerBWsQqMycJOdgrUcNHryKt4hK0LCsNqwj+1AtD9VdSdUPtG dLOefgf0CYIe05/Dtp3WF4q6lws6n9E= X-Google-Smtp-Source: AIpwx4/JEaTS912L4q2d5il/SPA4umT3y0/TOq76HeyhjSFQJjK6hNdqxLllNGS5v2neKUnUKqJ1mw== X-Received: by 10.98.3.3 with SMTP id 3mr18695609pfd.255.1524671815879; Wed, 25 Apr 2018 08:56:55 -0700 (PDT) Received: from xeon-e3.lan (204-195-71-95.wavecable.com. [204.195.71.95]) by smtp.gmail.com with ESMTPSA id y3sm25713924pgc.81.2018.04.25.08.56.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:56:54 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 25 Apr 2018 08:56:41 -0700 Message-Id: <20180425155646.3627-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425155646.3627-1-stephen@networkplumber.org> References: <20180425155646.3627-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH next 05/10] net/softnic: convert to dynamic logging 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: , X-List-Received-Date: Wed, 25 Apr 2018 15:56:57 -0000 Signed-off-by: Stephen Hemminger --- drivers/net/softnic/rte_eth_softnic.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index e3243940cba7..9835124ad9f2 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -67,6 +67,12 @@ static const struct rte_eth_dev_info pmd_dev_info = { }, }; +static int pmd_softnic_logtype; + +#define PMD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, pmd_softnic_logtype, \ + "%s(): " fmt "\n", __func__, ##args) + static void pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused, struct rte_eth_dev_info *dev_info) @@ -728,7 +734,7 @@ pmd_probe(struct rte_vdev_device *vdev) struct rte_eth_dev *eth_dev; const char *name = rte_vdev_device_name(vdev); - RTE_LOG(INFO, PMD, "Probing device \"%s\"\n", name); + PMD_LOG(INFO, "Probing device \"%s\"", name); /* Parse input arguments */ params = rte_vdev_device_args(vdev); @@ -737,7 +743,7 @@ pmd_probe(struct rte_vdev_device *vdev) strlen(params) == 0) { eth_dev = rte_eth_dev_attach_secondary(name); if (!eth_dev) { - RTE_LOG(ERR, PMD, "Failed to probe %s\n", name); + PMD_LOG(ERR, "Failed to probe %s", name); return -1; } /* TODO: request info from primary to set up Rx and Tx */ @@ -776,8 +782,8 @@ pmd_probe(struct rte_vdev_device *vdev) return -ENOMEM; /* Register soft ethdev */ - RTE_LOG(INFO, PMD, - "Creating soft ethdev \"%s\" for hard ethdev \"%s\"\n", + PMD_LOG(INFO, + "Creating soft ethdev \"%s\" for hard ethdev \"%s\"", p.soft.name, p.hard.name); status = pmd_ethdev_register(vdev, &p, dev_private); @@ -798,7 +804,7 @@ pmd_remove(struct rte_vdev_device *vdev) if (!vdev) return -EINVAL; - RTE_LOG(INFO, PMD, "Removing device \"%s\"\n", + PMD_LOG(INFO, "Removing device \"%s\"", rte_vdev_device_name(vdev)); /* Find the ethdev entry */ @@ -833,3 +839,12 @@ RTE_PMD_REGISTER_PARAM_STRING(net_softnic, PMD_PARAM_SOFT_TM_DEQ_BSZ "= " PMD_PARAM_HARD_NAME "= " PMD_PARAM_HARD_TX_QUEUE_ID "="); + +RTE_INIT(pmd_softnic_init_log); +static void +pmd_softnic_init_log(void) +{ + pmd_softnic_logtype = rte_log_register("pmd.net.softnic"); + if (pmd_softnic_logtype >= 0) + rte_log_set_level(pmd_softnic_logtype, RTE_LOG_NOTICE); +} -- 2.17.0