From patchwork Wed Nov 6 09:48:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hangbin Liu X-Patchwork-Id: 11229843 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 41BA0112B for ; Wed, 6 Nov 2019 09:49:32 +0000 (UTC) Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 207832178F for ; Wed, 6 Nov 2019 09:49:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 207832178F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=libteam-bounces@lists.fedorahosted.org Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id 99E066069BFF; Wed, 6 Nov 2019 09:49:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 99E066069BFF Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 9144E5AA79C74; Wed, 6 Nov 2019 09:49:31 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id B08205AA79C93; Wed, 6 Nov 2019 09:49:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mailman01.phx2.fedoraproject.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=disabled version=3.4.0 Received: from smtp-mm-ib01.fedoraproject.org (smtp-mm-ib01.vpn.fedoraproject.org [192.168.1.83]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 6985D5AA79C7E for ; Wed, 6 Nov 2019 09:49:21 +0000 (UTC) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id F0EDE605D243 for ; Wed, 6 Nov 2019 09:49:20 +0000 (UTC) Received: by mail-pf1-f194.google.com with SMTP id q26so18427253pfn.11 for ; Wed, 06 Nov 2019 01:49:20 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=BqSXO84q2mYIFP1qSeZ2xheoEWMtP5vr6U3n+YCKcXM=; b=DEI1OE+HKd+GByRNZNZTSflVAw7OhuMEVZoL7rpPx/paa2bpt1wOrWm81kljW8FAsu tPysrmc2I5xKOMLHRuatNd4jRCBe/HakKYwDYo+fM3rmpWu+AkMRHeTzJ2t9jzgBhAyX MwZuzoQmNaAsVIfQqgNgNUGHv+ZvJtbvKToMCFD+tF8mGtAZ/v+D5aCRu+j/LensHE5p xieE/yAnkofaTInrGiF9N/U+iWc0zN2AVp+o6+e3TEVcGsiF4MJyB0BOr1vHZKvfCHXl zQZxWbVlUhnqHJh3sS7m+8YOiWmHAlj9FKvLorSEijzgv7XPHIYrOsW6Y8vDi5nWT67+ KyvA== X-Gm-Message-State: APjAAAXQC8ieyruO38tixHPJ6Ad7DFBGaw/WpItKNv/f3EmjwC5ruI6l jtO3WY0y7Il4w9D9ayPUQxb0n6MyKP/sKg== X-Google-Smtp-Source: APXvYqyezmYtiqqkzfxXOl481OUm6tX+SVfr41QEiVzbEo+PqpklK8BropO1aT/oWm1xas2aSxPKPg== X-Received: by 2002:a17:90a:1782:: with SMTP id q2mr2579176pja.57.1573033759706; Wed, 06 Nov 2019 01:49:19 -0800 (PST) Received: from dhcp-12-139.nay.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id j11sm22249238pgk.3.2019.11.06.01.49.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Nov 2019 01:49:19 -0800 (PST) From: Hangbin Liu To: libteam@lists.fedorahosted.org Subject: [libteam PATCH 4/6] teamd/teamd_runner_lacp.c: move teamd_log_dbg to teamd_log_dbgx Date: Wed, 6 Nov 2019 17:48:53 +0800 Message-Id: <20191106094855.13859-5-liuhangbin@gmail.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20191106094855.13859-1-liuhangbin@gmail.com> References: <20191106094855.13859-1-liuhangbin@gmail.com> MIME-Version: 1.0 Message-ID-Hash: T4RXMEESQGHB3NWK3ZQTDMLGI64FB5WM X-Message-ID-Hash: T4RXMEESQGHB3NWK3ZQTDMLGI64FB5WM X-MailFrom: liuhangbin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Hangbin Liu , Jiri Pirko X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: As libdaemon do not filter log messages when we use syslog as output, all debug messages will be printed to the syslog even if we set daemon_verbosity_level to LOG_INFO. This would make user full confused and annoying. Since we have a -g option to enable debug message specially, let's move all teamd_log_dbg to teamd_log_dbgx so user could choose to print debug message or not. This patch will move all teamd_log_dbg to teamd_log_dbgx for teamd_runner_lacp.c Signed-off-by: Hangbin Liu --- teamd/teamd_runner_lacp.c | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c index d292d69..43b060e 100644 --- a/teamd/teamd_runner_lacp.c +++ b/teamd/teamd_runner_lacp.c @@ -254,7 +254,7 @@ static int lacp_load_config(struct teamd_context *ctx, struct lacp *lacp) err = teamd_config_bool_get(ctx, &lacp->cfg.active, "$.runner.active"); if (err) lacp->cfg.active = LACP_CFG_DFLT_ACTIVE; - teamd_log_dbg("Using active \"%d\".", lacp->cfg.active); + teamd_log_dbgx(ctx, 1, "Using active \"%d\".", lacp->cfg.active); err = teamd_config_int_get(ctx, &tmp, "$.runner.sys_prio"); if (err) { @@ -265,12 +265,12 @@ static int lacp_load_config(struct teamd_context *ctx, struct lacp *lacp) } else { lacp->cfg.sys_prio = tmp; } - teamd_log_dbg("Using sys_prio \"%d\".", lacp->cfg.sys_prio); + teamd_log_dbgx(ctx, 1, "Using sys_prio \"%d\".", lacp->cfg.sys_prio); err = teamd_config_bool_get(ctx, &lacp->cfg.fast_rate, "$.runner.fast_rate"); if (err) lacp->cfg.fast_rate = LACP_CFG_DFLT_FAST_RATE; - teamd_log_dbg("Using fast_rate \"%d\".", lacp->cfg.fast_rate); + teamd_log_dbgx(ctx, 1, "Using fast_rate \"%d\".", lacp->cfg.fast_rate); err = teamd_config_int_get(ctx, &tmp, "$.runner.min_ports"); if (err) { @@ -281,7 +281,7 @@ static int lacp_load_config(struct teamd_context *ctx, struct lacp *lacp) } else { lacp->cfg.min_ports = tmp; } - teamd_log_dbg("Using min_ports \"%d\".", lacp->cfg.min_ports); + teamd_log_dbgx(ctx, 1, "Using min_ports \"%d\".", lacp->cfg.min_ports); err = teamd_config_string_get(ctx, &agg_select_policy_name, "$.runner.agg_select_policy"); if (err) @@ -292,7 +292,7 @@ static int lacp_load_config(struct teamd_context *ctx, struct lacp *lacp) agg_select_policy_name); return err; } - teamd_log_dbg("Using agg_select_policy \"%s\".", + teamd_log_dbgx(ctx, 1, "Using agg_select_policy \"%s\".", lacp_get_agg_select_policy_name(lacp)); return 0; } @@ -634,8 +634,8 @@ static void lacp_switch_agg_lead(struct lacp_port *agg_lead, struct teamd_port *tdport; struct lacp_port *lacp_port; - teamd_log_dbg("Renaming aggregator %u to %u", - lacp_agg_id(agg_lead), lacp_agg_id(new_agg_lead)); + teamd_log_dbgx(new_agg_lead->ctx, 1, "Renaming aggregator %u to %u", + lacp_agg_id(agg_lead), lacp_agg_id(new_agg_lead)); if (lacp->selected_agg_lead == agg_lead) lacp->selected_agg_lead = new_agg_lead; teamd_for_each_tdport(tdport, lacp->ctx) { @@ -649,13 +649,13 @@ static void lacp_port_agg_select(struct lacp_port *lacp_port) { struct lacp_port *agg_lead; - teamd_log_dbg("%s: Selecting LACP port", lacp_port->tdport->ifname); + teamd_log_dbgx(lacp_port->ctx, 1, "%s: Selecting LACP port", lacp_port->tdport->ifname); agg_lead = lacp_get_agg_lead(lacp_port); lacp_port->agg_lead = agg_lead; if (lacp_port_better(lacp_port, agg_lead)) lacp_switch_agg_lead(agg_lead, lacp_port); - teamd_log_dbg("%s: LACP port selected into aggregator %u", - lacp_port->tdport->ifname, lacp_port_agg_id(lacp_port)); + teamd_log_dbgx(lacp_port->ctx, 1, "%s: LACP port selected into aggregator %u", + lacp_port->tdport->ifname, lacp_port_agg_id(lacp_port)); } static struct lacp_port *lacp_find_new_agg_lead(struct lacp_port *old_agg_lead) @@ -677,9 +677,9 @@ static void lacp_port_agg_unselect(struct lacp_port *lacp_port) { struct lacp_port *agg_lead = lacp_port->agg_lead; - teamd_log_dbg("%s: Unselecting LACP port", lacp_port->tdport->ifname); - teamd_log_dbg("%s: LACP port unselected from aggregator %u", - lacp_port->tdport->ifname, lacp_port_agg_id(lacp_port)); + teamd_log_dbgx(lacp_port->ctx, 1, "%s: Unselecting LACP port", lacp_port->tdport->ifname); + teamd_log_dbgx(lacp_port->ctx, 1, "%s: LACP port unselected from aggregator %u", + lacp_port->tdport->ifname, lacp_port_agg_id(lacp_port)); lacp_port->agg_lead = NULL; if (lacp_port == agg_lead) { /* In case currently unselected port is aggregator lead lead, @@ -715,8 +715,8 @@ static int lacp_selected_agg_update(struct lacp *lacp, if (!next_agg_lead) next_agg_lead = lacp_get_next_agg(lacp); if (lacp->selected_agg_lead != next_agg_lead) - teamd_log_dbg("Selecting aggregator %u", - lacp_agg_id(next_agg_lead)); + teamd_log_dbgx(lacp->ctx, 1, "Selecting aggregator %u", + lacp_agg_id(next_agg_lead)); lacp->selected_agg_lead = next_agg_lead; err = lacp_ports_update_enabled(lacp); @@ -827,8 +827,8 @@ static int lacp_port_periodic_set(struct lacp_port *lacp_port) int fast_on; fast_on = lacp_port->partner.state & INFO_STATE_LACP_TIMEOUT; - teamd_log_dbg("%s: Setting periodic timer to \"%s\".", - lacp_port->tdport->ifname, fast_on ? "fast": "slow"); + teamd_log_dbgx(lacp_port->ctx, 1, "%s: Setting periodic timer to \"%s\".", + lacp_port->tdport->ifname, fast_on ? "fast": "slow"); ms = fast_on ? LACP_PERIODIC_SHORT: LACP_PERIODIC_LONG; ms_to_timespec(&ts, ms); err = teamd_loop_callback_timer_set(lacp_port->ctx, @@ -929,8 +929,8 @@ static void lacp_port_actor_update(struct lacp_port *lacp_port) state |= INFO_STATE_DEFAULTED; if (teamd_port_count(lacp_port->ctx) > 0) state |= INFO_STATE_AGGREGATION; - teamd_log_dbg("%s: lacp info state: 0x%02X.", lacp_port->tdport->ifname, - state); + teamd_log_dbgx(lacp_port->ctx, 1, "%s: lacp info state: 0x%02X.", + lacp_port->tdport->ifname, state); lacp_port->actor.state = state; } @@ -1198,7 +1198,7 @@ static int lacp_port_load_config(struct teamd_context *ctx, } else { lacp_port->cfg.lacp_prio = tmp; } - teamd_log_dbg("%s: Using lacp_prio \"%d\".", port_name, + teamd_log_dbgx(ctx, 1, "%s: Using lacp_prio \"%d\".", port_name, lacp_port->cfg.lacp_prio); err = teamd_config_int_get(ctx, &tmp, @@ -1212,14 +1212,14 @@ static int lacp_port_load_config(struct teamd_context *ctx, } else { lacp_port->cfg.lacp_key = tmp; } - teamd_log_dbg("%s: Using lacp_key \"%d\".", port_name, + teamd_log_dbgx(ctx, 1, "%s: Using lacp_key \"%d\".", port_name, lacp_port->cfg.lacp_key); err = teamd_config_bool_get(ctx, &lacp_port->cfg.sticky, "$.ports.%s.sticky", port_name); if (err) lacp_port->cfg.sticky = LACP_PORT_CFG_DFLT_STICKY; - teamd_log_dbg("%s: Using sticky \"%d\".", port_name, + teamd_log_dbgx(ctx, 1, "%s: Using sticky \"%d\".", port_name, lacp_port->cfg.sticky); return 0; }