@@ -27,6 +27,7 @@ const (
2727 tcaFqHorizonDrop
2828 tcaFqPrioMap
2929 tcaFqWeights
30+ tcaFqOffloadHorizon
3031)
3132
3233// FqPrioQopt according to tc_prio_qopt in /include/uapi/linux/pkt_sched.h
@@ -54,6 +55,7 @@ type Fq struct {
5455 HorizonDrop * uint8
5556 PrioMap * FqPrioQopt
5657 Weights * []int32
58+ OffloadHorizon * uint32
5759}
5860
5961// 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 {
6264 if err != nil {
6365 return err
6466 }
65- var multiError error
6667 for ad .Next () {
6768 switch ad .Type () {
6869 case tcaFqPLimit :
@@ -97,21 +98,21 @@ func unmarshalFq(data []byte, info *Fq) error {
9798 info .HorizonDrop = uint8Ptr (ad .Uint8 ())
9899 case tcaFqPrioMap :
99100 priomap := & FqPrioQopt {}
100- err := unmarshalStruct (ad .Bytes (), priomap )
101- multiError = concatError (multiError , err )
101+ err = unmarshalStruct (ad .Bytes (), priomap )
102102 info .PrioMap = priomap
103103 case tcaFqWeights :
104104 size := len (ad .Bytes ()) / 4
105105 weights := make ([]int32 , size )
106106 reader := bytes .NewReader (ad .Bytes ())
107- err := binary .Read (reader , nativeEndian , weights )
108- multiError = concatError (multiError , err )
107+ err = binary .Read (reader , nativeEndian , weights )
109108 info .Weights = & weights
109+ case tcaFqOffloadHorizon :
110+ info .OffloadHorizon = uint32Ptr (ad .Uint32 ())
110111 default :
111112 return fmt .Errorf ("unmarshalFq()\t %d\n \t %v" , ad .Type (), ad .Bytes ())
112113 }
113114 }
114- return concatError (multiError , ad .Err ())
115+ return concatError (err , ad .Err ())
115116}
116117
117118// marshalFq returns the binary encoding of Fq
@@ -180,6 +181,9 @@ func marshalFq(info *Fq) ([]byte, error) {
180181 multiError = concatError (multiError , err )
181182 options = append (options , tcOption {Interpretation : vtBytes , Type : tcaFqWeights , Data : buf .Bytes ()})
182183 }
184+ if info .OffloadHorizon != nil {
185+ options = append (options , tcOption {Interpretation : vtUint32 , Type : tcaFqOffloadHorizon , Data : uint32Value (info .OffloadHorizon )})
186+ }
183187
184188 if multiError != nil {
185189 return []byte {}, multiError
0 commit comments