aboutsummaryrefslogtreecommitdiff
path: root/net/link_local.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-05-23 08:01:04 +0000
committerJoe Hershberger <joe.hershberger@ni.com>2012-05-23 17:53:08 -0500
commit4ef8d53caadbab5585ccb4df2d087183b1383b86 (patch)
tree5e4aeca8a2c86a983f08d573405594c68691db7e /net/link_local.c
parentc697576262be11ddab48e1890428495e2fef1751 (diff)
net: Allow filtering on debug traces in the net subsystem
Add several levels of DEBUG prints so that you can limit the noise to the severety of your problem. DEBUG_LL_STATE = Link local state machine changes DEBUG_DEV_PKT = Packets or info directed to the device DEBUG_NET_PKT = Packets on info on the network at large DEBUG_INT_STATE = Internal network state changes Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net/link_local.c')
-rw-r--r--net/link_local.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/net/link_local.c b/net/link_local.c
index dde96aec3..336286395 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -93,7 +93,7 @@ static void configure_wait(void)
/* set deadline_ms to the point in time when we timeout */
deadline_ms = MONOTONIC_MS() + timeout_ms;
- debug("...wait %d %s nprobes=%u, nclaims=%u\n",
+ debug_cond(DEBUG_DEV_PKT, "...wait %d %s nprobes=%u, nclaims=%u\n",
timeout_ms, eth_get_name(), nprobes, nclaims);
NetSetTimeout(timeout_ms, link_local_timeout);
@@ -131,7 +131,7 @@ static void link_local_timeout(void)
have been received, so we can progress through the states */
if (nprobes < PROBE_NUM) {
nprobes++;
- debug("probe/%u %s@%pI4\n",
+ debug_cond(DEBUG_LL_STATE, "probe/%u %s@%pI4\n",
nprobes, eth_get_name(), &ip);
arp_raw_request(0, NetEtherNullAddr, ip);
timeout_ms = PROBE_MIN * 1000;
@@ -140,7 +140,7 @@ static void link_local_timeout(void)
/* Switch to announce state */
state = ANNOUNCE;
nclaims = 0;
- debug("announce/%u %s@%pI4\n",
+ debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
nclaims, eth_get_name(), &ip);
arp_raw_request(ip, NetOurEther, ip);
timeout_ms = ANNOUNCE_INTERVAL * 1000;
@@ -152,7 +152,7 @@ static void link_local_timeout(void)
to the announce state */
state = ANNOUNCE;
nclaims = 0;
- debug("announce/%u %s@%pI4\n",
+ debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
nclaims, eth_get_name(), &ip);
arp_raw_request(ip, NetOurEther, ip);
timeout_ms = ANNOUNCE_INTERVAL * 1000;
@@ -163,7 +163,7 @@ static void link_local_timeout(void)
the states */
if (nclaims < ANNOUNCE_NUM) {
nclaims++;
- debug("announce/%u %s@%pI4\n",
+ debug_cond(DEBUG_LL_STATE, "announce/%u %s@%pI4\n",
nclaims, eth_get_name(), &ip);
arp_raw_request(ip, NetOurEther, ip);
timeout_ms = ANNOUNCE_INTERVAL * 1000;
@@ -216,10 +216,11 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
if ((int)(diff) < 0) {
/* Current time is greater than the expected timeout
time. This should never happen */
- debug("missed an expected timeout\n");
+ debug_cond(DEBUG_LL_STATE,
+ "missed an expected timeout\n");
timeout_ms = 0;
} else {
- debug("adjusting timeout\n");
+ debug_cond(DEBUG_INT_STATE, "adjusting timeout\n");
timeout_ms = diff | 1; /* never 0 */
}
}
@@ -239,13 +240,13 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
}
*/
- debug("%s recv arp type=%d, op=%d,\n",
+ debug_cond(DEBUG_INT_STATE, "%s recv arp type=%d, op=%d,\n",
eth_get_name(), ntohs(arp->ar_pro),
ntohs(arp->ar_op));
- debug("\tsource=%pM %pI4\n",
+ debug_cond(DEBUG_INT_STATE, "\tsource=%pM %pI4\n",
&arp->ar_sha,
&arp->ar_spa);
- debug("\ttarget=%pM %pI4\n",
+ debug_cond(DEBUG_INT_STATE, "\ttarget=%pM %pI4\n",
&arp->ar_tha,
&arp->ar_tpa);
@@ -271,8 +272,9 @@ void link_local_receive_arp(struct arp_hdr *arp, int len)
target_ip_conflict = 1;
}
- debug("state = %d, source ip conflict = %d, target ip conflict = %d\n",
- state, source_ip_conflict, target_ip_conflict);
+ debug_cond(DEBUG_NET_PKT,
+ "state = %d, source ip conflict = %d, target ip conflict = "
+ "%d\n", state, source_ip_conflict, target_ip_conflict);
switch (state) {
case PROBE:
case ANNOUNCE: