From nobody Fri Jan 13 21:24:56 2023 X-Original-To: dev-commits-src-branches@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 4NtvZd222nz2qksb; Fri, 13 Jan 2023 21:24:57 +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 4NtvZc5XsJz410P; Fri, 13 Jan 2023 21:24:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673645096; 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=CswYo3HE/mV6VBxMXfX8Fk5j4WT1eaJ47clbW5UY31M=; b=j078nCRcXvYls1ita+aS7533gSVrbnHQZ1h1fEL6L8ItvCo9U9lHL54Fm8WF2qeS458k18 r3GnkwzI3aI4GRguaJ0E8HwtOLzCRQut5+f8Q6BpgqKQtgq7c/p5EUcGcxP2RwFtgL0Ykf PVNJPl6oyLG9QXVuZYAFNnrdXS8VEiEiVshQhxrnOONXE0Q2BpOQMDSmRrPfEntQk8gvL6 GoBAAU5Tnu3KwVYu92tZ2tY6+HHZ92JQQPGoVNTWr8qzQfgDfwqqb64SYSK7QqANP8ukmZ 9KekResXUuUQUZp8NGmKJUnBMrSuQl4VeOFKXW/ghxDbA1ppXb8GzV08naQaag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673645096; 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=CswYo3HE/mV6VBxMXfX8Fk5j4WT1eaJ47clbW5UY31M=; b=G15isf+DJD1DFGTVX9z/XpMUlFwbK3BEx4q5adUqDcwQ1FESVi9aldicwpBh8YuErhVvTP NRPi2dMbsSbw4lrHZD0bdFYGRDaOt/KLcAAA/q860g79gZTmXA4o4KpvY7uAKsVx/PDTv2 yAvUTdPq1r5b5zvOuxz/7nU6pPQug56AhHUyX7CvcdOGKTgGZyRVwqP2sHob7lTc1tEptm wSMK0VbVr5Vru97yxQ0Ja03JyQxLVzaVzZ+MpY8yyKES9PyfzmkLbgtoBkF2MH6qmAmcy/ CemTbOf+UCvUSX4EMpGsU610SFG+Eu6NcBt0Ci8uaTHcm9XXMFLmsZ+jRRP78g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673645096; a=rsa-sha256; cv=none; b=Puc/NuAycuAkOdrE6xuEa+ZIbo7NmZdB+X2Xq6n2mCEOdHDXMkwUXfeMXcE6dvIjiSE3oa EqztbEYuP6fmt1RANpEzR1MLtY8kjuN8bUycpGD0E3mnvAZeNCif8TmvGXpjyV3YWKB1JT csTVcD1ykTuFtRrrScqqQ8Rtvmqp+RfsHnR8fVAE0gtzBRq0X6lUgfmHnBdqiHMBqn83mS MxI3p92QFQEkT8E3HaEd0cQ0Uek364qIj+CCxe1DmJuwx0EBUJz/i+hGE5fEdq95Bdu4H2 nyjNZt1+BVmoH7tHry8n2b2kjRDqjYWhL7e8X7BZUbFK6wMhN3o7XmBTvVZrSA== 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 4NtvZc4cpJzMrT; Fri, 13 Jan 2023 21:24:56 +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 30DLOuIS041150; Fri, 13 Jan 2023 21:24:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30DLOuEs041149; Fri, 13 Jan 2023 21:24:56 GMT (envelope-from git) Date: Fri, 13 Jan 2023 21:24:56 GMT Message-Id: <202301132124.30DLOuEs041149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 6c01d35b9c40 - stable/13 - routing: convert remnants of DPRINTF to FIB_CTL_LOG(). List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6c01d35b9c40fb442be48ad1b73bbd5239625143 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=6c01d35b9c40fb442be48ad1b73bbd5239625143 commit 6c01d35b9c40fb442be48ad1b73bbd5239625143 Author: Alexander V. Chernikov AuthorDate: 2022-07-29 17:41:16 +0000 Commit: Alexander V. Chernikov CommitDate: 2023-01-13 21:18:26 +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 (cherry picked from commit 5c23343b8c0cc018f06a4a2cb2d911770bdc8ee2) --- 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 51b4e5bfb3e5..b7154fe69a3d 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 @@ -257,8 +261,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; @@ -302,7 +307,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); @@ -316,8 +321,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); @@ -346,9 +352,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); } } @@ -357,12 +363,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,