8000 fix: adjust CBS/EBS size with average window (default: 1000ms) by tim-ywliu · Pull Request #146 · free5gc/gtp5g · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: adjust CBS/EBS size with average window (default: 1000ms) #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Changes from all commits
Commits
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
8 changes: 5 additions & 3 deletions src/gtpu/trTCM.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#define MTU 1500
#define MILLISECONDS_PER_SECOND 1000
#define NANOSECONDS_PER_SECOND 1000000000
#define AVG_WINDOW 1000 // ms
#define EBS_FACTOR 1 // CBS Multiplier

TrafficPolicer* newTrafficPolicer(u64 kbitRate) {
TrafficPolicer* p = (TrafficPolicer*)kmalloc(sizeof(TrafficPolicer), GFP_KERNEL);
Expand All @@ -20,13 +22,13 @@ TrafficPolicer* newTrafficPolicer(u64 kbitRate) {

p->byteRate = kbitRate * 125 ; // Kbit/s to byte/s (*1000/8)

// 8ms as burst size
p->cbs = p->byteRate * 8 / MILLISECONDS_PER_SECOND; // bytes
// Total tokens for AVG_WINDOW will be shared with CBS size + EBS size
p->cbs = p->byteRate * (AVG_WINDOW / MILLISECONDS_PER_SECOND) / (1 + EBS_FACTOR); // bytes
if (p->cbs < MTU) {
p->cbs = MTU;
}

p->ebs = p->cbs * 2; // bytes, 2 times of cbs size
p->ebs = p->cbs * EBS_FACTOR; // bytes

// fill buckets at the begining
p->tc = p->cbs;
Expand Down
0