Skip to content

Commit

Permalink
airtime-fairness: add ATF to the data model
Browse files Browse the repository at this point in the history
Signed-off-by: John Crispin <john@phrozen.org>
  • Loading branch information
blogic committed Nov 11, 2021
1 parent dd9708d commit 08e0c28
Show file tree
Hide file tree
Showing 12 changed files with 345 additions and 170 deletions.
68 changes: 55 additions & 13 deletions renderer/templates/interface/wmm.uc
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,54 @@ let class = {
"VA": 44,
"LE": 1,
"DF": 0,

/* fake entry used by rfc8325 */
"MIN": 2
};

let profiles = {
"rfc8325": {
"defaults": {
"UP0": [ "MIN", "CS2" ],
"UP1": [ "LE" ],
"UP3": [ "AF21", "AF23" ],
"UP4": [ "CS3", "AF43" ],
"UP5": [ "CS5" ],
"UP6": [ "VA", "EF" ],
"UP7": [ "CS6", "CS7" ]
}
},
"3gpp": {
"defaults": {
"UP0": [ "DF" ],
"UP1": [ "CS1" ],
"UP2": [ "AF11", "AF13" ],
"UP3": [ "AF21", "AF23" ],
"UP4": [ "CS3", "AF33" ],
"UP5": [ "CS5", "AF43" ],
"UP6": [ "CS4" ],
"UP7": [ "CS6" ]
},
"exceptions": {
"UP6": [ "EF" ]
}
},
"enterprise": {
"UP0": [ "DF"],
"UP1": [ "CS1" ],
"UP2": [ "AF11", "AF12", "AF13" ],
"UP3": [ "CS2", "AF21", "AF22", "AF23" ],
"UP4": [ "CS3", "AF31", "AF32", "AF33" ],
"UP5": [ "CS5", "AF41", "AF42", "AF43" ],
"UP6": [ "CS4", "EF" ],
"UP7": [ "CS6" ]
"defaults": {
"UP0": [ "DF" ],
"UP1": [ "CS1" ],
"UP2": [ "AF11", "AF13" ],
"UP3": [ "CS2", "AF23" ],
"UP4": [ "CS3", "AF33" ],
"UP5": [ "CS5" ],
"UP6": [ "CS4" ],
"UP7": [ "CS6" ]
},
"exceptions": {
"UP5": [ "AF41", "AF42", "AF43" ],
"UP6": [ "EF" ],
"UP7": [ "CS6" ]
}
}
};

Expand All @@ -51,25 +87,31 @@ function qos_map() {
if (wmm.profile)
wmm = profiles[wmm.profile];

if (!length(wmm.defaults))
wmm.defaults = { };

if (!length(wmm.exceptions))
wmm.exceptions = { };

for (let prio = 0; prio < 8; prio++) {
let up = wmm["UP" + prio];
let up = wmm.exceptions["UP" + prio] || [];
let len = length(up);

if (length(up) < 2)
if (!length(up))
continue;

for (let idx = 1; idx < len; idx++) {
for (let idx = 0; idx < len; idx++) {
push(up_map, class[up[idx]]);
push(up_map, prio);
}
}

for (let prio = 0; prio < 8; prio++) {
let up = wmm["UP" + prio];
let up = wmm.defaults["UP" + prio];

if (length(up)) {
push(up_map, class[up[0]]);
push(up_map, class[up[0]]);
push(up_map, class[up[1] || up[0]]);
} else {
push(up_map, 255);
push(up_map, 255);
Expand Down
17 changes: 17 additions & 0 deletions renderer/templates/services/airtime_fairness.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{%
let enable = airtime_fairness;
if (!services.is_present("atfpolicy"))
return;
services.set_enabled("atfpolicy", enable);
if (!enable)
return;
%}

set atfpolicy.@defaults[0].vo_queue_weight={{ airtime_fairness.voice_weight }}
set atfpolicy.@defaults[0].update_pkt_threshold={{ airtime_fairness.packet_threshold }}
set atfpolicy.@defaults[0].bulk_percent_thresh={{ airtime_fairness.bulk_threshold }}
set atfpolicy.@defaults[0].prio_percent_thresh={{ airtime_fairness.priority_threshold }}
set atfpolicy.@defaults[0].weight_normal={{ airtime_fairness.weight_normal }}
set atfpolicy.@defaults[0].weight_prio={{ airtime_fairness.weight_priority }}
set atfpolicy.@defaults[0].weight_bulk={{ airtime_fairness.weight_bulk }}

21 changes: 0 additions & 21 deletions renderer/templates/services/airtime_policies.uc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ description:
type: string
enum:
- enterprise
- rfc8325
- 3gpp
40 changes: 40 additions & 0 deletions schema/globals.wireless-multimedia.raw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
description:
Define the default WMM behaviour of all SSIDs on the device. Each access
category can be assigned a default class selector range that gets used for packet
matching. It is possible to also define a list of override exceptions.
type: object
properties:
defaults:
UP0:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP1:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP2:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP3:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP4:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP5:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP6:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP7:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
exceptions:
UP0:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP1:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP2:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP3:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP4:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP5:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP6:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
UP7:
$ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/class-selector/'
22 changes: 0 additions & 22 deletions schema/globals.wireless-multimedia.yml

This file was deleted.

4 changes: 2 additions & 2 deletions schema/globals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ properties:
- fdca:1234:4567::/48
wireless-multimedia:
oneOf:
- $ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/'
- $ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia-profile/'
- $ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/raw/'
- $ref: 'https://ucentral.io/schema/v1/globals/wireless-multimedia/profile/'
46 changes: 46 additions & 0 deletions schema/service.airtime-fairness.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
description:
This section describes the vlan behaviour of a logical network interface.
type: object
properties:
voice-weight:
description:
Voice traffic does not get aggregated. As voice and video are both considered
priotity voice is considered to have a heavier weight when calculation priority
average.
type: number
default: 4
packet-threshold:
description:
The amount of packets that need to be received for a specific type of traffic
before new averageg is calculated.
type: number
default: 100
bulk-threshold:
description:
This option is a percentual value. If more the X% of the traffic is bulk, we assign
the bulk weight.
type: number
default: 50
priority-threshold:
description:
This option is a percentual value. If more the X% of the traffic is priority, we assign
the priority weight. Priority classification will take precedence over bulk.
type: number
default: 30
weight-normal:
description:
The default ATF weight that UEs get assigned.
type: number
default: 256
weight-priority:
description:
The default ATF weight that UEs get assigned when priority traffic above the configured
percentage is detected.
type: number
default: 394
weight-bulk:
description:
The default ATF weight that UEs get assigned when bulk traffic above the configured
percentage is detected.
type: number
default: 128
20 changes: 0 additions & 20 deletions schema/service.airtime-policies.yml

This file was deleted.

4 changes: 2 additions & 2 deletions schema/service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ properties:
$ref: "https://ucentral.io/schema/v1/service/quality-of-service/"
facebook-wifi:
$ref: "https://ucentral.io/schema/v1/service/facebook-wifi/"
airtime-policies:
$ref: "https://ucentral.io/schema/v1/service/airtime-policies/"
airtime-fairness:
$ref: "https://ucentral.io/schema/v1/service/airtime-fairness/"
Loading

0 comments on commit 08e0c28

Please sign in to comment.