mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Shrink fq_codel structures to match the kernel API
FIXME: We need, in general, to check for wrapping in long term runs * FIXME: Need a test to ensure fq_codel is still parsing * Still want a size before and after test. Lastly... Newer versions of the kernel now have newer options for fq_codel such as ce_threshold. The present implementation will spam the log on encountering a newer kernel and tc.
This commit is contained in:
parent
ff5ad10240
commit
a8cb399630
@ -16,30 +16,30 @@ pub struct TcFqCodel {
|
|||||||
pub(crate) parent: TcHandle,
|
pub(crate) parent: TcHandle,
|
||||||
options: TcFqCodelOptions,
|
options: TcFqCodelOptions,
|
||||||
bytes: u64,
|
bytes: u64,
|
||||||
packets: u64,
|
packets: u32, // FIXME - for long term data we have to worry about wrapping
|
||||||
drops: u64,
|
drops: u32,
|
||||||
overlimits: u64,
|
overlimits: u32,
|
||||||
requeues: u64,
|
requeues: u32,
|
||||||
backlog: u64,
|
backlog: u32,
|
||||||
qlen: u64,
|
qlen: u32,
|
||||||
maxpacket: u64,
|
maxpacket: u16,
|
||||||
drop_overlimit: u64,
|
drop_overlimit: u32,
|
||||||
new_flow_count: u64,
|
new_flow_count: u32,
|
||||||
ecn_mark: u64,
|
ecn_mark: u32,
|
||||||
new_flows_len: u64,
|
new_flows_len: u16,
|
||||||
old_flows_len: u64,
|
old_flows_len: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone, Debug, Serialize)]
|
#[derive(Default, Clone, Debug, Serialize)]
|
||||||
struct TcFqCodelOptions {
|
struct TcFqCodelOptions {
|
||||||
limit: u64,
|
limit: u32,
|
||||||
flows: u64,
|
flows: u16,
|
||||||
quantum: u64,
|
quantum: u16,
|
||||||
target: u64,
|
target: u64, // FIXME target and interval within fq_codel are scaled to ns >> 1024
|
||||||
interval: u64,
|
interval: u64, // tc scales them back up to us. Ideally ns would make sense throughout.
|
||||||
memory_limit: u64,
|
memory_limit: u32,
|
||||||
ecn: bool,
|
ecn: bool,
|
||||||
drop_batch: u64,
|
drop_batch: u16, // FIXME CE_threshold is presently missing from the parser
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TcFqCodel {
|
impl TcFqCodel {
|
||||||
@ -50,18 +50,18 @@ impl TcFqCodel {
|
|||||||
"handle" => result.handle = TcHandle::from_string(value.as_str().unwrap())?,
|
"handle" => result.handle = TcHandle::from_string(value.as_str().unwrap())?,
|
||||||
"parent" => result.parent = TcHandle::from_string(value.as_str().unwrap())?,
|
"parent" => result.parent = TcHandle::from_string(value.as_str().unwrap())?,
|
||||||
"bytes" => result.bytes = value.as_u64().unwrap(),
|
"bytes" => result.bytes = value.as_u64().unwrap(),
|
||||||
"packets" => result.packets = value.as_u64().unwrap(),
|
"packets" => result.packets = value.as_u64().unwrap() as u32,
|
||||||
"drops" => result.drops = value.as_u64().unwrap(),
|
"drops" => result.drops = value.as_u64().unwrap() as u32,
|
||||||
"overlimits" => result.overlimits = value.as_u64().unwrap(),
|
"overlimits" => result.overlimits = value.as_u64().unwrap() as u32,
|
||||||
"requeues" => result.requeues = value.as_u64().unwrap(),
|
"requeues" => result.requeues = value.as_u64().unwrap() as u32,
|
||||||
"backlog" => result.backlog = value.as_u64().unwrap(),
|
"backlog" => result.backlog = value.as_u64().unwrap() as u32,
|
||||||
"qlen" => result.qlen = value.as_u64().unwrap(),
|
"qlen" => result.qlen = value.as_u64().unwrap() as u32,
|
||||||
"maxpacket" => result.maxpacket = value.as_u64().unwrap(),
|
"maxpacket" => result.maxpacket = value.as_u64().unwrap() as u16,
|
||||||
"drop_overlimit" => result.drop_overlimit = value.as_u64().unwrap(),
|
"drop_overlimit" => result.drop_overlimit = value.as_u64().unwrap() as u32,
|
||||||
"new_flow_count" => result.new_flow_count = value.as_u64().unwrap(),
|
"new_flow_count" => result.new_flow_count = value.as_u64().unwrap() as u32,
|
||||||
"ecn_mark" => result.ecn_mark = value.as_u64().unwrap(),
|
"ecn_mark" => result.ecn_mark = value.as_u64().unwrap() as u32,
|
||||||
"new_flows_len" => result.new_flows_len = value.as_u64().unwrap(),
|
"new_flows_len" => result.new_flows_len = value.as_u64().unwrap() as u16,
|
||||||
"old_flows_len" => result.old_flows_len = value.as_u64().unwrap(),
|
"old_flows_len" => result.old_flows_len = value.as_u64().unwrap() as u16,
|
||||||
"options" => result.options = TcFqCodelOptions::from_json(value)?,
|
"options" => result.options = TcFqCodelOptions::from_json(value)?,
|
||||||
"kind" => {}
|
"kind" => {}
|
||||||
_ => {
|
_ => {
|
||||||
@ -81,13 +81,13 @@ impl TcFqCodelOptions {
|
|||||||
for (key, value) in map.iter() {
|
for (key, value) in map.iter() {
|
||||||
match key.as_str() {
|
match key.as_str() {
|
||||||
"limit" => result.limit = value.as_u64().unwrap(),
|
"limit" => result.limit = value.as_u64().unwrap(),
|
||||||
"flows" => result.flows = value.as_u64().unwrap(),
|
"flows" => result.flows = value.as_u64().unwrap() as u16,
|
||||||
"quantum" => result.quantum = value.as_u64().unwrap(),
|
"quantum" => result.quantum = value.as_u64().unwrap() as u16,
|
||||||
"target" => result.target = value.as_u64().unwrap(),
|
"target" => result.target = value.as_u64().unwrap(),
|
||||||
"interval" => result.interval = value.as_u64().unwrap(),
|
"interval" => result.interval = value.as_u64().unwrap(),
|
||||||
"memory_limit" => result.memory_limit = value.as_u64().unwrap(),
|
"memory_limit" => result.memory_limit = value.as_u64().unwrap() as u32,
|
||||||
"ecn" => result.ecn = value.as_bool().unwrap(),
|
"ecn" => result.ecn = value.as_bool().unwrap(),
|
||||||
"drop_batch" => result.drop_batch = value.as_u64().unwrap(),
|
"drop_batch" => result.drop_batch = value.as_u64().unwrap() as u32,
|
||||||
_ => {
|
_ => {
|
||||||
log::error!("Unknown entry in Tc-codel-options: {key}");
|
log::error!("Unknown entry in Tc-codel-options: {key}");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user