summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau2021-11-22 09:24:39 +0000
committerFelix Fietkau2021-11-22 09:24:42 +0000
commit06872673c10fdf0eec7da1b2fe335e750d768f1e (patch)
tree89cfeb9ab54fdf65f7f74259e4a9933e0988a702
parent2743e58741b304c37858dbc44435a164215b0a87 (diff)
downloadqosify-06872673c10fdf0eec7da1b2fe335e750d768f1e.tar.gz
map: allow referring to a class index directly in tcp/udp default entries
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--map.c29
1 files changed, 11 insertions, 18 deletions
diff --git a/map.c b/map.c
index f3b7e30..078dc45 100644
--- a/map.c
+++ b/map.c
@@ -158,29 +158,22 @@ static void __qosify_map_set_dscp_default(enum qosify_map_id id, uint8_t val)
int fd;
int i;
- if (id == CL_MAP_TCP_PORTS)
- key = QOSIFY_MAX_CLASS_ENTRIES;
- else if (id == CL_MAP_UDP_PORTS)
- key = QOSIFY_MAX_CLASS_ENTRIES + 1;
- else
- return;
+ if (!(val & QOSIFY_DSCP_CLASS_FLAG)) {
+ if (id == CL_MAP_TCP_PORTS)
+ key = QOSIFY_MAX_CLASS_ENTRIES;
+ else if (id == CL_MAP_UDP_PORTS)
+ key = QOSIFY_MAX_CLASS_ENTRIES + 1;
+ else
+ return;
- fd = qosify_map_fds[CL_MAP_CLASS];
- if (val & QOSIFY_DSCP_CLASS_FLAG) {
- uint8_t fallback = val & QOSIFY_DSCP_FALLBACK_FLAG;
+ fd = qosify_map_fds[CL_MAP_CLASS];
- val &= QOSIFY_DSCP_VALUE_MASK;
- if (val > ARRAY_SIZE(map_class) || !map_class[val])
- return;
+ memcpy(&class.config, &flow_config, sizeof(class.config));
+ bpf_map_update_elem(fd, &key, &class, BPF_ANY);
- class.val.ingress = map_class[val]->data.val.ingress | fallback;
- class.val.egress = map_class[val]->data.val.egress | fallback;
+ val = key | QOSIFY_DSCP_CLASS_FLAG;
}
- memcpy(&class.config, &flow_config, sizeof(class.config));
- bpf_map_update_elem(fd, &key, &class, BPF_ANY);
-
- val = key | QOSIFY_DSCP_CLASS_FLAG;
fd = qosify_map_fds[id];
for (i = 0; i < (1 << 16); i++) {
data.addr.port = htons(i);