Skip to content

Commit 98c55e5

Browse files
committed
Implement feedback
1 parent 3d5d227 commit 98c55e5

File tree

6 files changed

+17
-163
lines changed

6 files changed

+17
-163
lines changed

go/pkg/router/dataplane.go

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,12 @@ func (p *scionPacketProcessor) processEPIC() (processResult, error) {
801801
}
802802
}
803803

804-
result.Class = tc.ClsEpic
804+
// Prioritize EPIC packets at the last two hops:
805+
result.Class = tc.ClsOthers
806+
if isPenultimate || isLast {
807+
result.Class = tc.ClsEpic
808+
}
809+
805810
return result, nil
806811
}
807812

@@ -1233,8 +1238,7 @@ func (p *scionPacketProcessor) process() (processResult, error) {
12331238
if err != nil {
12341239
return r, err
12351240
}
1236-
return processResult{OutConn: p.d.internal, OutAddr: a,
1237-
OutPkt: p.rawPkt, Class: tc.ClsScion}, nil
1241+
return processResult{OutConn: p.d.internal, OutAddr: a, OutPkt: p.rawPkt}, nil
12381242
}
12391243

12401244
// Outbound: pkts leaving the local IA.
@@ -1263,14 +1267,12 @@ func (p *scionPacketProcessor) process() (processResult, error) {
12631267
if err := p.processEgress(); err != nil {
12641268
return processResult{}, err
12651269
}
1266-
return processResult{EgressID: egressID, OutConn: c,
1267-
OutPkt: p.rawPkt, Class: tc.ClsScion}, nil
1270+
return processResult{EgressID: egressID, OutConn: c, OutPkt: p.rawPkt}, nil
12681271
}
12691272

12701273
// ASTransit: pkts leaving from another AS BR.
12711274
if a, ok := p.d.internalNextHops[egressID]; ok {
1272-
return processResult{OutConn: p.d.internal, OutAddr: a,
1273-
OutPkt: p.rawPkt, Class: tc.ClsScion}, nil
1275+
return processResult{OutConn: p.d.internal, OutAddr: a, OutPkt: p.rawPkt}, nil
12741276
}
12751277
errCode := slayers.SCMPCodeUnknownHopFieldEgress
12761278
if !p.infoField.ConsDir {
@@ -1332,8 +1334,8 @@ func (p *scionPacketProcessor) processOHP() (processResult, error) {
13321334
// OHP should always be directed to the correct BR.
13331335
if c, ok := p.d.external[ohp.FirstHop.ConsEgress]; ok {
13341336
// buffer should already be correct
1335-
return processResult{EgressID: ohp.FirstHop.ConsEgress, OutConn: c, OutPkt: p.rawPkt,
1336-
Class: tc.ClsOhp}, nil
1337+
return processResult{EgressID: ohp.FirstHop.ConsEgress, OutConn: c,
1338+
OutPkt: p.rawPkt}, nil
13371339
}
13381340
// TODO parameter problem invalid interface
13391341
return processResult{}, serrors.WithCtx(cannotRoute, "type", "ohp",
@@ -1369,8 +1371,7 @@ func (p *scionPacketProcessor) processOHP() (processResult, error) {
13691371
if err != nil {
13701372
return processResult{}, err
13711373
}
1372-
return processResult{OutConn: p.d.internal, OutAddr: a, OutPkt: p.rawPkt,
1373-
Class: tc.ClsOhp}, nil
1374+
return processResult{OutConn: p.d.internal, OutAddr: a, OutPkt: p.rawPkt}, nil
13741375
}
13751376

13761377
func (d *DataPlane) resolveLocalDst(s slayers.SCION) (*net.UDPAddr, error) {
@@ -1477,17 +1478,8 @@ func (b *bfdSend) Send(bfd *layers.BFD) error {
14771478
return err
14781479
}
14791480

1480-
r := &processResult{
1481-
OutAddr: b.dstAddr,
1482-
OutPkt: buffer.Bytes(),
1483-
OutConn: b.conn,
1484-
EgressID: b.ifID,
1485-
Class: tc.ClsBfd,
1486-
}
1487-
if !b.d.enqueue(r) {
1488-
return serrors.New("Bfd enqueue failed")
1489-
}
1490-
return nil
1481+
_, err = b.conn.WriteTo(buffer.Bytes(), b.dstAddr)
1482+
return err
14911483
}
14921484

14931485
func (p *scionPacketProcessor) prepareSCMP(scmpH *slayers.SCMP, scmpP gopacket.SerializableLayer,

go/pkg/router/tc/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ load("//lint:go.bzl", "go_library")
33
go_library(
44
name = "go_default_library",
55
srcs = [
6-
"colibriprio.go",
76
"others.go",
8-
"roundrobin.go",
97
"strict.go",
108
"tc.go",
119
],

go/pkg/router/tc/colibriprio.go

Lines changed: 0 additions & 49 deletions
This file was deleted.

go/pkg/router/tc/roundrobin.go

Lines changed: 0 additions & 39 deletions
This file was deleted.

go/pkg/router/tc/strict.go

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type StrictPriorityScheduler struct{}
2222

2323
// Schedule schedules packets based on a strict hierarchy, where a message from a
2424
// queue is only scheduled if all higher priority queues are empty.
25-
// The priorities are: COLIBRI > BFD > OHP > EPIC > SCMP > SCION > Others.
25+
// The priorities are: COLIBRI > EPIC > Others.
2626
func (s *StrictPriorityScheduler) Schedule(qs *Queues) ([]ipv4.Message, error) {
2727
read := 0
2828
n, err := qs.dequeue(ClsColibri, outputBatchCnt-read, qs.writeBuffer[read:])
@@ -31,36 +31,12 @@ func (s *StrictPriorityScheduler) Schedule(qs *Queues) ([]ipv4.Message, error) {
3131
}
3232
read = read + n
3333

34-
n, err = qs.dequeue(ClsBfd, outputBatchCnt-read, qs.writeBuffer[read:])
35-
if err != nil {
36-
return nil, err
37-
}
38-
read = read + n
39-
40-
n, err = qs.dequeue(ClsOhp, outputBatchCnt-read, qs.writeBuffer[read:])
41-
if err != nil {
42-
return nil, err
43-
}
44-
read = read + n
45-
4634
n, err = qs.dequeue(ClsEpic, outputBatchCnt-read, qs.writeBuffer[read:])
4735
if err != nil {
4836
return nil, err
4937
}
5038
read = read + n
5139

52-
n, err = qs.dequeue(ClsScmp, outputBatchCnt-read, qs.writeBuffer[read:])
53-
if err != nil {
54-
return nil, err
55-
}
56-
read = read + n
57-
58-
n, err = qs.dequeue(ClsScion, outputBatchCnt-read, qs.writeBuffer[read:])
59-
if err != nil {
60-
return nil, err
61-
}
62-
read = read + n
63-
6440
n, err = qs.dequeue(ClsOthers, outputBatchCnt-read, qs.writeBuffer[read:])
6541
if err != nil {
6642
return nil, err

go/pkg/router/tc/tc.go

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,11 @@ const (
3535
ClsOthers TrafficClass = iota
3636
ClsColibri
3737
ClsEpic
38-
ClsBfd
39-
ClsOhp
40-
ClsScmp
41-
ClsScion
4238
)
4339

4440
// Identify the possible scheduling algorithms.
4541
const (
4642
SchedOthersOnly SchedulerId = iota
47-
SchedRoundRobin
48-
SchedColibriPrio
4943
SchedStrictPriority
5044
)
5145

@@ -77,16 +71,10 @@ func NewQueues(scheduling bool, maxPacketLength int) *Queues {
7771
qs.nonempty = make(chan bool, 1)
7872
qs.mapping = make(map[TrafficClass]*ZeroAllocQueue)
7973

74+
qs.mapping[ClsOthers] = newZeroAllocQueue(128, maxPacketLength)
8075
if scheduling {
81-
qs.mapping[ClsOthers] = newZeroAllocQueue(32, maxPacketLength)
8276
qs.mapping[ClsColibri] = newZeroAllocQueue(32, maxPacketLength)
8377
qs.mapping[ClsEpic] = newZeroAllocQueue(32, maxPacketLength)
84-
qs.mapping[ClsBfd] = newZeroAllocQueue(32, maxPacketLength)
85-
qs.mapping[ClsOhp] = newZeroAllocQueue(32, maxPacketLength)
86-
qs.mapping[ClsScmp] = newZeroAllocQueue(32, maxPacketLength)
87-
qs.mapping[ClsScion] = newZeroAllocQueue(128, maxPacketLength)
88-
} else {
89-
qs.mapping[ClsOthers] = newZeroAllocQueue(128, maxPacketLength)
9078
}
9179

9280
qs.writeBuffer = conn.NewReadMessages(outputBatchCnt)
@@ -96,16 +84,12 @@ func NewQueues(scheduling bool, maxPacketLength int) *Queues {
9684
// SetScheduler assigns the provided scheduler to the queues.
9785
func (qs *Queues) SetScheduler(s SchedulerId) {
9886
switch s {
99-
case SchedRoundRobin:
100-
qs.scheduler = &RoundRobinScheduler{}
101-
case SchedColibriPrio:
102-
qs.scheduler = &ColibriPriorityScheduler{}
10387
case SchedOthersOnly:
10488
qs.scheduler = &OthersOnlyScheduler{}
10589
case SchedStrictPriority:
10690
qs.scheduler = &StrictPriorityScheduler{}
10791
default:
108-
qs.scheduler = &RoundRobinScheduler{}
92+
qs.scheduler = &StrictPriorityScheduler{}
10993
}
11094
}
11195

@@ -278,14 +262,6 @@ func (tc TrafficClass) String() string {
278262
return "COLIBRI"
279263
case ClsEpic:
280264
return "EPIC"
281-
case ClsBfd:
282-
return "BFD"
283-
case ClsOhp:
284-
return "OHP"
285-
case ClsScmp:
286-
return "SCMP"
287-
case ClsScion:
288-
return "SCION"
289265
default:
290266
return "Unknown traffic class"
291267
}

0 commit comments

Comments
 (0)