diff --git a/include/villas/log.h b/include/villas/log.h index 9a50bca8f..4b8afb4fd 100644 --- a/include/villas/log.h +++ b/include/villas/log.h @@ -44,18 +44,20 @@ enum log_facilities { LOG_VFIO = (1L << 18), LOG_PCI = (1L << 19), LOG_XIL = (1L << 20), + LOG_TC = (1L << 21), + LOG_IF = (1L << 22), /* Node-types */ - LOG_SOCKET = (1L << 21), - LOG_FILE = (1L << 22), - LOG_FPGA = (1L << 23), - LOG_NGSI = (1L << 24), - LOG_WEBSOCKET = (1L << 25), - LOG_OPAL = (1L << 26), + LOG_SOCKET = (1L << 23), + LOG_FILE = (1L << 24), + LOG_FPGA = (1L << 25), + LOG_NGSI = (1L << 26), + LOG_WEBSOCKET = (1L << 27), + LOG_OPAL = (1L << 28), /* Classes */ LOG_NODES = LOG_NODE | LOG_SOCKET | LOG_FILE | LOG_FPGA | LOG_NGSI | LOG_WEBSOCKET | LOG_OPAL, - LOG_KERNEL = LOG_VFIO | LOG_PCI, + LOG_KERNEL = LOG_VFIO | LOG_PCI | LOG_TC | LOG_IF, LOG_ALL = ~0xFF }; diff --git a/lib/kernel/if.c b/lib/kernel/if.c index 750e12534..6109822e5 100644 --- a/lib/kernel/if.c +++ b/lib/kernel/if.c @@ -26,7 +26,7 @@ struct interface * if_create(struct rtnl_link *link) i->nl_link = link; - debug(LOG_SOCKET | 3, "Created interface '%s'", rtnl_link_get_name(i->nl_link)); + debug(LOG_IF | 3, "Created interface '%s'", rtnl_link_get_name(i->nl_link)); int n = if_get_irqs(i); if (n > 0) @@ -91,7 +91,7 @@ int if_start(struct interface *i, int affinity) error("Failed to setup FW mark classifier: %s", nl_geterror(ret)); char *buf = tc_print(s->tc_qdisc); - debug(LOG_SOCKET | 5, "Starting network emulation on interface '%s' for FW mark %u: %s", + debug(LOG_IF | 5, "Starting network emulation on interface '%s' for FW mark %u: %s", rtnl_link_get_name(i->nl_link), s->mark, buf); free(buf); @@ -192,7 +192,7 @@ int if_set_affinity(struct interface *i, int affinity) error("Failed to set affinity for IRQ %u", i->irqs[n]); fclose(file); - debug(LOG_SOCKET | 5, "Set affinity of IRQ %u for interface '%s' to %#x", i->irqs[n], rtnl_link_get_name(i->nl_link), affinity); + debug(LOG_IF | 5, "Set affinity of IRQ %u for interface '%s' to %#x", i->irqs[n], rtnl_link_get_name(i->nl_link), affinity); } else error("Failed to set affinity for interface '%s'", rtnl_link_get_name(i->nl_link)); diff --git a/lib/kernel/tc.c b/lib/kernel/tc.c index 4ed4a786a..bf0b52348 100644 --- a/lib/kernel/tc.c +++ b/lib/kernel/tc.c @@ -134,6 +134,7 @@ char * tc_print(struct rtnl_qdisc *ne) int tc_prio(struct interface *i, struct rtnl_qdisc **qd, tc_hdl_t handle, tc_hdl_t parent, int bands) { + int ret; struct nl_sock *sock = nl_init(); struct rtnl_qdisc *q = rtnl_qdisc_alloc(); @@ -151,10 +152,12 @@ int tc_prio(struct interface *i, struct rtnl_qdisc **qd, tc_hdl_t handle, tc_hdl rtnl_qdisc_prio_set_bands(q, bands + 3); rtnl_qdisc_prio_set_priomap(q, map, sizeof(map)); - int ret = rtnl_qdisc_add(sock, q, NLM_F_CREATE | NLM_F_REPLACE); + ret = rtnl_qdisc_add(sock, q, NLM_F_CREATE | NLM_F_REPLACE); *qd = q; + debug(LOG_TC | 3, "Added prio qdisc with %d bands to interface '%s'", bands, rtnl_link_get_name(i->nl_link)); + return ret; } @@ -172,6 +175,8 @@ int tc_netem(struct interface *i, struct rtnl_qdisc **qd, tc_hdl_t handle, tc_hd *qd = q; + debug(LOG_TC | 3, "Added netem qdisc to interface '%s'", rtnl_link_get_name(i->nl_link)); + return ret; } @@ -193,6 +198,8 @@ int tc_mark(struct interface *i, struct rtnl_cls **cls, tc_hdl_t flowid, uint32_ *cls = c; + debug(LOG_TC | 3, "Added fwmark classifier with mark %d to interface '%s'", mark, rtnl_link_get_name(i->nl_link)); + return ret; } diff --git a/lib/log.c b/lib/log.c index 846fefd1c..b97cb7cf8 100644 --- a/lib/log.c +++ b/lib/log.c @@ -40,6 +40,8 @@ static const char *facilities_strs[] = { "vfio", /* LOG_VFIO */ "pci", /* LOG_PCI */ "xil", /* LOG_XIL */ + "tc", /* LOG_TC */ + "if", /* LOG_IF */ /* Node-types */ "socket", /* LOG_SOCKET */