Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
cc7538f
wip
egnees Mar 20, 2026
5989ec4
removed old interval counter
egnees Mar 23, 2026
3aa716f
implement interval counter
egnees Mar 23, 2026
13bb376
link interval counter into meson.build
egnees Mar 23, 2026
f71cc42
interval counter test stub
egnees Mar 23, 2026
671601d
mend
egnees Mar 23, 2026
8879048
cosmetics + bugfix
egnees Mar 23, 2026
8f06b0f
remove allocations in interval_counter.h
egnees Mar 23, 2026
cec3357
introduce active_sessions_tracker
egnees Mar 23, 2026
b49d985
use active sessions tracker in cp and dp
egnees Mar 24, 2026
2e69842
limit max timeout in tests
egnees Mar 24, 2026
a28d04e
free reals explicitly
egnees Mar 24, 2026
8a7e1d6
introduce active sessions in balancer API
egnees Mar 24, 2026
6023cc3
active sessions test
egnees Mar 24, 2026
897004f
active sessions and interval counter docs
egnees Mar 24, 2026
e623787
test for interval_counter
egnees Mar 24, 2026
2251a1f
small note in active sessions
egnees Mar 24, 2026
55fb17b
small note in active sessions
egnees Mar 24, 2026
995752a
format
egnees Mar 24, 2026
b2017b9
introduce api for the balancer snapshot
egnees Mar 25, 2026
76a1af1
Merge branch 'main' into balancer-snapshot
egnees Mar 25, 2026
551962c
remove allocations in interval_counter.h
egnees Mar 23, 2026
d10cdfb
introduce active_sessions_tracker
egnees Mar 23, 2026
6daef0d
introduce active sessions in balancer API
egnees Mar 24, 2026
2b8b3f1
active sessions test
egnees Mar 24, 2026
c10e867
introduce snapshot in proto
egnees Mar 26, 2026
9facb5d
wip
egnees Mar 26, 2026
2389e32
agent: snapshot
egnees Mar 29, 2026
8cbe802
remove metrics from proto
egnees Mar 29, 2026
718eb38
change slice to iter module references
egnees Mar 30, 2026
c148038
wip
egnees Mar 30, 2026
318f335
add new proto
egnees Mar 30, 2026
1cb738e
dataplane refactoring wip
egnees Mar 31, 2026
a1a48a0
big balancer refactoring
egnees Apr 9, 2026
d3bb111
bug fix + cosmetrics
egnees Apr 9, 2026
ef8b8e9
wip
egnees Apr 9, 2026
21f3965
wip
egnees Apr 9, 2026
8d42305
wip
egnees Apr 9, 2026
787551e
wip
egnees Apr 9, 2026
e978b46
wip
egnees Apr 9, 2026
db297a4
wip
egnees Apr 9, 2026
d4b7db3
wip
egnees Apr 9, 2026
fa3df57
wip
egnees Apr 9, 2026
165729d
wip
egnees Apr 9, 2026
c11ecce
wip
egnees Apr 10, 2026
73e9888
tsc
egnees Apr 10, 2026
cc54341
wip
egnees Apr 10, 2026
2c4b771
wip
egnees Apr 10, 2026
e5e93e4
wip
egnees Apr 10, 2026
2f3c851
wip
egnees Apr 14, 2026
3380dd4
wip
egnees Apr 14, 2026
69ced42
Merge branch 'main' into balancer-refactoring
egnees Apr 14, 2026
3337a69
merge with main
egnees Apr 14, 2026
53261f8
protolint
egnees Apr 14, 2026
fa67677
cargo fmt
egnees Apr 14, 2026
674e290
cargo fmt
egnees Apr 14, 2026
334b8a3
wip
egnees Apr 14, 2026
3e18bf0
wip
egnees Apr 14, 2026
ca9bfa7
wip
egnees Apr 14, 2026
aa47b3a
wlc: take into account in validate
egnees Apr 14, 2026
c3e292c
wip
egnees Apr 14, 2026
d063829
wip
egnees Apr 14, 2026
84f3809
wip
egnees Apr 14, 2026
c22aa22
extend display width for bytes and pkts
egnees Apr 14, 2026
1034b99
wip
egnees Apr 15, 2026
7259fa6
wip
egnees Apr 15, 2026
fa37df4
test fix
egnees Apr 15, 2026
46a4b6c
removed default from balancer.yaml
egnees Apr 15, 2026
c76c1dc
wip
egnees Apr 15, 2026
386aa30
fixed stable index issue
egnees Apr 15, 2026
b569ed5
fixed bug in counters calculation
egnees Apr 15, 2026
7dce296
wip
egnees Apr 15, 2026
f0983c7
inherit grpc error
egnees Apr 15, 2026
453a47e
wip
egnees Apr 15, 2026
22331fd
move comment from sessions.c to sessions.h
egnees Apr 15, 2026
a3a1c33
basic_test.go factoring
egnees Apr 16, 2026
f913518
wip
egnees Apr 16, 2026
965202f
Merge branch 'main' into balancer-refactoring
egnees Apr 16, 2026
31ffa8c
use common table style in balancer cli
egnees Apr 16, 2026
45b7ef1
wip
egnees Apr 16, 2026
4d91fbc
wip
egnees Apr 17, 2026
5900fb6
update_test.go: refactoring
egnees Apr 18, 2026
86b8568
Merge branch 'main' into balancer-refactoring
egnees Apr 18, 2026
593f7cf
fix issues appeared after merge with main
egnees Apr 19, 2026
c0908f5
wip
egnees Apr 19, 2026
4d26108
errors.go: renaming
egnees Apr 19, 2026
0cf6817
new approach for errors handling
egnees Apr 20, 2026
d22423d
Merge branch 'main' into balancer-refactoring
egnees Apr 20, 2026
bb5e744
fixed build issue
egnees Apr 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*.{c,h}]
indent_style = tab
indent_size = 8
tab_width = 8

[*.proto]
indent_style = space
indent_size = 2
6 changes: 6 additions & 0 deletions api/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,9 @@ int
agent_storage_put(
struct agent *agent, const char *name, void *data, size_t size
);

void *
agent_alloc(struct agent *agent, size_t size);

void
agent_free(struct agent *agent, void *ptr, size_t size);
16 changes: 5 additions & 11 deletions balancer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ packet_handler:
- addr: "192.0.2.1"
port: 80
proto: TCP # Accepts: TCP, tcp
scheduler: SOURCE_HASH # Accepts: SOURCE_HASH, source_hash, SH, sh
scheduler: sh
flags:
gre: false
fix_mss: true
Expand All @@ -28,11 +28,6 @@ packet_handler:
weight: 100
src_addr: "192.0.2.1"
src_mask: "255.255.255.255"
- ip: "10.1.1.2"
port: 0
weight: 50
src_addr: "192.0.2.1"
src_mask: "255.255.255.255"
peers:
- "192.0.2.10"
- "192.0.2.11"
Expand All @@ -42,7 +37,7 @@ packet_handler:
- addr: "192.0.2.2"
port: 443
proto: tcp # Lowercase also accepted
scheduler: round_robin # Accepts: ROUND_ROBIN, round_robin, RR, rr
scheduler: wrr
flags:
gre: false
fix_mss: true
Expand Down Expand Up @@ -76,7 +71,7 @@ packet_handler:
- addr: "192.0.2.4"
port: 53
proto: UDP
scheduler: SH # Short form
scheduler: sh
flags:
gre: false
fix_mss: false
Expand Down Expand Up @@ -104,7 +99,7 @@ packet_handler:
- addr: "192.0.2.3"
port: 0 # MUST be 0 for pure_l3 mode
proto: tcp
scheduler: sh # Short form lowercase
scheduler: wrr
flags:
gre: false
fix_mss: false
Expand All @@ -126,7 +121,7 @@ packet_handler:
- addr: "2001:db8::1"
port: 443
proto: TCP
scheduler: RR
scheduler: wrr
flags:
gre: false
fix_mss: true
Expand Down Expand Up @@ -160,7 +155,6 @@ packet_handler:
tcp_fin: 10
tcp: 60
udp: 30
default: 60

# State management configuration
state:
Expand Down
12 changes: 2 additions & 10 deletions cli/modules/counters/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,8 @@ fn format_batch_counter(counter: &PerfCounter, next_min_batch: Option<u32>, widt
let total_bytes = counter.bytes;

// Average latency per packet and per batch
let avg_latency_per_packet = if total_packets > 0 {
counter.summary_latency / total_packets
} else {
0
};
let avg_latency_per_batch = if total_batches > 0 {
counter.summary_latency / total_batches
} else {
0
};
let avg_latency_per_packet = counter.summary_latency.checked_div(total_packets).unwrap_or(0);
let avg_latency_per_batch = counter.summary_latency.checked_div(total_batches).unwrap_or(0);

// Line 1: Total batches, packets, and bytes
let total_content = format!(
Expand Down
2 changes: 1 addition & 1 deletion common/btree/u32.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ btree_u32_init(
// Initialize all blocks with maximum value (last element)
// This ensures sentinel values for incomplete blocks
if (n > 0) {
uint32_t max_val = data[n - 1];
uint32_t max_val = data[n - 1] ^ 0x80000000;
size_t total_values = nblocks * BTREE_U32_BLOCK_SIZE;
for (size_t i = 0; i < total_values; ++i) {
uint32_t *ptr = (uint32_t *)big_array_get(
Expand Down
3 changes: 1 addition & 2 deletions common/btree/u64.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <immintrin.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>

/**
Expand Down Expand Up @@ -304,7 +303,7 @@ btree_u64_init(
// Initialize all blocks with maximum value (last element)
// This ensures sentinel values for incomplete blocks
if (n > 0) {
uint64_t max_val = data[n - 1];
uint64_t max_val = data[n - 1] ^ 0x8000000000000000ULL;
size_t total_values = nblocks * BTREE_U64_BLOCK_SIZE;
for (size_t i = 0; i < total_values; ++i) {
uint64_t *ptr = (uint64_t *)big_array_get(
Expand Down
78 changes: 78 additions & 0 deletions common/go/relptr/relptr.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package relptr

import "unsafe"

// Deref resolves a relative pointer field to *T.
//
// A relative pointer P stores the offset from its own address to the target:
//
// target = &P + P (when P != 0)
// target = nil (when P == 0)
//
// This mirrors the C macro ADDR_OF from common/memory_address.h.
// The field parameter must be a pointer to a pointer field (e.g. &vs.Reals).
func Deref[T any](field **T) *T {
raw := (*uintptr)(unsafe.Pointer(field))
offset := *raw
if offset == 0 {
return nil
}
return (*T)(unsafe.Pointer(offset + uintptr(unsafe.Pointer(field))))
}

// Slice resolves a relative pointer field to a []T slice over contiguous
// memory. The returned slice shares the underlying memory (zero-copy).
func Slice[T any](field **T, count uint32) []T {
if count == 0 {
return nil
}
ptr := Deref(field)
if ptr == nil {
return nil
}
return unsafe.Slice(ptr, count)
}

// Set makes a relative pointer field point to ptr.
//
// This mirrors the C macro SET_OFFSET_OF from common/memory_address.h.
func Set[T any](field **T, ptr *T) {
raw := (*uintptr)(unsafe.Pointer(field))
if ptr == nil {
*raw = 0
return
}
*raw = uintptr(unsafe.Pointer(ptr)) - uintptr(unsafe.Pointer(field))
}

func Equate[T any](dst **T, src **T) {
Set(dst, Deref(src))
}

func SetSlice[T any](field **T, ptr []T) {
if len(ptr) == 0 {
Set(field, nil)
return
}
Set(field, &ptr[0])
}

// DerefOpaque resolves a relative pointer stored in a uintptr field.
// Use this for opaque pointer fields (e.g. filter, selector) where
// the concrete type is not known to Go.
func DerefOpaque(field *uintptr) unsafe.Pointer {
offset := *field
if offset == 0 {
return nil
}
return unsafe.Pointer(offset + uintptr(unsafe.Pointer(field)))
}

// SetOpaque makes a uintptr relative pointer field point to addr.
func SetOpaque(field *uintptr, addr unsafe.Pointer) {
if addr == nil {
*field = 0
return
}
*field = uintptr(addr) - uintptr(unsafe.Pointer(field))
}
Loading
Loading