Skip to content
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

update token fill frequency #95

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

chen042531
Copy link
Contributor

@chen042531 chen042531 commented Apr 3, 2024

update tokens every 8000000ns
use 8000000ns because the minimum token rate is 1 Kbit/s (125 bytes/s)
add at least one token in every update

src/gtpu/trTCM.c Outdated
if (p->refillTokenTime >= 8000000) {
// add at least one token
p->refillTokenTime = p->refillTokenTime - 8000000;
tokensToAdd = p->tokenRate / 125;
Copy link
Collaborator

@tim-ywliu tim-ywliu Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#define REFILL_TOKEN_INTERVAL 1000000 // ns (=1ms), 1 token = 1 byte
#define SECOND_TO_NANOSECOND 1000000000

if (p->refillTokenTime >= REFILL_TOKEN_INTERVAL) {
        // add at least one token
        p->refillTokenTime = p->refillTokenTime - REFILL_TOKEN_INTERVAL;
        tokensToAdd = p->tokenRate * (REFILL_TOKEN_INTERVAL  / SECOND_TO_NANOSECOND); 

@tim-ywliu tim-ywliu merged commit 073e1bb into free5gc:master Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants