feat(ber): Add a raw BER run with p=p31 and sleep 40

blanton_ber_debug.sh runs the hand-pasted flow from tools/BER_Test.txt
as one command: prbs set p=p31, prbs get twice, prbsstat STArt
Interval=30, sleep 40, Ber, STOp, prbs clear. Every bcmcmd output is
printed as is under a timestamped header; there is no parsing, no
PASS/FAIL and no summary. -u 0 / -u 1 picks one switch unit, both by
default. The port list is the 200G ports without 268, as in
BER_Test.txt; BER_PORTS, BER_POLY, BER_INTERVAL and BER_WAIT can be
overridden. blanton_ber.sh is left unchanged.

BER_Test.txt: p=3 -> p=p31 (verified on the bench), plus a unit 1
block, a both-units block and port en=0/1 for every cabled port.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0131orciRKrejchsuDk6UpXk
This commit is contained in:
2026-10-21 09:01:55 +08:00
co-authored by Claude Opus 5.5
parent 4db9b45ce7
commit b652ec8072
2 changed files with 144 additions and 1 deletions
@@ -0,0 +1,100 @@
#!/usr/bin/env bash
# =============================================================================
# blanton_ber_debug.sh -- SerDes BER, raw run of tools/BER_Test.txt
# =============================================================================
# Version History:
# V1.0.0 2026-10-07 First version. Runs the hand-pasted BER flow end to end
# (prbs set p=p31 / prbs get x2 / STArt / sleep 40 / Ber /
# STOp / clear) and prints every bcmcmd output as is --
# no parsing, no PASS/FAIL, no summary. blanton_ber.sh is
# the judged version; this one is for looking at the raw
# output on the bench.
#
# Order of operations (per step, unit 0 first, then unit 1):
# phydiag <ports> prbs set p=p31
# phydiag <ports> prbs get twice: the 1st clears the sticky
# phydiag <ports> prbs get "unlocked since last call", the 2nd
# is the current lock state
# phydiag <ports> prbsstat STArt Interval=30
# sleep 40 MUST be > Interval, or Ber is read
# before the first interval settles
# phydiag <ports> prbsstat Ber
# phydiag <ports> prbsstat STOp
# phydiag <ports> prbs clear releases the lanes back to normal
#
# ⚠️ Links show DOWN while PRBS runs -- that is expected.
# ⚠️ Do not run together with blanton_ber.sh / blanton_traffic_linespeed.sh /
# blanton_tr518.sh -- they all take over the same ports.
#
# Usage:
# ./blanton_ber_debug.sh # unit 0 and 1
# ./blanton_ber_debug.sh -u 0 # unit 0 only
# ./blanton_ber_debug.sh -u 1 # unit 1 only
#
# Env overrides:
# BCMCMD_CMD=bcmcmd BER_POLY=p=p31 BER_INTERVAL=30 BER_WAIT=40
# BER_PORTS="1-24,..." (default: the 200G ports, no 268 -- same as
# tools/BER_Test.txt; add ",268" for the 100G uplink)
# =============================================================================
BCMCMD_CMD="${BCMCMD_CMD:-bcmcmd}"
BER_UNITS="0 1"
BER_PORTS="${BER_PORTS:-1-24,40-96,112-168,184-240,256-259,270-308,310-327,342-380,382-399,414-452,454-471,486-524,526-543,558-565}"
BER_POLY="${BER_POLY:-p=p31}"
BER_INTERVAL="${BER_INTERVAL:-30}"
BER_WAIT="${BER_WAIT:-40}"
usage() {
sed -n '/^# Usage:/,/^# =====/p' "$0" | sed '$d; s/^# \{0,1\}//'
}
while [ $# -gt 0 ]; do
case "$1" in
-u|--unit)
case "$2" in
0|1) BER_UNITS="$2" ;;
*) echo "[ERR ] invalid unit '$2' (use 0 or 1)" >&2; exit 2 ;;
esac
shift 2 ;;
-h|--help) usage; exit 0 ;;
*) echo "[ERR ] unknown option '$1'" >&2; usage >&2; exit 2 ;;
esac
done
# bcmcmd reads stdin -- keep it on /dev/null (see blanton_traffic_linespeed.sh V0.3.1)
_bcm() {
local unit="$1"; shift
local cmd="dsh -c 'phydiag ${BER_PORTS} $*'"
echo
echo "### [$(date '+%F %T')] unit $unit: phydiag <ports> $*"
"$BCMCMD_CMD" -n "$unit" -c " ${cmd} " </dev/null 2>&1
}
for u in $BER_UNITS; do
_bcm "$u" "prbs set ${BER_POLY}"
_bcm "$u" "prbs get"
_bcm "$u" "prbs get"
done
for u in $BER_UNITS; do
_bcm "$u" "prbsstat STArt Interval=${BER_INTERVAL}"
done
echo
echo "### [$(date '+%F %T')] sleep ${BER_WAIT}"
sleep "$BER_WAIT"
for u in $BER_UNITS; do
_bcm "$u" "prbsstat Ber"
done
for u in $BER_UNITS; do
_bcm "$u" "prbsstat STOp"
done
for u in $BER_UNITS; do
_bcm "$u" "prbs clear"
done
echo
echo "### [$(date '+%F %T')] BER_DEBUG_DONE units: $BER_UNITS"