From nobody Mon Aug 01 08:57:31 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LxBpM2FXDz4Y2Ld; Mon, 1 Aug 2022 08:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LxBpM1n58z3Y87; Mon, 1 Aug 2022 08:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659344251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HuTCxDGShYoGhwr3e053LW/l73qycDnTLpLt8FpoVx0=; b=PsLRvqg5hLkvVMSc3JBfee5EtJcFzvg8q18Ev/bFxVEJY7Z37X5lfMnYU3EHdZW0wJIpFA nPnqZOafkDwOpdaOYwykUgStivzAPwtOZPGA5Pfvd7DmVIA7p/4F+YFi3ssGOayTvyaWw5 74fS5tCMujiCU8k5OTgOR82HJgeNqPBhapT2IDvwzL+LHpaGbmuXL7P4I/okSJt6GoZgy5 kXwyGZUrRSH5efUP4iJAOvIeSacmcd6/x6t2RL9qSgZojNsgaWBnBnkcqXpU4JyWgsSrxd 3aP3OEoTLaF8Dz/XLSGYe09QHB0JDaQGEr1DmU7laDPa5ENSC/O4lavBThEEzg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4LxBpM0pSyzSMl; Mon, 1 Aug 2022 08:57:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2718vVk5091136; Mon, 1 Aug 2022 08:57:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2718vV2M091135; Mon, 1 Aug 2022 08:57:31 GMT (envelope-from git) Date: Mon, 1 Aug 2022 08:57:31 GMT Message-Id: <202208010857.2718vV2M091135@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 5c23343b8c0c - main - routing: convert remnants of DPRINTF to FIB_CTL_LOG(). List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c23343b8c0cc018f06a4a2cb2d911770bdc8ee2 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1659344251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HuTCxDGShYoGhwr3e053LW/l73qycDnTLpLt8FpoVx0=; b=tpUr48Bhjm5GJAH/w5jsY/nIjEKoIZSjOhyc1Hae5abZ2eNtxVw/uiMiLCtBFrai1KcDFO ZVdI1jdKrWucv6qJuy1kXpi6KAbeOa2HWbRsWOwzRgBHtwVHNgPCYBcL1ndN8VC1t916Vk 9bnMS6WMhTZGCNbFMplbnJy02jgAwRMkfYMkz8Xo2Iua0xzfGaMnhn3DHY/ysCzb1T20AT wIDECOsbcRUC2zIPWnP4vQi50OA8gRBO7NIIauo0UvaD9awrAmQk+Wl5Nqv7cq/xT2Kkxq PWKBWKr/pXT4CUsNq9Iv6Axl2G/K2M3zKUmVF9wnuYL3b/xJE582R4ucyZk2zg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1659344251; a=rsa-sha256; cv=none; b=pDTJUdUEDCPoKKqrollQbr08FV2THK7B5U8IBFWKnVWKrkBD0EADh9TBjsp8m7ubDnmr8k Kkl57VrWbvdZSYIjmZx5MafiIsYYa8DBnHRlBT9QLxTCbjkk9CFz2Djw+wmEF2VsC0mcXR ydrfvnU5fFARQ0SXJK3fameumz2vC5yafGbOTmLoGPjSSNswzT9WWwEhXvuqLZXQHabysU EHXI4DzRS0CMWAT33gk+cxt7IjDaEjPyrTZxzWMC2KkxXIfCk7VHvavkBceIFFFIfnryl0 HcHtaYl1CvCTE+xWdP0thMGpH64AgnqLgJ8fZgCRAapfpJa5rIuBYydeixnZbw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=5c23343b8c0cc018f06a4a2cb2d911770bdc8ee2 commit 5c23343b8c0cc018f06a4a2cb2d911770bdc8ee2 Author: Alexander V. Chernikov AuthorDate: 2022-07-29 17:41:16 +0000 Commit: Alexander V. Chernikov CommitDate: 2022-08-01 08:55:07 +0000 routing: convert remnants of DPRINTF to FIB_CTL_LOG(). Convert the last remaining pieces of old-style debug messages to the new debugging framework. Differential Revision: https://reviews.freebsd.org/D35994 MFC after: 2 weeks --- sys/net/route/nhop.c | 41 ++++++++++++++++++++++++++--------------- sys/net/route/route_debug.h | 2 ++ sys/net/route/route_helpers.c | 2 -- sys/net/route/route_var.h | 6 ------ 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/sys/net/route/nhop.c b/sys/net/route/nhop.c index 843ef64bb141..36e5179628a8 100644 --- a/sys/net/route/nhop.c +++ b/sys/net/route/nhop.c @@ -48,6 +48,11 @@ __FBSDID("$FreeBSD$"); #include #include +#define DEBUG_MOD_NAME nhop +#define DEBUG_MAX_LEVEL LOG_DEBUG +#include +_DECLARE_DEBUG(LOG_INFO); + /* * This file contains data structures management logic for the nexthop ("nhop") * route subsystem. @@ -99,8 +104,7 @@ nhops_init_rib(struct rib_head *rh) rh->nh_control = ctl; ctl->ctl_rh = rh; - DPRINTF("NHOPS init for fib %u af %u: ctl %p rh %p", rh->rib_fibnum, - rh->rib_family, ctl, rh); + FIB_CTL_LOG(LOG_DEBUG2, ctl, "nhops init: ctl %p rh %p", ctl, rh); return (0); } @@ -154,7 +158,7 @@ nhops_destroy_rib(struct rib_head *rh) NHOPS_WLOCK(ctl); CHT_SLIST_FOREACH(&ctl->nh_head, nhops, nh_priv) { - DPRINTF("Marking nhop %u unlinked", nh_priv->nh_idx); + FIB_RH_LOG(LOG_DEBUG3, rh, "marking nhop %u unlinked", nh_priv->nh_idx); refcount_release(&nh_priv->nh_linked); } CHT_SLIST_FOREACH_END; #ifdef ROUTE_MPATH @@ -251,8 +255,9 @@ consider_resize(struct nh_control *ctl, uint32_t new_nh_buckets, uint32_t new_id return; } - DPRINTF("going to resize: nh:[ptr:%p sz:%u] idx:[ptr:%p sz:%u]", nh_ptr, - new_nh_buckets, nh_idx_ptr, new_idx_items); + FIB_CTL_LOG(LOG_DEBUG, ctl, + "going to resize: nh:[ptr:%p sz:%u] idx:[ptr:%p sz:%u]", + nh_ptr, new_nh_buckets, nh_idx_ptr, new_idx_items); old_idx_ptr = NULL; @@ -296,7 +301,7 @@ link_nhop(struct nh_control *ctl, struct nhop_priv *nh_priv) if (bitmask_alloc_idx(&ctl->nh_idx_head, &idx) != 0) { NHOPS_WUNLOCK(ctl); - DPRINTF("Unable to allocate nhop index"); + FIB_CTL_LOG(LOG_INFO, ctl, "Unable to allocate nhop index"); RTSTAT_INC(rts_nh_idx_alloc_failure); consider_resize(ctl, num_buckets_new, num_items_new); return (0); @@ -310,8 +315,9 @@ link_nhop(struct nh_control *ctl, struct nhop_priv *nh_priv) NHOPS_WUNLOCK(ctl); - DPRINTF("Linked nhop priv %p to %d, hash %u, ctl %p", nh_priv, idx, - hash_priv(nh_priv), ctl); + FIB_RH_LOG(LOG_DEBUG2, ctl->ctl_rh, + "Linked nhop priv %p to %d, hash %u, ctl %p", + nh_priv, idx, hash_priv(nh_priv), ctl); consider_resize(ctl, num_buckets_new, num_items_new); return (idx); @@ -340,9 +346,9 @@ unlink_nhop(struct nh_control *ctl, struct nhop_priv *nh_priv_del) KASSERT((idx != 0), ("bogus nhop index 0")); if ((bitmask_free_idx(&ctl->nh_idx_head, idx)) != 0) { - DPRINTF("Unable to remove index %d from fib %u af %d", - idx, ctl->ctl_rh->rib_fibnum, - ctl->ctl_rh->rib_family); + FIB_CTL_LOG(LOG_DEBUG, ctl, + "Unable to remove index %d from fib %u af %d", + idx, ctl->ctl_rh->rib_fibnum, ctl->ctl_rh->rib_family); } } @@ -351,12 +357,17 @@ unlink_nhop(struct nh_control *ctl, struct nhop_priv *nh_priv_del) num_items_new = bitmask_get_resize_items(&ctl->nh_idx_head); NHOPS_WUNLOCK(ctl); + FIB_CTL_LOG(LOG_INFO, ctl, "Unable to unlink nhop priv %p from hash, hash %u ctl %p", + nh_priv_del, hash_priv(nh_priv_del), ctl); - if (priv_ret == NULL) - DPRINTF("Unable to unlink nhop priv %p from hash, hash %u ctl %p", + if (priv_ret == NULL) { + FIB_CTL_LOG(LOG_INFO, ctl, + "Unable to unlink nhop priv %p from hash, hash %u ctl %p", nh_priv_del, hash_priv(nh_priv_del), ctl); - else - DPRINTF("Unlinked nhop %p priv idx %d", priv_ret, idx); + } else { + FIB_CTL_LOG(LOG_DEBUG2, ctl, "Unlinked nhop %p priv idx %d", + priv_ret, idx); + } consider_resize(ctl, num_buckets_new, num_items_new); diff --git a/sys/net/route/route_debug.h b/sys/net/route/route_debug.h index 30d2a1c9a99f..de80bd1ea78b 100644 --- a/sys/net/route/route_debug.h +++ b/sys/net/route/route_debug.h @@ -96,6 +96,8 @@ #define FIB_NH_LOG(_l, _nh, _fmt, ...) FIB_LOG_##_l(_l, nhop_get_fibnum(_nh), nhop_get_upper_family(_nh), _fmt, ## __VA_ARGS__) /* Same as FIB_LOG, but uses rib_head to get fib and family */ #define FIB_RH_LOG(_l, _rh, _fmt, ...) FIB_LOG_##_l(_l, (_rh)->rib_fibnum, (_rh)->rib_family, _fmt, ## __VA_ARGS__) +/* Same as FIB_LOG, but uses nh_control to get fib and family from linked rib */ +#define FIB_CTL_LOG(_l, _ctl, _fmt, ...) FIB_LOG_##_l(_l, (_ctl)->ctl_rh->rib_fibnum, (_ctl)->ctl_rh->rib_family, _fmt, ## __VA_ARGS__) /* * Generic logging for routing subsystem diff --git a/sys/net/route/route_helpers.c b/sys/net/route/route_helpers.c index 001ebc5e388b..6c7f16eb047e 100644 --- a/sys/net/route/route_helpers.c +++ b/sys/net/route/route_helpers.c @@ -383,8 +383,6 @@ rib_decompose_notification(struct rib_cmd_info *rc, route_notification_t *cb, struct rib_cmd_info rc_new; rc_new = *rc; - DPRINTF("cb=%p cmd=%d nh_old=%p nh_new=%p", - cb, rc->cmd, rc->nh_old, rc->nh_new); switch (rc->rc_cmd) { case RTM_ADD: if (!NH_IS_NHGRP(rc->rc_nh_new)) diff --git a/sys/net/route/route_var.h b/sys/net/route/route_var.h index 740729ecb415..e54ea08f4e80 100644 --- a/sys/net/route/route_var.h +++ b/sys/net/route/route_var.h @@ -41,12 +41,6 @@ #include #include -#ifdef RTDEBUG -#define DPRINTF(_fmt, ...) printf("%s: " _fmt "\n", __func__ , ## __VA_ARGS__) -#else -#define DPRINTF(_fmt, ...) -#endif - struct nh_control; /* Sets prefix-specific nexthop flags (NHF_DEFAULT, RTF/NHF_HOST, RTF_BROADCAST,..) */ typedef int rnh_set_nh_pfxflags_f_t(u_int fibnum, const struct sockaddr *addr,