From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) by dpdk.org (Postfix) with ESMTP id 813058E5D for ; Wed, 25 Apr 2018 17:56:55 +0200 (CEST) Received: by mail-pf0-f193.google.com with SMTP id o76so10881322pfi.5 for ; Wed, 25 Apr 2018 08:56:55 -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=n/f3eUv2sIKxtHeZQGtgqCjp/BjuqrxivPHJohdKL1Y=; b=1oJrao02QTOsetX3uPh5qETy7JC0DRf2MjiwHjoxMwU4OxyCtyiyEPkKLQvVQeOsK4 W7R1MVJ8B0RSI32PF0Ni9Qak98Ubc4FMXWGV0sqCgwcu1/6hv/jfrCxj9L244d0ZzviR ftBSNLQwExvqOfiKKJHFI79OymKOpRM2mPh+4z7gUuGBYqwwX0oK/dcg0lpxdWrahHed LON/oAYhtLGRrVDGASSGjxiQu+O/Iel1sExddoKOevrUexqeOEslj4ttcC7Gyko7EKTn ZxpyL0IWhzEOqVFhhAIyuzF7vCyR/xQoekXfq/h8gIaQIF5cfJthf+HwXkz9iv3jYqkj D7HA== 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=n/f3eUv2sIKxtHeZQGtgqCjp/BjuqrxivPHJohdKL1Y=; b=JOeC0EEDGPJi25AljgLTl7Em1nL6I62JZJZQI/t6xYENrRwKjAnL58RJ+C4ECfGp2j irXsFCTR8K4ZekvT6N8zgc3zA5FvzeYR/PlKgtQYjcAGN/RbC88Vw/Fsrk2/pqkMktyo b53zNEgul/2k3rdjLkT3WcskMYJ3L3mw7+wM0iWX2xqS54NtTjG+IKr5E5IZcT0LLY1r 4M+hUBrdi4dk8Jsq08m7ea04yhpaKQMYP+ZCR06k0tP1IjwmcEwGP2z/Wspk6KQYKjpP Qtpa+GRXA9HMD5NZspbQbU0atv4yKBMS1qhkq/z5Yd+LkH3hiE8PjHn8sKh9I0hZfe05 aEsA== X-Gm-Message-State: ALQs6tA3RZpq3R0BrkpKl7l7fCwkhLcxwXvBPYmub6OGcr0fcJzld2Zt kRjUeNyFZXO0M3sUmtIPxG4eAf2785w= X-Google-Smtp-Source: AIpwx4+xdFwJqKZoPFokQTCPGBNDEqtC3ngmPWDVDtw+N+k1IsEUxEWzMDLlsPU/dQIIxZ6btOEwKQ== X-Received: by 10.98.77.2 with SMTP id a2mr28494089pfb.213.1524671814259; Wed, 25 Apr 2018 08:56:54 -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.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Apr 2018 08:56:52 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 25 Apr 2018 08:56:40 -0700 Message-Id: <20180425155646.3627-5-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 04/10] net/ring: 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:56 -0000 Signed-off-by: Stephen Hemminger --- drivers/net/ring/rte_eth_ring.c | 46 ++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index e53823adb3e5..0581ab216cd4 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -63,6 +63,12 @@ static struct rte_eth_link pmd_link = { .link_autoneg = ETH_LINK_AUTONEG }; +static int eth_ring_logtype; + +#define PMD_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, eth_ring_logtype, \ + "%s(): " fmt "\n", __func__, ##args) + static uint16_t eth_ring_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) { @@ -256,7 +262,7 @@ do_eth_dev_ring_create(const char *name, void **tx_queues_local = NULL; unsigned i; - RTE_LOG(INFO, PMD, "Creating rings-backed ethdev on numa socket %u\n", + PMD_LOG(INFO, "Creating rings-backed ethdev on numa socket %u", numa_node); rx_queues_local = rte_zmalloc_socket(name, @@ -446,13 +452,13 @@ static int parse_kvlist (const char *key __rte_unused, const char *value, void * ret = -EINVAL; if (!name) { - RTE_LOG(WARNING, PMD, "command line parameter is empty for ring pmd!\n"); + PMD_LOG(WARNING, "command line parameter is empty for ring pmd!"); goto out; } node = strchr(name, ':'); if (!node) { - RTE_LOG(WARNING, PMD, "could not parse node value from %s\n", + PMD_LOG(WARNING, "could not parse node value from %s", name); goto out; } @@ -462,7 +468,7 @@ static int parse_kvlist (const char *key __rte_unused, const char *value, void * action = strchr(node, ':'); if (!action) { - RTE_LOG(WARNING, PMD, "could not parse action value from %s\n", + PMD_LOG(WARNING, "could not parse action value from %s", node); goto out; } @@ -485,7 +491,8 @@ static int parse_kvlist (const char *key __rte_unused, const char *value, void * info->list[info->count].node = strtol(node, &end, 10); if ((errno != 0) || (*end != '\0')) { - RTE_LOG(WARNING, PMD, "node value %s is unparseable as a number\n", node); + PMD_LOG(WARNING, + "node value %s is unparseable as a number", node); goto out; } @@ -529,14 +536,14 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev) name = rte_vdev_device_name(dev); params = rte_vdev_device_args(dev); - RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name); + PMD_LOG(INFO, "Initializing pmd_ring for %s", name); if (params == NULL || params[0] == '\0') { ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE, ð_dev); if (ret == -1) { - RTE_LOG(INFO, PMD, - "Attach to pmd_ring for %s\n", name); + PMD_LOG(INFO, + "Attach to pmd_ring for %s", name); ret = eth_dev_ring_create(name, rte_socket_id(), DEV_ATTACH, ð_dev); } @@ -544,13 +551,13 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev) kvlist = rte_kvargs_parse(params, valid_arguments); if (!kvlist) { - RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating" - " rings-backed ethernet device\n"); + PMD_LOG(INFO, "Ignoring unsupported parameters when creating" + " rings-backed ethernet device"); ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE, ð_dev); if (ret == -1) { - RTE_LOG(INFO, PMD, - "Attach to pmd_ring for %s\n", + PMD_LOG(INFO, + "Attach to pmd_ring for %s", name); ret = eth_dev_ring_create(name, rte_socket_id(), DEV_ATTACH, ð_dev); @@ -604,8 +611,8 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev) ð_dev); if ((ret == -1) && (info->list[info->count].action == DEV_CREATE)) { - RTE_LOG(INFO, PMD, - "Attach to pmd_ring for %s\n", + PMD_LOG(INFO, + "Attach to pmd_ring for %s", name); ret = eth_dev_ring_create(name, info->list[info->count].node, @@ -634,7 +641,7 @@ rte_pmd_ring_remove(struct rte_vdev_device *dev) struct ring_queue *r = NULL; uint16_t i; - RTE_LOG(INFO, PMD, "Un-Initializing pmd_ring for %s\n", name); + PMD_LOG(INFO, "Un-Initializing pmd_ring for %s", name); if (name == NULL) return -EINVAL; @@ -675,3 +682,12 @@ RTE_PMD_REGISTER_VDEV(net_ring, pmd_ring_drv); RTE_PMD_REGISTER_ALIAS(net_ring, eth_ring); RTE_PMD_REGISTER_PARAM_STRING(net_ring, ETH_RING_NUMA_NODE_ACTION_ARG "=name:node:action(ATTACH|CREATE)"); + +RTE_INIT(eth_ring_init_log); +static void +eth_ring_init_log(void) +{ + eth_ring_logtype = rte_log_register("pmd.net.ring"); + if (eth_ring_logtype >= 0) + rte_log_set_level(eth_ring_logtype, RTE_LOG_NOTICE); +} -- 2.17.0