/* * parse filter handle */ void parse_u32_handle(char *p, int len, unsigned handle) { if(TC_U32_HTID(handle)) APPEND_SNPRINTF(rc, p, len, "%x", TC_U32_HTID(handle)>>20); APPEND_SNPRINTF(rc, p, len, ":"); if(TC_U32_HASH(handle)) APPEND_SNPRINTF(rc, p, len, "%x", TC_U32_HASH(handle)); APPEND_SNPRINTF(rc, p, len, ":"); if(TC_U32_NODE(handle)) APPEND_SNPRINTF(rc, p, len, "%x", TC_U32_NODE(handle)); }
/* * parse filter handle */ void parse_u32_handle(char *p, int len, unsigned handle) { if(TC_U32_HTID(handle)) p += snprintf(p, len, "%x", TC_U32_HTID(handle)>>20); p += snprintf(p, len, ":"); if(TC_U32_HASH(handle)) p += snprintf(p, len, "%x", TC_U32_HASH(handle)); p += snprintf(p, len, ":"); if(TC_U32_NODE(handle)) p += snprintf(p, len, "%x", TC_U32_NODE(handle)); }
static char * sprint_u32_handle(__u32 handle, char *buf) { int bsize = SPRINT_BSIZE-1; __u32 htid = TC_U32_HTID(handle); __u32 hash = TC_U32_HASH(handle); __u32 nodeid = TC_U32_NODE(handle); char *b = buf; if (handle == 0) { snprintf(b, bsize, "none"); return b; } if (htid) { int l = snprintf(b, bsize, "%x:", htid>>20); bsize -= l; b += l; } if (nodeid|hash) { if (hash) { int l = snprintf(b, bsize, "%x", hash); bsize -= l; b += l; } if (nodeid) { int l = snprintf(b, bsize, ":%x", nodeid); bsize -= l; b += l; } } if (show_raw) snprintf(b, bsize, "[%08x] ", handle); return buf; }
static void u32_dump_details(struct rtnl_tc *tc, void *data, struct nl_dump_params *p) { struct rtnl_u32 *u = data; struct tc_u32_sel *s; if (!u) return; if (!(u->cu_mask & U32_ATTR_SELECTOR)) { nl_dump(p, "no-selector\n"); return; } s = u->cu_selector->d_data; nl_dump(p, "nkeys %u ", s->nkeys); if (u->cu_mask & U32_ATTR_HASH) nl_dump(p, "ht key 0x%x hash 0x%u", TC_U32_USERHTID(u->cu_hash), TC_U32_HASH(u->cu_hash)); if (u->cu_mask & U32_ATTR_LINK) nl_dump(p, "link %u ", u->cu_link); if (u->cu_mask & U32_ATTR_INDEV) nl_dump(p, "indev %s ", u->cu_indev); print_selector(p, s, u); nl_dump(p, "\n"); }
static void u32_dump_details(struct rtnl_cls *cls, struct nl_dump_params *p) { struct rtnl_u32 *u = rtnl_cls_data(cls); struct tc_u32_sel *s; if (!(u->cu_mask & U32_ATTR_SELECTOR)) { nl_dump(p, "no-selector\n"); return; } s = u->cu_selector->d_data; nl_dump(p, "nkeys %u ", s->nkeys); if (u->cu_mask & U32_ATTR_HASH) nl_dump(p, "ht key 0x%x hash 0x%u", TC_U32_USERHTID(u->cu_hash), TC_U32_HASH(u->cu_hash)); if (u->cu_mask & U32_ATTR_LINK) nl_dump(p, "link %u ", u->cu_link); if (u->cu_mask & U32_ATTR_INDEV) nl_dump(p, "indev %s ", u->cu_indev); print_selector(p, s, cls, u); nl_dump(p, "\n"); #if 0 #define U32_ATTR_ACTION 0x040 #define U32_ATTR_POLICE 0x080 struct nl_data act; struct nl_data police; #endif }
static void u32_dump_details(struct rtnl_tc *tc, void *data, struct nl_dump_params *p) { struct rtnl_u32 *u = data; struct tc_u32_sel *s = NULL; struct tc_u32_mark *m; if (!u) return; if (!(u->cu_mask & (U32_ATTR_SELECTOR & U32_ATTR_MARK))) { nl_dump(p, "no-selector no-mark\n"); return; } if (!(u->cu_mask & U32_ATTR_SELECTOR)) { nl_dump(p, "no-selector"); } else { s = u->cu_selector->d_data; nl_dump(p, "nkeys %u", s->nkeys); } if (!(u->cu_mask & U32_ATTR_MARK)) { nl_dump(p, " no-mark"); } else { m = u->cu_mark->d_data; nl_dump(p, " mark 0x%u 0x%u", m->val, m->mask); } if (u->cu_mask & U32_ATTR_HASH) nl_dump(p, " ht key 0x%x hash 0x%u", TC_U32_USERHTID(u->cu_hash), TC_U32_HASH(u->cu_hash)); if (u->cu_mask & U32_ATTR_LINK) nl_dump(p, " link %u", u->cu_link); if (u->cu_mask & U32_ATTR_INDEV) nl_dump(p, " indev %s", u->cu_indev); if (u->cu_mask & U32_ATTR_SELECTOR) print_selector(p, s, u); nl_dump(p, "\n"); }