diff --git a/acceptance/router_benchmark/benchmarklib.py b/acceptance/router_benchmark/benchmarklib.py index cbcced3f2e..4290de20bb 100644 --- a/acceptance/router_benchmark/benchmarklib.py +++ b/acceptance/router_benchmark/benchmarklib.py @@ -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: " @@ -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. diff --git a/acceptance/router_benchmark/brload/main.go b/acceptance/router_benchmark/brload/main.go index 3b29d0c1f9..161f7d43a3 100644 --- a/acceptance/router_benchmark/brload/main.go +++ b/acceptance/router_benchmark/brload/main.go @@ -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 @@ -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) } diff --git a/acceptance/router_benchmark/brload/mmsg.go b/acceptance/router_benchmark/brload/mmsg.go index 532266654f..3a9f59f68a 100644 --- a/acceptance/router_benchmark/brload/mmsg.go +++ b/acceptance/router_benchmark/brload/mmsg.go @@ -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 } @@ -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 } @@ -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 { diff --git a/acceptance/router_benchmark/test.py b/acceptance/router_benchmark/test.py index 6fe8e4affc..af1049140a 100644 --- a/acceptance/router_benchmark/test.py +++ b/acceptance/router_benchmark/test.py @@ -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 diff --git a/control/beaconing/propagator.go b/control/beaconing/propagator.go index 588ea9acaf..85cb1ec0f4 100644 --- a/control/beaconing/propagator.go +++ b/control/beaconing/propagator.go @@ -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, @@ -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(), @@ -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,