Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/buildomat/jobs/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,19 @@ fi

pfexec /usr/lib/brand/omicron1/baseline -w /var/run/brand/omicron1/baseline

# Resolve the invoking user for ownership restoration. When this script is run
# elevated locally, the effective `id -un` resolves to root and would chown the
# tree to root. Prefer `$SUDO_USER` (set by sudo), then `logname`, which reports
# the login user across pfexec. Fall back to `id` in CI, however.
run_user=${SUDO_USER:-$(logname 2>/dev/null || id -un)}
run_group=$(id -gn "$run_user" 2>/dev/null || id -gn)

function cleanup {
pfexec chown -R `id -un`:`id -gn` .
# A restore-to-owner that resolves to root would defeat its own purpose.
# Skip rather than re-root the tree.
if [[ $run_user != root ]]; then
pfexec chown -R "$run_user":"$run_group" .
fi
if [[ -z $BUILDOMAT_JOB_ID ]]; then
pfexec rm -rf /input/xde
fi
Expand All @@ -67,7 +78,14 @@ function get_artifact {
return $curl_res
}

OUT_DIR=/work/bench-results
# TGT_BASE allows one to run this more easily in their local
# environment:
#
# TGT_BASE=/var/tmp ./bench.sh
#
TGT_BASE=${TGT_BASE:=/work}

OUT_DIR=$TGT_BASE/bench-results

mkdir -p $OUT_DIR
mkdir -p target/criterion
Expand Down Expand Up @@ -118,6 +136,6 @@ cargo ubench
cp -r target/criterion $OUT_DIR
cp -r target/xde-bench $OUT_DIR

pushd /work
pushd $TGT_BASE
tar -caf bench-results.tgz bench-results
popd
13 changes: 10 additions & 3 deletions .github/buildomat/jobs/opteadm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,16 @@ ptime -m cargo build --release

popd

# TGT_BASE allows one to run this more easily in their local
# environment:
#
# TGT_BASE=/var/tmp ./opteadm.sh
#
TGT_BASE=${TGT_BASE:=/work}

for x in debug release
do
mkdir -p /work/$x
cp target/$x/opteadm /work/$x/
sha256sum "target/$x/opteadm" > "/work/$x/opteadm.$x.sha256"
mkdir -p $TGT_BASE/$x
cp target/$x/opteadm $TGT_BASE/$x/
sha256sum "target/$x/opteadm" > "$TGT_BASE/$x/opteadm.$x.sha256"
done
26 changes: 24 additions & 2 deletions .github/buildomat/jobs/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,36 @@ set -o xtrace

pfexec pkg install brand/omicron1 brand/omicron1/tools opte

# TGT_BASE mirrors the artifact location used by xde.sh. Override it to match a
# local xde.sh run, e.g. TGT_BASE=/var/tmp ./test.sh, so the test binaries are
# found without forced writing to the root-owned /work.
TGT_BASE=${TGT_BASE:=/work}

if [[ -z $BUILDOMAT_JOB_ID ]]; then
echo Note: if you are running this locally, you must run the xde.sh job first
echo to have the artifacts at the expected spot.
pfexec mkdir -p /input/xde
pfexec ln -s /work /input/xde/work
# Replace any stale symlink from an interrupted prior run so the link is
# idempotent across local re-runs.
pfexec rm -f /input/xde/work
pfexec ln -s $TGT_BASE /input/xde/work
fi

pfexec /usr/lib/brand/omicron1/baseline -w /var/run/brand/omicron1/baseline

# Resolve the invoking user for ownership restoration. When this script is run
# elevated locally, the effective `id -un` resolves to root and would chown the
# tree to root. Prefer `$SUDO_USER` (set by sudo), then `logname`, which reports
# the login user across pfexec. Fall back to `id` in CI, however.
run_user=${SUDO_USER:-$(logname 2>/dev/null || id -un)}
run_group=$(id -gn "$run_user" 2>/dev/null || id -gn)

function cleanup {
pfexec chown -R `id -un`:`id -gn` .
# A restore-to-owner that resolves to root would defeat its own purpose.
# Skip rather than re-root the tree.
if [[ $run_user != root ]]; then
pfexec chown -R "$run_user":"$run_group" .
fi
if [[ -z $BUILDOMAT_JOB_ID ]]; then
pfexec rm -rf /input/xde
fi
Expand Down Expand Up @@ -98,6 +117,9 @@ pfexec /input/xde/work/test/multicast_validation --nocapture --test-threads=1
pfexec chmod +x /input/xde/work/test/multicast_source_filter
pfexec /input/xde/work/test/multicast_source_filter --nocapture --test-threads=1

pfexec chmod +x /input/xde/work/test/multicast_multi_nexthop
pfexec /input/xde/work/test/multicast_multi_nexthop --nocapture --test-threads=1

banner "teardown"
# Ensure full driver teardown is exercised after tests complete
pfexec rem_drv xde
21 changes: 14 additions & 7 deletions .github/buildomat/jobs/xde.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#: "=/work/test/multicast_multi_sub",
#: "=/work/test/multicast_validation",
#: "=/work/test/multicast_source_filter",
#: "=/work/test/multicast_multi_nexthop",
#: "=/work/xde.conf",
#: ]
#:
Expand Down Expand Up @@ -62,7 +63,7 @@ install_pkg jq

pushd xde

cp xde.conf /work/xde.conf
cp xde.conf $TGT_BASE/xde.conf

header "check style"
ptime -m cargo +$NIGHTLY fmt -p xde -p xde-link -- --check
Expand Down Expand Up @@ -140,9 +141,15 @@ multicast_source_filter_test=$(
cargo build -q --test multicast_source_filter --message-format=json |\
jq -r "select(.profile.test == true) | .filenames[]"
)
mkdir -p /work/test
cp $loopback_test /work/test/loopback
cp $multicast_rx_test /work/test/multicast_rx
cp $multicast_multi_sub_test /work/test/multicast_multi_sub
cp $multicast_validation_test /work/test/multicast_validation
cp $multicast_source_filter_test /work/test/multicast_source_filter
cargo build --test multicast_multi_nexthop
multicast_multi_nexthop_test=$(
cargo build -q --test multicast_multi_nexthop --message-format=json |\
jq -r "select(.profile.test == true) | .filenames[]"
)
mkdir -p $TGT_BASE/test
cp $loopback_test $TGT_BASE/test/loopback
cp $multicast_rx_test $TGT_BASE/test/multicast_rx
cp $multicast_multi_sub_test $TGT_BASE/test/multicast_multi_sub
cp $multicast_validation_test $TGT_BASE/test/multicast_validation
cp $multicast_source_filter_test $TGT_BASE/test/multicast_source_filter
cp $multicast_multi_nexthop_test $TGT_BASE/test/multicast_multi_nexthop
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ crc32fast = { version = "1", default-features = false }
criterion = "0.8"
ctor = "0.10"
darling = "0.23"
dlpi = { git = "https://github.com/oxidecomputer/dlpi-sys", default-features = false }
dyn-clone = "1.0"
heapless = "0.8"
ingot = "0.1.1"
Expand Down
24 changes: 24 additions & 0 deletions dtrace/opte-mcast-delivery.d
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ mcast-local-delivery {
@by_vni["DELIVER", this->vni] = count();
@by_port[this->port] = count();
@by_group["DELIVER", this->group_str] = count();

/* Per-(port,group,vni) delivery matrix for end-to-end fan-out verification. */
@deliver_by_port_group[this->port, this->group_str, this->vni] = count();
}

mcast-local-delivery
Expand Down Expand Up @@ -165,6 +168,9 @@ mcast-underlay-fwd {
@by_vni["UNDERLAY", this->vni] = count();
@by_underlay["UNDERLAY", this->underlay_str] = count();
@by_nexthop_unicast[this->next_hop_str] = count();

/* Per-(group,vni,next-hop) fan-out; cross-checks ddm-peers rear-port count. */
@fwd_by_group_nh[this->underlay_str, this->vni, this->next_hop_str] = count();
}

mcast-underlay-fwd
Expand Down Expand Up @@ -421,6 +427,11 @@ mcast-source-filtered {
@by_vni["FILTERED", this->vni] = count();
@by_port[this->port] = count();
@filtered_by_mode[this->mode_str] = count();

/* Per-(event,scope,group,vni) drops for end-to-end loss attribution.
* The scope names the address space of the group column: overlay for the
* inner multicast group, underlay for the outer delivery address. */
@drops["FILTERED", "overlay", this->dst_str, this->vni] = count();
}

mcast-source-filtered
Expand Down Expand Up @@ -454,6 +465,9 @@ mcast-fwd-source-filtered {
@by_vni["FWD_FILT", this->vni] = count();
@by_nexthop_unicast[this->next_hop_str] = count();
@filtered_by_mode[this->mode_str] = count();

/* Per-(event,scope,group,vni) drops; see mcast-source-filtered. */
@drops["FWD_FILT", "overlay", this->dst_str, this->vni] = count();
}

mcast-fwd-source-filtered
Expand All @@ -473,9 +487,13 @@ mcast-no-fwd-entry {
/* arg0=underlay_ptr, arg1=vni */
this->underlay = (in6_addr_t *)arg0;
this->vni = arg1;
this->underlay_str = inet_ntoa6(this->underlay);

/* Always track aggregations */
@by_event["NOFWD"] = count();

/* Per-(event,scope,group,vni) drops; see mcast-source-filtered. */
@drops["NOFWD", "underlay", this->underlay_str, this->vni] = count();
}

mcast-no-fwd-entry
Expand All @@ -499,10 +517,16 @@ END
printa(@by_underlay);
printf("\nLocal delivery by port:\n");
printa(@by_port);
printf("\nDelivery matrix (port, group, vni):\n");
printa(@deliver_by_port_group);
printf("\nForwarding by unicast next hop (routing address):\n");
printa(@by_nexthop_unicast);
printf("\nForwarding fan-out (underlay group, vni, next hop):\n");
printa(@fwd_by_group_nh);
printf("\nSource filtering by mode:\n");
printa(@filtered_by_mode);
printf("\nDrops (event, scope, group, vni):\n");
printa(@drops);
printf("\nConfig ops:\n");
printa(@cfg_counts);
}
1 change: 1 addition & 0 deletions xde-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ opte-test-utils.workspace = true
oxide-vpc.workspace = true

anyhow.workspace = true
dlpi.workspace = true
libnet.workspace = true
rand.workspace = true
slog.workspace = true
Expand Down
Loading