Skip to content

Commit

Permalink
Merge branch 'master' into fixup_wireshark_dissector_conversation_start
Browse files Browse the repository at this point in the history
  • Loading branch information
FR4NK-W authored Aug 14, 2024
2 parents 61e7b61 + 261f66c commit 5bbd764
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
4 changes: 3 additions & 1 deletion acceptance/router_benchmark/benchmarklib.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def run_test_case(self, case: str, map_args: list[str]) -> (int, int):
output = self.exec_br_load(case, map_args, 13)
end = "0"
for line in output.splitlines():
logger.info("BrLoad output: " + line)
if line.startswith("metricsBegin"):
end = line.split()[3] # "... metricsEnd: <end>"

Expand Down Expand Up @@ -322,7 +323,8 @@ def run_bm(self, test_cases: [str]) -> Results:
self.exec_br_load(test_cases[0], map_args, 5)

# Fetch the core count once. It doesn't change while the router is running.
# We can't get it until the router has done some work, but the warmup is enough.
# We cannot get this until the router has been up for a few seconds. If you shorten
# the warmup for some reason, make sure to add a delay.
cores = self.core_count()

# At long last, run the tests.
Expand Down
3 changes: 2 additions & 1 deletion acceptance/router_benchmark/brload/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ func run(cmd *cobra.Command) int {
binary.BigEndian.PutUint16(allPkts[j][44:46], uint16(numPkt%int(numStreams)))
numPkt++
}

if _, err := sender.sendAll(); err != nil {
log.Error("writing input packet", "case", string(caseToRun), "error", err)
return 1
Expand Down Expand Up @@ -303,7 +304,7 @@ func openDevices(interfaceNames []string) (map[string]*afpacket.TPacket, error)
handles := make(map[string]*afpacket.TPacket)

for _, intf := range interfaceNames {
handle, err := afpacket.NewTPacket(afpacket.OptInterface(intf))
handle, err := afpacket.NewTPacket(afpacket.OptInterface(intf), afpacket.OptFrameSize(4096))
if err != nil {
return nil, serrors.WrapStr("creating TPacket", err)
}
Expand Down
6 changes: 5 additions & 1 deletion acceptance/router_benchmark/brload/mmsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ import (
type mmsgHdr struct {
hdr unix.Msghdr
len uint32
_ [4]byte
}

// mpktSender is a helper class to add the ability of using the sendmmsg system call
// with afpacket sockets.
type mpktSender struct {
fd int
tp *afpacket.TPacket
msgs []mmsgHdr
iovecs []unix.Iovec
}
Expand All @@ -42,6 +44,8 @@ func newMpktSender(tp *afpacket.TPacket) *mpktSender {
// than this) to the afpacket project and get it merged.
fdv := reflect.ValueOf(tp).Elem().FieldByName("fd")
sender.fd = int(fdv.Int())
// This is to make sure that tp cannot be finalized before we're done abusing its file desc.
sender.tp = tp
return sender
}

Expand All @@ -66,7 +70,7 @@ func (sender *mpktSender) sendAll() (int, error) {
// use case.
n, _, err := unix.Syscall6(unix.SYS_SENDMMSG,
uintptr(sender.fd),
(uintptr)(unsafe.Pointer(&sender.msgs[0])),
uintptr(unsafe.Pointer(&sender.msgs[0])),
uintptr(len(sender.msgs)),
0, 0, 0)
if err == 0 {
Expand Down
2 changes: 1 addition & 1 deletion acceptance/router_benchmark/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
logger = logging.getLogger(__name__)

# Default packet length for CI testing
BM_PACKET_SIZE = 172
BM_PACKET_SIZE = 1500

# Router profiling ON or OFF?
PROFILING = False
Expand Down
14 changes: 6 additions & 8 deletions control/beaconing/propagator.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,17 +287,14 @@ func (p *propagator) Propagate(ctx context.Context) error {
defer log.HandlePanic()
defer wg.Done()

var id string
debugEnabled := logger.Enabled(log.DebugLevel)
if debugEnabled {
// Collect the ID before the segment is extended such that it
// matches the ID that was logged above in logCandidateBeacons.
id = b.Segment.GetLoggingID()
}
// Collect the ID before the segment is extended such that it
// matches the ID that was logged above in logCandidateBeacons.
id := b.Segment.GetLoggingID()

if err := p.extender.Extend(ctx, b.Segment, b.InIfID, egress, p.peers); err != nil {
logger.Error("Unable to extend beacon",
"egress_interface", egress,
"beacon.id", id,
"beacon.ingress_interface", b.InIfID,
"beacon.segment", hopsDescription(b.Segment.ASEntries),
"err", err,
Expand All @@ -310,6 +307,7 @@ func (p *propagator) Propagate(ctx context.Context) error {
if err := sender.Send(ctx, b.Segment); err != nil {
logger.Info("Unable to send beacon",
"egress_interface", egress,
"beacon.id", id,
"beacon.ingress_interface", b.InIfID,
"beacon.segment", hopsDescription(b.Segment.ASEntries),
"waited_for", time.Since(sendStart).String(),
Expand All @@ -323,7 +321,7 @@ func (p *propagator) Propagate(ctx context.Context) error {
p.incMetric(b.Segment.FirstIA(), b.InIfID, egress, prom.Success)
p.intf.Propagate(p.now)

if debugEnabled {
if logger.Enabled(log.DebugLevel) {
logger.Debug("Propagated beacon",
"egress_interface", egress,
"candidate_id", id,
Expand Down

0 comments on commit 5bbd764

Please sign in to comment.