Skip to content

Commit 2dd616d

Browse files
imilchevaboch
authored andcommitted
implemented handling of uint64 for HTB class rate/ceil
1 parent 3bf47fa commit 2dd616d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

class_linux.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,12 @@ func classPayload(req *nl.NetlinkRequest, class Class) error {
176176
options.AddRtAttr(nl.TCA_HTB_PARMS, opt.Serialize())
177177
options.AddRtAttr(nl.TCA_HTB_RTAB, SerializeRtab(rtab))
178178
options.AddRtAttr(nl.TCA_HTB_CTAB, SerializeRtab(ctab))
179+
if htb.Rate >= uint64(1<<32) {
180+
options.AddRtAttr(nl.TCA_HTB_RATE64, nl.Uint64Attr(htb.Rate))
181+
}
182+
if htb.Ceil >= uint64(1<<32) {
183+
options.AddRtAttr(nl.TCA_HTB_CEIL64, nl.Uint64Attr(htb.Ceil))
184+
}
179185
case "hfsc":
180186
hfsc := class.(*HfscClass)
181187
opt := nl.HfscCopt{}
@@ -306,6 +312,10 @@ func parseHtbClassData(class Class, data []syscall.NetlinkRouteAttr) (bool, erro
306312
htb.Quantum = opt.Quantum
307313
htb.Level = opt.Level
308314
htb.Prio = opt.Prio
315+
case nl.TCA_HTB_RATE64:
316+
htb.Rate = native.Uint64(datum.Value[0:8])
317+
case nl.TCA_HTB_CEIL64:
318+
htb.Ceil = native.Uint64(datum.Value[0:8])
309319
}
310320
}
311321
return detailed, nil

class_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,8 @@ func TestHtbClassAddHtbClassChangeDel(t *testing.T) {
268268
}
269269

270270
htbclassattrs := HtbClassAttrs{
271-
Rate: 1234000,
271+
Rate: uint64(1<<32) + 10,
272+
Ceil: uint64(1<<32) + 20,
272273
Cbuffer: 1690,
273274
}
274275
class := NewHtbClass(classattrs, htbclassattrs)

0 commit comments

Comments
 (0)