Optimize XDP program when filter logging is disabled.

This commit is contained in:
Christian Deacon
2025-03-28 22:21:31 -04:00
parent 023a853000
commit ec0b07eb37
2 changed files with 14 additions and 9 deletions

View File

@@ -338,19 +338,22 @@ int xdp_prog_main(struct xdp_md *ctx)
rule.flow_bps = flow_bps; rule.flow_bps = flow_bps;
rule.ip_pps = ip_pps; rule.ip_pps = ip_pps;
rule.ip_bps = ip_bps; rule.ip_bps = ip_bps;
rule.now = now;
rule.pkt_len = pkt_len; rule.pkt_len = pkt_len;
rule.src_port = src_port;
#ifdef ENABLE_FILTER_LOGGING #ifdef ENABLE_FILTER_LOGGING
rule.now = now;
rule.protocol = protocol;
rule.src_port = src_port;
rule.dst_port = dst_port; rule.dst_port = dst_port;
#endif #endif
rule.protocol = protocol;
rule.iph = iph; rule.iph = iph;
rule.iph6 = iph6;
rule.tcph = tcph; rule.tcph = tcph;
rule.udph = udph; rule.udph = udph;
rule.icmph = icmph; rule.icmph = icmph;
rule.iph6 = iph6;
rule.icmph6 = icmp6h; rule.icmph6 = icmp6h;
#ifdef USE_NEW_LOOP #ifdef USE_NEW_LOOP

View File

@@ -19,19 +19,21 @@ struct rule_ctx
int action; int action;
u64 block_time; u64 block_time;
int pkt_len;
u64 ip_pps; u64 ip_pps;
u64 ip_bps; u64 ip_bps;
u64 flow_pps; u64 flow_pps;
u64 flow_bps; u64 flow_bps;
u64 now;
int pkt_len;
u16 src_port;
#ifdef ENABLE_FILTER_LOGGING #ifdef ENABLE_FILTER_LOGGING
u64 now;
u8 protocol;
u16 src_port;
u16 dst_port; u16 dst_port;
#endif #endif
u8 protocol;
struct iphdr* iph; struct iphdr* iph;
struct ipv6hdr* iph6; struct ipv6hdr* iph6;