@@ -27,6 +27,7 @@ const (
27
27
tcaFqHorizonDrop
28
28
tcaFqPrioMap
29
29
tcaFqWeights
30
+ tcaFqOffloadHorizon
30
31
)
31
32
32
33
// FqPrioQopt according to tc_prio_qopt in /include/uapi/linux/pkt_sched.h
@@ -54,6 +55,7 @@ type Fq struct {
54
55
HorizonDrop * uint8
55
56
PrioMap * FqPrioQopt
56
57
Weights * []int32
58
+ OffloadHorizon * uint32
57
59
}
58
60
59
61
// unmarshalFq parses the Fq-encoded data and stores the result in the value pointed to by info.
@@ -62,7 +64,6 @@ func unmarshalFq(data []byte, info *Fq) error {
62
64
if err != nil {
63
65
return err
64
66
}
65
- var multiError error
66
67
for ad .Next () {
67
68
switch ad .Type () {
68
69
case tcaFqPLimit :
@@ -97,21 +98,21 @@ func unmarshalFq(data []byte, info *Fq) error {
97
98
info .HorizonDrop = uint8Ptr (ad .Uint8 ())
98
99
case tcaFqPrioMap :
99
100
priomap := & FqPrioQopt {}
100
- err := unmarshalStruct (ad .Bytes (), priomap )
101
- multiError = concatError (multiError , err )
101
+ err = unmarshalStruct (ad .Bytes (), priomap )
102
102
info .PrioMap = priomap
103
103
case tcaFqWeights :
104
104
size := len (ad .Bytes ()) / 4
105
105
weights := make ([]int32 , size )
106
106
reader := bytes .NewReader (ad .Bytes ())
107
- err := binary .Read (reader , nativeEndian , weights )
108
- multiError = concatError (multiError , err )
107
+ err = binary .Read (reader , nativeEndian , weights )
109
108
info .Weights = & weights
109
+ case tcaFqOffloadHorizon :
110
+ info .OffloadHorizon = uint32Ptr (ad .Uint32 ())
110
111
default :
111
112
return fmt .Errorf ("unmarshalFq()\t %d\n \t %v" , ad .Type (), ad .Bytes ())
112
113
}
113
114
}
114
- return concatError (multiError , ad .Err ())
115
+ return concatError (err , ad .Err ())
115
116
}
116
117
117
118
// marshalFq returns the binary encoding of Fq
@@ -180,6 +181,9 @@ func marshalFq(info *Fq) ([]byte, error) {
180
181
multiError = concatError (multiError , err )
181
182
options = append (options , tcOption {Interpretation : vtBytes , Type : tcaFqWeights , Data : buf .Bytes ()})
182
183
}
184
+ if info .OffloadHorizon != nil {
185
+ options = append (options , tcOption {Interpretation : vtUint32 , Type : tcaFqOffloadHorizon , Data : uint32Value (info .OffloadHorizon )})
186
+ }
183
187
184
188
if multiError != nil {
185
189
return []byte {}, multiError
0 commit comments