Skip to content

Commit

Permalink
Merge pull request contiki-os#2442 from arurke/set-of-minor-fixes
Browse files Browse the repository at this point in the history
Set of minor log, code-style and clean-up for RPL, TSCH, uip, packetbuf
  • Loading branch information
nvt authored Jun 7, 2023
2 parents baca8eb + 8d6e635 commit 2975df7
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 27 deletions.
1 change: 1 addition & 0 deletions os/net/ipv6/tcpip.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ tcpip_ipv6_output(void)

/* Look for a next hop */
if((nexthop = get_nexthop(&ipaddr)) == NULL) {
LOG_WARN("output: No next-hop found, dropping packet\n");
goto exit;
}
annotate_transmission(nexthop);
Expand Down
4 changes: 2 additions & 2 deletions os/net/ipv6/uip-ds6.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen,
locprefix->plifetime = ptime;
LOG_INFO("Adding prefix ");
LOG_INFO_6ADDR(&locprefix->ipaddr);
LOG_INFO_("length %u, flags %x, Valid lifetime %lx, Preffered lifetime %lx\n",
LOG_INFO_(" len %u, flags %x, valid/preferred lifetime %lx/%lx\n",
ipaddrlen, flags, vtime, ptime);
return locprefix;
} else {
Expand Down Expand Up @@ -312,7 +312,7 @@ uip_ds6_prefix_add(uip_ipaddr_t *ipaddr, uint8_t ipaddrlen,
}
LOG_INFO("Adding prefix ");
LOG_INFO_6ADDR(&locprefix->ipaddr);
LOG_INFO_("length %u, vlifetime %lu\n", ipaddrlen, interval);
LOG_INFO_(" len %u, valid lifetime %lu\n", ipaddrlen, interval);
return locprefix;
}
return NULL;
Expand Down
6 changes: 3 additions & 3 deletions os/net/mac/tsch/tsch-schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ tsch_schedule_add_slotframe(uint16_t handle, uint16_t size)
/* Add the slotframe to the global list */
list_add(slotframe_list, sf);
}
LOG_INFO("add_slotframe %u %u\n",
handle, size);
LOG_INFO("Adding slotframe %u, size %u\n", handle, size);
tsch_release_lock();
return sf;
}
Expand Down Expand Up @@ -125,7 +124,8 @@ tsch_schedule_remove_slotframe(struct tsch_slotframe *slotframe)

/* Now that the slotframe has no links, remove it. */
if(tsch_get_lock()) {
LOG_INFO("remove slotframe %u %u\n", slotframe->handle, slotframe->size.val);
LOG_INFO("Remove slotframe %u, size %u\n",
slotframe->handle, slotframe->size.val);
memb_free(&slotframe_memb, slotframe);
list_remove(slotframe_list, slotframe);
tsch_release_lock();
Expand Down
5 changes: 3 additions & 2 deletions os/net/mac/tsch/tsch.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ eb_input(struct input_packet *current_input)

LOG_WARN("Updating TSCH hopping sequence from EB\n");
} else {
LOG_WARN("TSCH:! parse_eb: hopping sequence too long (%u)\n", eb_ies.ie_hopping_sequence_len);
LOG_WARN("parse_eb: Hopping sequence too long (%u)\n",
eb_ies.ie_hopping_sequence_len);
}
}
}
Expand Down Expand Up @@ -947,7 +948,7 @@ PROCESS_THREAD(tsch_send_eb_process, ev, data)
if(!(p = tsch_queue_add_packet(&tsch_eb_address, 1, NULL, NULL))) {
LOG_ERR("! could not enqueue EB packet\n");
} else {
LOG_INFO("TSCH: enqueue EB packet %u %u\n",
LOG_INFO("Enqueuing EB packet %u %u\n",
packetbuf_totlen(), packetbuf_hdrlen());
p->tsch_sync_ie_offset = tsch_sync_ie_offset;
p->header_len = hdr_len;
Expand Down
6 changes: 0 additions & 6 deletions os/net/packetbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,6 @@ struct packetbuf_addr {
linkaddr_t addr;
};

#define PACKETBUF_ATTR_PACKET_TYPE_DATA 0
#define PACKETBUF_ATTR_PACKET_TYPE_ACK 1
#define PACKETBUF_ATTR_PACKET_TYPE_STREAM 2
#define PACKETBUF_ATTR_PACKET_TYPE_STREAM_END 3
#define PACKETBUF_ATTR_PACKET_TYPE_TIMESTAMP 4

enum {
PACKETBUF_ATTR_NONE,

Expand Down
10 changes: 5 additions & 5 deletions os/net/routing/rpl-classic/rpl-dag.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ rpl_select_dag(rpl_instance_t *instance, rpl_parent_t *p)
rpl_print_neighbor_list();
}
} else if(best_dag->rank != old_rank) {
LOG_DBG("RPL: Preferred parent update, rank changed from %u to %u\n",
LOG_DBG("Preferred parent update, rank changed from %u to %u\n",
(unsigned)old_rank, best_dag->rank);
}
return best_dag;
Expand Down Expand Up @@ -1606,9 +1606,9 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
/* The DIO comes from a valid DAG, so we can refresh its lifetime. */
dag->lifetime = (1UL << (instance->dio_intmin + instance->dio_intdoubl)) *
RPL_DAG_LIFETIME / 1000;
LOG_INFO("Set DAG ");
LOG_INFO_6ADDR(&dag->dag_id);
LOG_INFO_(" lifetime to %ld\n", (long int)dag->lifetime);
LOG_DBG("Set DAG ");
LOG_DBG_6ADDR(&dag->dag_id);
LOG_DBG_(" lifetime to %ld\n", (long int)dag->lifetime);

/*
* At this point, we know that this DIO pertains to a DAG that we
Expand Down Expand Up @@ -1656,7 +1656,7 @@ rpl_process_dio(uip_ipaddr_t *from, rpl_dio_t *dio)
/* Parent info has been updated, trigger rank recalculation. */
p->flags |= RPL_PARENT_FLAG_UPDATED;

LOG_INFO("preferred DAG ");
LOG_INFO("Preferred DAG ");
LOG_INFO_6ADDR(&instance->current_dag->dag_id);
LOG_INFO_(", rank %u, min_rank %u, ",
instance->current_dag->rank, instance->current_dag->min_rank);
Expand Down
11 changes: 6 additions & 5 deletions os/net/routing/rpl-classic/rpl-ext-header.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ rpl_ext_header_hbh_update(uint8_t *ext_buf, int opt_offset)
sender = nbr_table_get_from_lladdr(rpl_parents, packetbuf_addr(PACKETBUF_ADDR_SENDER));

if(sender != NULL && (rpl_opt->flags & RPL_HDR_OPT_RANK_ERR)) {
/* A rank error was signalled -- attempt to repair it by updating
/* A rank error was signaled -- attempt to repair it by updating
the sender's rank from the ext header. */
sender->rank = sender_rank;
if(RPL_IS_NON_STORING(instance)) {
Expand All @@ -135,9 +135,10 @@ rpl_ext_header_hbh_update(uint8_t *ext_buf, int opt_offset)

sender_closer = sender_rank < instance->current_dag->rank;

LOG_DBG("Packet going %s, sender closer %d (%d < %d)\n",

LOG_DBG("Packet going %s, sender%s closer (%d < %d)\n",
down == 1 ? "down" : "up",
sender_closer,
sender_closer ? "" : " not",
sender_rank,
instance->current_dag->rank);

Expand All @@ -154,14 +155,14 @@ rpl_ext_header_hbh_update(uint8_t *ext_buf, int opt_offset)

if(rpl_opt->flags & RPL_HDR_OPT_RANK_ERR) {
RPL_STAT(rpl_stats.loop_errors++);
LOG_ERR(" Rank error signalled in RPL option!\n");
LOG_ERR("Rank error signaled in RPL option!\n");
/* Packet must be dropped and dio trickle timer reset, see
RFC6550 - 11.2.2.2 */
rpl_reset_dio_timer(instance);
return 0;
}

LOG_WARN("Single error tolerated\n");
LOG_WARN("One inconsistency along path is tolerated\n");
RPL_STAT(rpl_stats.loop_warnings++);
rpl_opt->flags |= RPL_HDR_OPT_RANK_ERR;
return 1;
Expand Down
3 changes: 1 addition & 2 deletions os/net/routing/rpl-classic/rpl-icmp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,7 @@ dao_input_storing(void)
uint8_t out_seq;
out_seq = prepare_for_dao_fwd(sequence, rep);

LOG_DBG("Forwarding No-path DAO to parent - out_seq:%d",
out_seq);
LOG_DBG("Forwarding No-path DAO out_seq:%d to parent ", out_seq);
LOG_DBG_6ADDR(rpl_parent_get_ipaddr(dag->preferred_parent));
LOG_DBG_("\n");

Expand Down
4 changes: 3 additions & 1 deletion os/net/routing/rpl-classic/rpl-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@
#define RPL_ROUTE_INFINITE_LIFETIME 0xFFFFFFFF

#define RPL_LIFETIME(instance, lifetime) \
(((lifetime) == RPL_INFINITE_LIFETIME) ? RPL_ROUTE_INFINITE_LIFETIME : (unsigned long)(instance)->lifetime_unit * (lifetime))
(((lifetime) == RPL_INFINITE_LIFETIME) ? \
RPL_ROUTE_INFINITE_LIFETIME : \
(unsigned long)(instance)->lifetime_unit * (lifetime))


#ifndef RPL_CONF_MIN_HOPRANKINC
Expand Down
3 changes: 2 additions & 1 deletion os/net/routing/rpl-lite/rpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ rpl_link_callback(const linkaddr_t *addr, int status, int numtx)
Updating from here is unsafe; postpone */
LOG_INFO("packet sent to ");
LOG_INFO_LLADDR(addr);
LOG_INFO_(", status %u, tx %u, new link metric %u\n", status, numtx, rpl_neighbor_get_link_metric(nbr));
LOG_INFO_(", status %u, tx %u, new link metric %u\n",
status, numtx, rpl_neighbor_get_link_metric(nbr));
rpl_timers_schedule_state_update();
}
}
Expand Down

0 comments on commit 2975df7

Please sign in to comment.