Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108552791
D35994.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D35994.diff
View Options
diff --git a/sys/net/route/nhop.c b/sys/net/route/nhop.c
--- a/sys/net/route/nhop.c
+++ b/sys/net/route/nhop.c
@@ -48,6 +48,11 @@
#include <net/route/nhop_var.h>
#include <net/vnet.h>
+#define DEBUG_MOD_NAME nhop
+#define DEBUG_MAX_LEVEL LOG_DEBUG
+#include <net/route/route_debug.h>
+_DECLARE_DEBUG(LOG_INFO);
+
/*
* This file contains data structures management logic for the nexthop ("nhop")
* route subsystem.
@@ -99,8 +104,7 @@
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_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 @@
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 @@
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 @@
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 @@
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 @@
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
--- 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
--- a/sys/net/route/route_helpers.c
+++ b/sys/net/route/route_helpers.c
@@ -383,8 +383,6 @@
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
--- a/sys/net/route/route_var.h
+++ b/sys/net/route/route_var.h
@@ -41,12 +41,6 @@
#include <sys/counter.h>
#include <net/route/nhop.h>
-#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,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 27, 6:48 AM (1 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16188571
Default Alt Text
D35994.diff (4 KB)
Attached To
Mode
D35994: routing: convert remnants of DPRINTF to FIB_CTL_LOG().
Attached
Detach File
Event Timeline
Log In to Comment