From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 745F1436E3; Wed, 13 Dec 2023 17:38:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F2ED640DC9; Wed, 13 Dec 2023 17:38:35 +0100 (CET) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id B2EB94021D for ; Wed, 13 Dec 2023 17:38:33 +0100 (CET) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1d347b4d676so13508815ad.2 for ; Wed, 13 Dec 2023 08:38:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1702485513; x=1703090313; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IJYE7atiLluhYup6T/i2BqkSgYaYiS9xlAetOnk0lBM=; b=SdMSAUNtswu7bc03vNYgF/Hnd2zSlh8fYqaeklzCpT0hc74vy3P6lV5GhW1Lr9Y2pr oRLga1HVKzb5Ue1/XNTzn3sFU48XDsd7CCotNcfYZHWSIhMburxtSj8CQWku35tH/HaD Wt/puZmjBzbrJ9tl1fAn2A0hZ3CfR+o7+9P7MSHfuFbjHgapjHynvqudkRCVWN6YqAzL /HxnmVqtLBZbYHfGdRR6FWQFrnjlOV0rQS47VWiJuzzM+SDQhWFPwhSbmtcUlx/uuNIp 6bp+p2Cxp+C3uzQ4osT5ii/11bbV0f8ES7DlRyoEHYUJU4CJ1+am0XLJaQ/sX4eVOuXr +RQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702485513; x=1703090313; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IJYE7atiLluhYup6T/i2BqkSgYaYiS9xlAetOnk0lBM=; b=cl5b3tPzsxEE+OamnabbpglMrNaxevBKMz9t7VE2No7GKPtiOhJuoPuIHKXdopN9s6 NBqFXzhypDB6w7nlI5osqOkiGBxPJZYg8j3nJ7KE0vB3qWGzcQKTdI6NR5NHZPCGUM+e GGx+DS+d36VZFSe6yLXR0506VpjK61Tr7SprVQMFmjqg43mVlTaNdaKqpGwKlNgcWmXF dNj8FE2AORgnkkc9aJnM2J9f27IPEPhClJFl2K/uDV8Wwhl9C77V8vTadAhyXe8h2Eqh mRXUIX6rTeGMqHZjp2F+1Ta4RWwdtHoFMAaAO/RN04jh7WvwItUqkgwCwT3UyksRCvo3 r7mA== X-Gm-Message-State: AOJu0YxVaDEuBQxCBagRtkRIOahUt8it92xpIUtenz3rVV95HzX9ZOUn LvtznXHBpaWWIwAdhf6u3LCDq3nzmQab0jFt9UQ= X-Google-Smtp-Source: AGHT+IE7GgoEdOR/TAREEDv4mh4JBOX+q9IvuTtHKSgfOJgytrovSzj7saFxU/Gfhk4ZmvNgm6/3sg== X-Received: by 2002:a17:902:7ec1:b0:1d0:7d0b:555c with SMTP id p1-20020a1709027ec100b001d07d0b555cmr7071792plb.10.1702485512965; Wed, 13 Dec 2023 08:38:32 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id 4-20020a170902c24400b001d0a6f31519sm10749593plg.188.2023.12.13.08.38.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 08:38:32 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH v3 02/37] log: add rte_log_dp() Date: Wed, 13 Dec 2023 08:35:36 -0800 Message-ID: <20231213163820.894987-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231213163820.894987-1-stephen@networkplumber.org> References: <20231213014408.612051-1-stephen@networkplumber.org> <20231213163820.894987-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add a new macro for logging in datapath using a logtype. The existing macro RTE_LOG_DP() takes log type suffix (i.e. PMD) like RTE_LOG(). This macro allows using a dynamic type. Ideally, rte_log_dp() could be an always_inline function but GCC and Clang will not inline a function with variable number of arguments. Therefore it has to be a macro. Signed-off-by: Stephen Hemminger --- lib/log/rte_log.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h index bbbb051c20e2..4f69c05db91d 100644 --- a/lib/log/rte_log.h +++ b/lib/log/rte_log.h @@ -355,6 +355,27 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) : \ 0) +/** + * Generates a log message for data path. + * + * Similar to rte_log(), except that it gets optimized away + * if the RTE_LOG_DP_LEVEL configuration option is lower than the log + * level argument. + * + * @param l + * Log level. A value between RTE_LOG_EMERG (1) and RTE_LOG_DEBUG (8). + * @param t + * The log type, for example, RTE_LOGTYPE_EAL. + * @param ... + * The format string, as in printf(3), followed by the variable arguments + * required by the format. + */ +#define rte_log_dp(l, t, ...) \ + do { \ + if ((l) <= RTE_LOG_DP_LEVEL) \ + rte_log(l, t, __VA_ARGS__); \ + } while (0) + #define RTE_LOG_REGISTER_IMPL(type, name, level) \ int type; \ RTE_INIT(__##type) \ -- 2.43.0