From patchwork Tue Nov 12 21:47:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 62910 X-Patchwork-Delegate: maxime.coquelin@redhat.com 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 C2925A0353; Tue, 12 Nov 2019 22:47:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1556F44C3; Tue, 12 Nov 2019 22:47:15 +0100 (CET) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id A9D979E4 for ; Tue, 12 Nov 2019 22:47:13 +0100 (CET) Received: by mail-pf1-f196.google.com with SMTP id 3so14271pfb.10 for ; Tue, 12 Nov 2019 13:47:13 -0800 (PST) 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:mime-version :content-transfer-encoding; bh=G66kMmeO2Nzw58MeDpBkX9a8zZzGzH5S7bujG+65I1U=; b=iC3RTDw9iijVA0AL9cwrujrAJaahS9HIuIvdudQHdnHfy0WDnjtEw57d46RRgXcYFm ugttutJDm+rk828tMd88AOhKoAp4dFdyseYanTT8j6m5StFeuP02OWqDX57QtLa+CFXd Mz6DIbsaAWNknds8e64vdjxSwTNFK8gHgx2Jt4gAL077k79lXOW6nWgHEHRGuaY7qK9m 8pE6c0M1br11x9OyQVYWhQnidtE8ZLDwNoL1BydGnVHzaOle6kzlDQBJ55ozh+pimGnW G9nV4sJCdFcSbYHlc0zPA+Vy5t71UMqVRcs2s1zavF55TA/Zmq/0EdJ4+W7xF8zqpvWX LHNg== 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:mime-version :content-transfer-encoding; bh=G66kMmeO2Nzw58MeDpBkX9a8zZzGzH5S7bujG+65I1U=; b=UoZTXkHOclw4V3cWVUwUpqPV0EsR/sP+qUdNhHSFjSxiaf3W8HKG+MhUp9OodPh4Pd r0rCw/MXNsCpAUUsaz32QBnmum3DH3BLrJ8pfD6V0hrwaUu6zD54ZGAXXE8aPUqDkVZA c1LBDUc2lUUD2sLVlsVwrUF3AFEfXA0v8DtAXTOLUPR0A4PpyNowD8yOAQiHKop+B7eO SrLHyJoyPaFKQ0w9LZJelRQeKjbmxFAlbxeTMZw3PO9UbFNI/8C8hevS0zpPiASYlqvq sUCvrU9lA8vYiB3QLcjVSvf25GZX04vEMxG8nJFYQI+kxEpJxHYN+aMFuX74EAp5iHtD H3xA== X-Gm-Message-State: APjAAAUAy6Ju4JdaOW4stSHlYfOGoL86TPklCYF4KOKlur41GET5w4MR 6FUeVletzYXqiOU2HY3H8DEPBw== X-Google-Smtp-Source: APXvYqwFTKUwD0KKCAfkQP+nKepYLUN6K2siAx1G3riDoY6qYky49S5yRX80fcI8wLee7YjbkuyCXQ== X-Received: by 2002:a63:2506:: with SMTP id l6mr20521535pgl.131.1573595232541; Tue, 12 Nov 2019 13:47:12 -0800 (PST) Received: from shemminger-XPS-13-9360.wiline.com (67-207-105-98.static.wiline.com. [67.207.105.98]) by smtp.gmail.com with ESMTPSA id l74sm68607pje.29.2019.11.12.13.47.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Nov 2019 13:47:11 -0800 (PST) From: Stephen Hemminger To: maxime.coquelin@redhat.com Cc: dev@dpdk.org, Stephen Hemminger Date: Tue, 12 Nov 2019 13:47:09 -0800 Message-Id: <20191112214709.30953-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] vhost: use dynamic log type 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" Rather than overloading USER1 and USER2 logtypes, use a DPDK dynamic log type. Signed-off-by: Stephen Hemminger --- lib/librte_vhost/vhost.c | 12 ++++++++++++ lib/librte_vhost/vhost.h | 5 +++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c index 1cbe948f7470..9149770a16f5 100644 --- a/lib/librte_vhost/vhost.c +++ b/lib/librte_vhost/vhost.c @@ -27,6 +27,8 @@ struct virtio_net *vhost_devices[MAX_VHOST_DEVICE]; +int vhost_logtype_config, vhost_logtype_data; + /* Called with iotlb_lock read-locked */ uint64_t __vhost_iova_to_vva(struct virtio_net *dev, struct vhost_virtqueue *vq, @@ -1457,3 +1459,13 @@ int rte_vhost_extern_callback_register(int vid, dev->extern_data = ctx; return 0; } + +RTE_INIT(rte_vhost_init_log) +{ + vhost_logtype_config = rte_log_register("lib.vhost.config"); + if (vhost_logtype_config >= 0) + rte_log_set_level(vhost_logtype_config, RTE_LOG_NOTICE); + vhost_logtype_data = rte_log_register("lib.vhost.data"); + if (vhost_logtype_data >= 0) + rte_log_set_level(vhost_logtype_data, RTE_LOG_NOTICE); +} diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h index 9f11b28a31bf..87ce24991c26 100644 --- a/lib/librte_vhost/vhost.h +++ b/lib/librte_vhost/vhost.h @@ -499,8 +499,9 @@ vhost_log_write_iova(struct virtio_net *dev, struct vhost_virtqueue *vq, } /* Macros for printing using RTE_LOG */ -#define RTE_LOGTYPE_VHOST_CONFIG RTE_LOGTYPE_USER1 -#define RTE_LOGTYPE_VHOST_DATA RTE_LOGTYPE_USER1 +extern int vhost_logtype_config, vhost_logtype_data; +#define RTE_LOGTYPE_VHOST_CONFIG vhost_logtype_config +#define RTE_LOGTYPE_VHOST_DATA vhost_logtype_data #ifdef RTE_LIBRTE_VHOST_DEBUG #define VHOST_MAX_PRINT_BUFF 6072