mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
added two new log classes for interfaces and traffic control
This commit is contained in:
parent
cc8984e2d0
commit
1ed9663532
4 changed files with 22 additions and 11 deletions
|
@ -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
|
||||
};
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Add table
Reference in a new issue