Compare commits

..
5 Commits
Author SHA1 Message Date
etwenandClaude Opus 5.5 16da1c68f2 docs: Record V1.2.5 in Script A's history and add the release note
Script A: header to V1.2.5 / 2026-10-21; entries for
blanton_ber_debug.sh, retimer_lanes.sh, unused_lanes.sh, the PMON power
readback, the --force on the USB stress, the boot cycle title and the
fast boot cycle, with notes on p=p31 vs blanton_ber.sh's p=3, the
missing port 268, the double read in Script 4, the exec bits and the
EN_Cold_Warm_boot = 0 hang.

CLAUDE.md / ARCHITECTURE.md: status and release to V1.2.5, the new
scripts in the overview, the tree and the commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0131orciRKrejchsuDk6UpXk
2026-10-21 09:01:55 +08:00
etwenandClaude Opus 5.5 f378340f41 feat(boot): Add a fast boot cycle and show the count in the title
5_1_Blanton_Script_Boot_Cycle_Fast.ttl is Script 5 with the traffic run
removed from Check Pt8; only 'blanton_traffic_linespeed ps' is left,
for a shorter cycle when the boot count is what matters.

Script 5 sets the window title to 'Reboot Cycle Test : n' or 'Power
Cycle Test : n' every round. Script B and Script 5 pass --force to
qfx5252-stress-usb.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0131orciRKrejchsuDk6UpXk
2026-10-21 09:01:55 +08:00
etwenandClaude Opus 5.5 fd2282d34b feat(pwr): Read switch-board rail power in every PMON snapshot
setup_pmon.ttl now calls TH6_SWB0/1_power_readback.sh after show
platform current, so Script A, B, C, 4 and 5 all log the 19 rails of
each switch board. Script 4 still calls both readbacks in its own loop
as well, so it reads them twice per round.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0131orciRKrejchsuDk6UpXk
2026-10-21 09:01:55 +08:00
etwenandClaude Opus 5.5 aed2be66b2 feat(retimer): Add tools to turn off TX on unused lanes
retimer_lanes.sh turns TX off / on, or shows the state, for a lane map
of one Agera3 retimer on both the sys and the line side, by TX squelch
(default) or lane power-down. It refuses 'off' on lanes with RX PMD
lock unless --force is given, and reads the state back to print PASS
or FAIL.

unused_lanes.sh applies that to a built-in table of 14 retimer rows and
one direct-TH6 row (TSC31) on each switch board; TH6 rows go through
'port ... enable=' in the syncd container. --asic, --th6, --only and
--force select what it touches; it ends with ok / refused / failed
counts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0131orciRKrejchsuDk6UpXk
2026-10-21 09:01:55 +08:00
etwenandClaude Opus 5.5 b652ec8072 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
2026-10-21 09:01:55 +08:00
12 changed files with 910 additions and 10 deletions
+7 -3
View File
@@ -162,6 +162,7 @@ Blanton_TTL_Script/
│
├── 4_Blanton_Script_thermal_safety.ttl # 熱 / 安規:獨立跑,不接 A→B→C
├── 5_Blanton_Script_Boot_Cycle.ttl # 開機循環(warm / cold,EN_Cold_Warm_boot):獨立跑,while 1 無止境
├── 5_1_Blanton_Script_Boot_Cycle_Fast.ttl # 同 Script 5,但 Check Pt8 只跑 traffic ps(不打流量),循環較短
├── 6_Blanton_Script_BER_Cycle.ttl # Diag ↔ SONiC 冷開機循環,兩邊各量一次 unit 0 BER:獨立跑,while 1
├── config.ttl # 全域設定:testcase 名、EN_Margin / EN_TX_FIR / EN_log / EN_timestamp、
│ # 風扇與 SWB 宣告、SSD/USB/BMC_USB 壓力秒數、三個 prompt 字串
@@ -205,6 +206,7 @@ Blanton_TTL_Script/
│ # ⚠️ V1.1.9 起 A/B/C 內註解掉的呼叫已整段刪除,只剩手動執行
├── blanton_ber.sh # 全機 SerDes BER 掃描(phydiag prbs / prbsstat)
│ # V1.2.2 起含 port 268(100G ce0),summary 每 unit 分 200G/100G/TOTAL
├── blanton_ber_debug.sh # BER 原始輸出(p=p31、sleep 40、-u 0|1),不判定
├── bcm_100g_dsc_cycle.sh # 100G link down/up 循環 + 每輪 DSC 與 retimer TX/RX 讀回(未驗證)
├── bcm_dsc_scan.sh # 全機 SerDes DSC dump(phydiag <port> dsc,~445 port × 2 unit)
│ # 由 EN_TX_FIR 控制,A 與 C 各掃一次;單次約 10 分鐘
@@ -216,11 +218,13 @@ Blanton_TTL_Script/
├── blanton_tr518.sh # TR518 封包測試,量功耗前的負載來源
├── TH6_SWB0_power_readback.sh # SWB0 19 條軌 V×I + 總功耗
├── TH6_SWB1_power_readback.sh # SWB1 同上
│ # ⚠️ 已納入交付,但 A/B/C 的呼叫仍註解掉(bring-up 中)
│ # V1.2.5 起由 utils/setup_pmon.ttl 呼叫,每個 PMON 快照都有
├── ddr5_temp.sh # DDR5 DIMM 溫度(SPD5118 @ i2c-5 0x50/0x51,reg 0x31)
├── hsc_temp_readback.sh # LTC4287 HSC 溫度(i2c-28 0x40/0x45,內/外部感溫)
├── avt_pmpower.sh # AMD CPU 封裝功耗(AVTCMD pmm get_pmdata;AVT 是 NDA,不隨包)
├── tray_id_stress.sh # Tray ID I2C stress(bus 34/35/38/39 0x70 reg 0x02,寫 0xA5/0x5A 讀回)
├── retimer_lanes.sh # 單顆 Agera3 retimer 的 lane TX off/on/status(sys + line side)
├── unused_lanes.sh # 依內建表把沒接線的 retimer lane / TH6 port 關掉(呼叫 retimer_lanes.sh)
├── usb_target.sh # 偵測 USB 裝置節點/掛載點(排除系統碟)
├── bmc_monitor.sh # BMC 監控:free -m + I2C 寫入/讀回圖樣測試
├── bmc_monitor_ddr.sh # ⚠️ 已停用:V1.1.9 起 B/C 內的註解區塊已刪除,DDR 壓力走 bgctl + bmc-manager
@@ -383,7 +387,7 @@ PROFILE_CHANNELS=( "0:high:8" "1:low:8" ... ) # "channel:operation:change_perc
| 模組 | 進入點 | 功能 |
|------|--------|------|
| **Script A(Pre-test)** | `1_Blanton_Script_A.ttl` V1.2.4 | root 登入 → `date -s` 對時 → 清 job log → **收掉前一輪殘留**(`hw-test-session finish` → `bgctl reset --yes` → `bgctl stop --all` → `bgctl list` 確認清空)→ `hw-test-session start` → **設定風扇轉速** → **等資料面就緒**(`wait_init.ttl`)→ DUT 清單(boot/version/fwutil/syseeprom/ssdhealth/TPM/NVMe)→ BMC enroll + version/status → source bash 工具 → 清/讀 7 組 PCIe AER + `ras-mc-ctl --summary` → `lspci` → margin → PMON → dmesg → **10G/1G 管理網路 ping** → **NFC 基線**(start → 30s → stop → report)→ 100G uplink 設定與狀態 → **BER 基線掃描**(依 `SWB_UNIT`,V1.2.1 新增)→ **一輪流量基線** → **SerDes DSC 基線**(`EN_TX_FIR`)→ `show uptime` |
| **Script A(Pre-test)** | `1_Blanton_Script_A.ttl` V1.2.5 | root 登入 → `date -s` 對時 → 清 job log → **收掉前一輪殘留**(`hw-test-session finish` → `bgctl reset --yes` → `bgctl stop --all` → `bgctl list` 確認清空)→ `hw-test-session start` → **設定風扇轉速** → **等資料面就緒**(`wait_init.ttl`)→ DUT 清單(boot/version/fwutil/syseeprom/ssdhealth/TPM/NVMe)→ BMC enroll + version/status → source bash 工具 → 清/讀 7 組 PCIe AER + `ras-mc-ctl --summary` → `lspci` → margin → PMON → dmesg → **10G/1G 管理網路 ping** → **NFC 基線**(start → 30s → stop → report)→ 100G uplink 設定與狀態 → **BER 基線掃描**(依 `SWB_UNIT`,V1.2.1 新增)→ **一輪流量基線** → **SerDes DSC 基線**(`EN_TX_FIR`)→ `show uptime` |
| **Script B(Stress)** | `2_Blanton_Script_B.ttl` | **V1.1.8 起 `mlucas-avx2 -cpu 0:15` 由 `systemd-run --unit=mlucas-amm`(`Type=exec`、`Restart=always`)啟動,不再是 shell 的 `&` 背景 job** + `bgctl run` 的 `memtester` / SSD / USB 壓力(v1.1.7 起 SSD/USB 的 `--runtime`/`--passes` 讀 `config.ttl` 的 `SSD_RUNTIME`/`SSD_COUNT`、`USB_RUNTIME`/`USB_COUNT`;BMC memtester 不帶次數 = 跑到被停) + BMC DDR(`bmc-manager run memtester`)→ BMC USB net test(探測 cdc_ncm 介面,`systemd-run` 掛 `BMC_USB_RUNTIME` 秒的 ping,V1.1.8 前寫死 4 小時)→ 啟動 mgmt ping 監控 → **啟動 NFC 輪詢** → `jobs` / `systemctl is-active mlucas-amm` / `bgctl list` → traffic(依 `SWB_UNIT`)→ `while 1` 每輪 PMON + `bgctl list`/`jobs`/`systemctl is-active mlucas-amm` + `sleep 60`(**V1.1.4 起 margin 不在迴圈內**;V1.2.0 起等待走 DUT 端 `sleep` 而非 macro 端 `pause`)|
| **Script C(Post-test)** | `3_Blanton_Script_C.ttl` | `kill $(jobs -p)` + **`systemctl stop mlucas-amm`**(systemd unit 不是 shell job,`jobs -p` 抓不到)+ `bgctl stop --all` / `reset` + 停 BMC USB unit、mgmt ping 與 **NFC 輪詢** → PMON + dmesg → 7 組 AER + `ras-mc-ctl` → BMC USB `journalctl` **寫進 `log/bmc_usb_net.log`**(不再印在 console) → `ip -s link show eth0/eth1` → `cat` mlucas log(並 `cp` 進 job 目錄一起帶走)→ **NFC `report`** → traffic `stop` + `report` → **SerDes DSC 收尾**(`EN_TX_FIR`)→ **BER 掃描**(依 `SWB_UNIT`)→ NVMe 健康 → `show reboot-cause` → **margin 掃描**(`EN_Margin`,V1.1.4 由 Script B 移來)→ `uptime` → **job log 複製到 USB(帶時戳)** → `exit` + wait『Script done』→ `hw-test-session finish` |
| **Script 4(Thermal / Safety)** | `4_Blanton_Script_thermal_safety.ttl` | **獨立腳本,不接 A→B→C。** Script A 式的環境建立(登入 / session / 風扇 / `wait_init` / DUT 清單 / BMC / PCIe 清除 / `pcie_bus` / PMON / dmesg)→ **滿載**(`mlucas-avx2 -cpu 0:15`,V1.1.8 起與 Script B 同樣掛成 `mlucas-amm` systemd unit + `blanton_tr518.sh start`)→ `while 1`:PMON + `TH6_SWB0/1_power_readback.sh` + `avt_pmpower.sh`(CPU 封裝功耗,V1.2.3)+ `bgctl list` / `jobs` / `systemctl is-active mlucas-amm`,`pause 60`。**沒有收尾段** —— 中斷後 DUT 仍在 `port cd lb=mac` / `l2 learn off` / `test mode nr=yes`,且 CPU 仍滿載,要手動 `blanton_tr518.sh stop` + `systemctl stop mlucas-amm` |
@@ -814,7 +818,7 @@ margin status、全部 VRM 軌的 Vin/Vout/Iout/Temp、CB + ICB 溫感讀值,
- [ ] `CHANGELOG.md`:延續三支腳本頂端的 Version History,集中成一份
- [ ] 三支腳本的 header 版號與 `CHANGELOG.md` 對齊,`config.ttl` 加 `script_version` 並寫進 log 開頭
- [ ] `docs/TTL_Script_Blanton_Status_*.xlsx` 更新為全 OK,或把剩餘項目移進 Future Extensions
- [x] 打 git tag,push `nas` + `gitea`(已至 `V1.2.4`;`publish/` 依 Script A 檔頭版號打包)
- [x] 打 git tag,push `nas` + `gitea`(已至 `V1.2.5`;`publish/` 依 Script A 檔頭版號打包)
**驗收條件:** 從 zip 解壓到一台乾淨的測試 NB,照 README 操作,不看原始碼就能完成一輪 A→B→C
並產出 summary;`publish/` 內容與 git tag 一致。
+20 -2
View File
@@ -9,7 +9,7 @@ DUT 端的取數能力由一組 **bash 工具庫** 提供(CB FPGA `pcimem` →
完整架構見 [ARCHITECTURE.md](ARCHITECTURE.md)。
**目前狀態(2026-10-01)**:Script A 為 **V1.2.4**(A 集中記錄所有 TTL 的變更)。涵蓋
**目前狀態(2026-10-21)**:Script A 為 **V1.2.5**(A 集中記錄所有 TTL 的變更)。涵蓋
PCIe AER / DDR EDAC / PMON+TPM / 電壓 margin(9 顆 LTC2980)/ SWB loopback 線速流量 /
10G+1G 管理網路 ping / BMC DDR 與 USB / NVMe 健康,壓力層走平台的 `bgctl`。
switch unit 數量由 `config.ttl` 的 `SWB_UNIT0` / `SWB_UNIT1` 宣告,風扇轉速由 `FAN_SPEED` 指定
@@ -39,11 +39,15 @@ NFC tag 讀取由 `nfc_polling.sh` 背景輪詢(A 做基線、B 起、C 停並
**V1.2.4 新增 Tray ID I2C stress(`tray_id_stress.sh`)**:Script A 跑一次當基線、Script B 每輪 soak 跑一次。
另新增 **`6_Blanton_Script_BER_Cycle.ttl`**(Diag ↔ SONiC 冷開機循環量 BER,**獨立跑不接 A→B→C**),
操作與分析見 `tmp/BER_Test_Cycle/runbook.md`(tmp 不進 git)。
**V1.2.5 起 PMON 快照也帶兩片 SWB 的軌功耗**(`TH6_SWB{0,1}_power_readback.sh` 搬進 `setup_pmon.ttl`),
⚠️ Script 4 迴圈原本就自己讀一次,現在**每輪讀兩次**。V1.2.5 另有 `blanton_ber_debug.sh`(BER 原始輸出、`p=p31`、`sleep 40`)、
`retimer_lanes.sh` / `unused_lanes.sh`(把沒接線的 retimer lane / TH6 port 關 TX),以及
`5_1_Blanton_Script_Boot_Cycle_Fast.ttl`(Script 5 拿掉流量那段,只留 `ps`)。
以及 **`5_Blanton_Script_Boot_Cycle.ttl`**(重開機循環,**獨立跑不接 A→B→C**:登入 → 風扇 →
Check Pt1~Pt13 → `reboot` → `wait "Booting in blind mode"`,`cnt_cycle` 每輪遞增,`while 1` 無止境,
要停就關 Tera Term 的 macro)。**尚未上機驗證**。
流程圖:`docs/Blanton_Test_Flow.drawio`。
最後一次發布是 **V1.2.4**;SWB 的 I2C 通道與位址已於 2026-08-19 上機驗證。
最後一次發布是 **V1.2.5**;SWB 的 I2C 通道與位址已於 2026-08-19 上機驗證。
margin 的 `VNOM` 已於 2026-08-30 改為 Blanton 實測中位數(144 條軌中 86 條上調 0.8~2.5%)。
交付用 `./publish/publish.sh` 打包。
@@ -178,6 +182,20 @@ sleep 30 # 至少等一個 interval 再 rep
# -u 0 / -u 1 單邊;-c 1e-9 換門檻;-F 只列失敗;-f <log> 離線重解
# ⚠️ 不能跟 blanton_traffic_linespeed / blanton_tr518 同時跑(都會接管同一批 port)
# ── BER 原始輸出(V1.2.5,不判定、不 summary,TTL 未接)──
./Blanton_Script/blanton_ber_debug.sh # unit 0+1:set p=p31 → get×2 → STArt 30 → sleep 40 → Ber → STOp → clear
./Blanton_Script/blanton_ber_debug.sh -u 0 # 單一 unit
# 清單同 tools/BER_Test.txt,不含 268;BER_PORTS="...,268" 可加
# ⚠️ 這支是 p=p31(已上機驗證),blanton_ber.sh 仍是 p=3 —— 兩者量的碼型可能不同
# ── 沒接線的 retimer lane / TH6 port 關 TX(V1.2.5,TTL 未接)──
./Blanton_Script/unused_lanes.sh status # 兩 unit 全部列出 rx_lock / tx_off
./Blanton_Script/unused_lanes.sh off [--asic 0] [--th6] # 預設 TX squelch;--th6 連 retimer 後面的 TH6 port 一起關
./Blanton_Script/unused_lanes.sh on
./Blanton_Script/retimer_lanes.sh 0 0x102 0xff status # 單顆 retimer:<asic> <addr> <lane_map> <off|on|status>
# ⚠️ lane 有 RX lock(有訊號進來)時 off 會被拒絕(exit 2),--force 才會硬關
# ⚠️ unused_lanes.sh 會檢查同目錄的 retimer_lanes.sh 有沒有 exec bit —— 兩支都要 chmod +x
# ── SerDes DSC 擷取(TX_FIR / RXFFE / DFE / EYE / SNR)──
./Blanton_Script/bcm_dsc_scan.sh # unit 0+1 全掃,約 10 分鐘
./Blanton_Script/bcm_dsc_scan.sh -u 0 # 只掃一個 unit(時間減半)
+56
View File
@@ -0,0 +1,56 @@
# v1.2.5 — Switch-board rail power in every snapshot, a raw BER run, and tools to turn off unused lanes
## ✨ New features
**PMON snapshots now carry the switch-board rail power**
* `utils/setup_pmon.ttl` calls `TH6_SWB0_power_readback.sh` and `TH6_SWB1_power_readback.sh` right after `show platform current` — the 19 rails of each switch board with V × I and a `TOTAL POWER` line.
* `setup_pmon` is shared, so this lands in Script A, B, C, 4 and 5 alike.
**`blanton_ber_debug.sh` — the hand-run BER flow as one command**
* Runs exactly what `tools/BER_Test.txt` does: `prbs set p=p31` → `prbs get` twice → `prbsstat STArt Interval=30` → `sleep 40` → `prbsstat Ber` → `STOp` → `prbs clear`.
* Every `bcmcmd` output is printed **as is**, under a `### [time] unit N: ...` header — no parsing, no PASS/FAIL, no summary. For looking at the raw output on the bench; `blanton_ber.sh` remains the judged version.
* `-u 0` / `-u 1` for one switch unit; both by default. `BER_POLY`, `BER_INTERVAL`, `BER_WAIT` and `BER_PORTS` can be overridden from the environment.
**`retimer_lanes.sh` / `unused_lanes.sh` — turn off TX on lanes nothing is cabled to**
* `retimer_lanes.sh <asic> <addr> <lane_map> <off|on|status>` acts on one Agera3 retimer, sys **and** line side. `--method squelch` (default, TX squelch, lanes stay powered) or `--method power` (TX+RX power-down, needs an `agera3` that has the `power` command). It reads the state back afterwards and prints `PASS` / `FAIL`.
* `unused_lanes.sh <off|on|status>` applies that to a built-in table — 14 retimer rows and one direct-TH6 row (TSC31, `cd112-cd115`) — on both switch boards. `--asic 0|1|all`, `--th6` to also disable the TH6 ports behind the retimer rows, `--only <target>` for a single row. Ends with `ok / refused / failed` counts.
* **`off` is refused on a lane that receives a signal** (RX PMD lock, or link up on a TH6 port) unless `--force` is given.
**`5_1_Blanton_Script_Boot_Cycle_Fast.ttl` — the boot cycle without the traffic run (standalone)**
* Identical to Script 5, except Check Pt8 only runs `blanton_traffic_linespeed ps` — no `init` / `start` / 15 s / `stop` / `report`. A shorter cycle when the point is the number of boots.
**Boot cycle shows its count in the window title**
* Script 5 and 5_1 set the Tera Term title to `Reboot Cycle Test : n` or `Power Cycle Test : n` each round.
## 🐛 Bug fixes
**`qfx5252-stress-usb` now runs with `--force`** in Script B and in the boot cycles.
## 📦 Downloads
| File | Contents |
|---|---|
| `Script_ABC_Blanton_V1.2.5.zip` | The full Tera Term working directory, including `Blanton_Script/` to copy onto the DUT |
```bash
chmod +x ~/Blanton_Script/*.sh
grep -rlU $'\r' ~/Blanton_Script # expect no output
```
## ⚠️ Before you run
* **`chmod +x` after deploying.** The power readbacks are called by path from every PMON snapshot, and `unused_lanes.sh` refuses to start unless `retimer_lanes.sh` next to it is executable.
* **Script 4 now reads the switch-board power twice per round** — once inside `setup_pmon`, once from its own loop. Harmless, but the log carries both.
* **`blanton_ber_debug.sh` uses `p=p31` (verified on the bench); `blanton_ber.sh`, and so Script A / C, still sets `p=3`.** The two may not be measuring the same pattern — do not compare their BER directly until that is settled.
* **`blanton_ber_debug.sh` leaves out port 268**, the same list as `BER_Test.txt`. Add it with `BER_PORTS="...,268"`.
* **`EN_Cold_Warm_boot = 0` (the `config.ttl` default) hangs Script 5 and 5_1.** Set it to `1` (reboot) or `2` (power cycle).
* **Script 5 and 5_1 are two copies of the same macro** — a fix to one has to be made to the other.
* **Script 4 has no teardown**: finish it with `blanton_tr518.sh stop` **and** `systemctl stop mlucas-amm`.
* **`FAN_SPEED` is 100.**
## 🔗 Links
* [ARCHITECTURE.md](https://etgit.et-wen.com/etwen/Blanton_TTL_Script/src/branch/main/ARCHITECTURE.md) — test flow, data models, constraints
* [CLAUDE.md](https://etgit.et-wen.com/etwen/Blanton_TTL_Script/src/branch/main/CLAUDE.md) — commands and the bench gotchas
**Full changelog:** [V1.2.4...V1.2.5](https://etgit.et-wen.com/etwen/Blanton_TTL_Script/compare/V1.2.4...V1.2.5)
+56 -2
View File
@@ -1,7 +1,7 @@
; =============================================================================
; Script A for Blanton
; Version : V1.2.4
; Date : 2026-10-01
; Version : V1.2.5
; Date : 2026-10-21
; Author : ETWen
; =============================================================================
; Version History:
@@ -794,6 +794,60 @@
; Diag vs SONiC comparison
; !! measures unit 0 only, port 268 not in the list, yet
; wait_init still waits for BOTH units (SWB_UNIT0/1 = 1)
; V1.2.5 2026-10-21 Blanton_Script/blanton_ber_debug.sh Created v1.0.0 - raw BER run of tools/BER_Test.txt
; prbs set p=p31, prbs get x2, prbsstat STArt Interval=30,
; sleep 40, Ber, STOp, prbs clear. Every bcmcmd output is
; printed as is under a '### [time] unit N: ...' header - no
; parsing, no PASS/FAIL, no summary. -u 0 / -u 1, default both
; BER_POLY / BER_INTERVAL / BER_WAIT / BER_PORTS overridable
; !! the port list is the 200G ports only, no 268 - same as
; BER_Test.txt. BER_PORTS="...,268" adds the 100G uplink
; !! p=p31 is verified on the bench. blanton_ber.sh (and so
; Script A / C) still sets p=3 - the two runs do not measure
; the same pattern unless p=3 is PRBS31 as well
; !! standalone, no TTL calls it
; Blanton_Script/retimer_lanes.sh Created - TX off / on / status for lanes of one Agera3 retimer
; retimer_lanes.sh <asic 0|1> <addr> <lane_map> <off|on|status>
; Acts on the sys AND the line side. --method squelch (default,
; TX squelch, lanes stay powered) or power (TX+RX power-down,
; needs an agera3 with the 'power' command - exit 4 if not)
; Reads back after the change: PASS / FAIL, exit 3 on mismatch
; !! 'off' is REFUSED (exit 2) on a lane with RX PMD lock, i.e.
; one that receives a signal. --force overrides
; !! runs agera3 through sudo, 30 s timeout per call
; Blanton_Script/unused_lanes.sh Created - apply off / on / status to every unused lane
; Table at the top: 14 retimer rows (7 fully unused, 7 with
; lanes 4,5 unused) and 1 direct-TH6 row (TSC31, cd112-cd115),
; the same rows on both switch boards. Retimer rows go through
; retimer_lanes.sh, TH6 rows through 'port ... enable=' in
; syncdN's bcmcmd. --asic 0|1|all; --th6 also turns off the TH6
; ports behind the retimer rows; --only <target> for one row
; Ends with ok / refused / failed counts, exit 1 if any failed
; !! calls retimer_lanes.sh from its own directory and checks
; its exec bit - chmod +x both after deploying
; !! bash only (mapfile, [[ =~ ]]), not sh
; utils/setup_pmon.ttl Add TH6_SWB0 / TH6_SWB1 power readback after show platform current
; Every PMON snapshot (A / B / C / 4 / 5) now has the 19 rails
; of each switch board with V x I and TOTAL POWER
; !! Script 4 already called both readbacks in its loop right
; after setup_pmon - it now reads them TWICE per round
; !! every Script B soak round gets longer by both readbacks
; ScriptB Add --force to qfx5252-stress-usb
; 5_.._Boot_Cycle.ttl Window title shows the cycle count every round
; 'Reboot Cycle Test : n' (EN_Cold_Warm_boot = 1) or
; 'Power Cycle Test : n' (= 2), set with settitle
; Add --force to qfx5252-stress-usb, same as Script B
; 5_1_Blanton_Script_Boot_Cycle_Fast.ttl Added - Script 5 without the traffic run, a STANDALONE macro
; Identical to 5_.._Boot_Cycle.ttl except that Check Pt8 runs
; only 'blanton_traffic_linespeed ps' - no init / clear / show
; / start / pause 15 / stop / report. A shorter cycle when the
; point is the number of boots
; !! a second copy of the same macro: a fix to one has to be
; made to the other as well
; !! EN_Cold_Warm_boot = 0 (the config.ttl default) hangs it,
; same as Script 5
; tools/BER_Test.txt p=3 -> p=p31; add a unit 1 block, a both-units block and
; port en=0 / en=1 for all cabled ports on each unit
; =============================================================================
include "config.ttl"
@@ -60,7 +60,7 @@ usb_dev = groupmatchstr1
wait prompt_sonic_root
;sprintf2 cmd "bgctl run qfx5252-stress-usb %s 256M --runtime 86400 --passes 1 --write --log /host/hw-eval/jobs/qfx5252-stress-usb.log" usb_dev
sprintf2 cmd "bgctl run qfx5252-stress-usb %s 256M --runtime %d --passes %d --write --log /host/hw-eval/jobs/qfx5252-stress-usb.log" usb_dev USB_RUNTIME USB_COUNT
sprintf2 cmd "bgctl run qfx5252-stress-usb %s 256M --runtime %d --passes %d --write --log /host/hw-eval/jobs/qfx5252-stress-usb.log --force" usb_dev USB_RUNTIME USB_COUNT
sendln cmd
;wait prompt_sonic_root
@@ -0,0 +1,412 @@
include "config.ttl"
flushrecv
;================================================================
; Log File Creation
;================================================================
gettime str_starttime "%Y%m%d-%H%M%S"
getdir mdir
if EN_log = 1 then
if EN_Cold_Warm_boot = 1 then
sprintf2 filename '%s\Logs\%s_%s_%s.log' mdir project_name "Reboot_Cycle" str_starttime
logopen filename 0 1 1 1
elseif EN_Cold_Warm_boot = 2 then
sprintf2 filename '%s\Logs\%s_%s_%s.log' mdir project_name "Power_Cycle" str_starttime
logopen filename 0 1 1 1
else
endif
endif
cnt_cycle = 0
while 1
cnt_cycle = cnt_cycle + 1
if EN_Cold_Warm_boot = 1 then
sprintf2 log_cycle_msg 'Reboot Cycle Test : %d' cnt_cycle
settitle log_cycle_msg
elseif EN_Cold_Warm_boot = 2 then
sprintf2 log_cycle_msg 'Power Cycle Test : %d' cnt_cycle
settitle log_cycle_msg
else
endif
; ========== Root Login ==========
wait prompt_login
sendln "admin"
wait "Password:"
sendln "YourPaSsWoRd"
wait prompt_sonic
sendln "sudo -i"
wait prompt_sonic_root
sendln "sleep 10"
if EN_Cold_Warm_boot = 1 then
wait prompt_sonic_root
sprintf2 strTitle "echo -e '\033[1;32mReboot Cycle : %d \033[0m'" cnt_cycle
sendln strTitle
elseif EN_Cold_Warm_boot = 2 then
wait prompt_sonic_root
sprintf2 strTitle "echo -e '\033[1;32mPower Cycle : %d \033[0m'" cnt_cycle
sendln strTitle
else
endif
; ========== Pre Setting ==========
; Make log directory
wait prompt_sonic_root
sendln "mkdir ./logs"
; Setting System Time
getdate datestr
gettime timestr
sprintf2 cmd 'sudo date -s "%s %s"' datestr timestr
sendln cmd
; ========== FAN SPEED ==========
wait prompt_sonic_root
sendln "echo 18-0020 > /sys/bus/i2c/drivers/max31790/unbind"
wait prompt_sonic_root
sendln "sleep .5"
wait prompt_sonic_root
sendln "echo 18-0020 > /sys/bus/i2c/drivers/max31790/bind"
wait prompt_sonic_root
sendln "echo 25-0020 > /sys/bus/i2c/drivers/max31790/unbind"
wait prompt_sonic_root
sendln "sleep .5"
wait prompt_sonic_root
sendln "echo 25-0020 > /sys/bus/i2c/drivers/max31790/bind"
wait prompt_sonic_root
sprintf2 fan_ctrl_cmd 'fan-speed-control.sh %d' FAN_SPEED
sendln fan_ctrl_cmd
wait "Set all configured fan channels to"
sendln "y"
; ========== Wait DUT Init ==========
include "utils/wait_init.ttl"
; ========== DUT Info ==========
wait prompt_sonic_root
sprintf2 strCKPt1 "echo -e '\033[36mCheck Pt1 : DUT Info\033[0m'"
sendln strCKPt1
wait prompt_sonic_root
sendln "show boot"
wait prompt_sonic_root
sendln "show version"
wait prompt_sonic_root
sendln "fwutil show status"
wait prompt_sonic_root
sendln "show system-memory"
wait prompt_sonic_root
sendln "show service"
wait prompt_sonic_root
sendln "show platform syseeprom"
wait prompt_sonic_root
sendln "show platform ssdhealth"
wait prompt_sonic_root
sendln "qfx5252-tpm-version"
wait prompt_sonic_root
sendln "/usr/sbin/nvme smart-log -H /dev/nvme0"
wait prompt_sonic_root
sendln "/usr/sbin/smartctl -x /dev/nvme0"
; ========== BMC version ==========
wait prompt_sonic_root
sprintf2 strCKPt2 "echo -e '\033[36mCheck Pt2 : BMC Info\033[0m'"
sendln strCKPt2
wait prompt_sonic_root
sendln "bmc-first-enroll"
wait prompt_sonic_root
sendln "bmc-manager version"
wait prompt_sonic_root
sendln "bmc-manager status"
; ========== Load Shell Script ==========
wait prompt_sonic_root
sendln "source ~/Blanton_Script/blanton_fpga_pcimem.sh"
wait prompt_sonic_root
sendln "source ~/Blanton_Script/blanton_cb_i2c.sh"
wait prompt_sonic_root
sendln "source ~/Blanton_Script/blanton_icb_vi2c.sh"
wait prompt_sonic_root
sendln "source ~/Blanton_Script/blanton_pwr_data.sh"
wait prompt_sonic_root
sendln "source ~/Blanton_Script/blanton_traffic_linespeed.sh"
wait prompt_sonic_root
sendln "source ~/Blanton_Script/LTC2980_Margin_Script/margin.sh"
; ========== CLEAR PCIE Error ==========
include "utils/show_pcie_error_reg_TH6_SWB0.ttl"
include "utils/show_pcie_error_reg_TH6_SWB1.ttl"
include "utils/show_pcie_error_reg_FPGA.ttl"
include "utils/show_pcie_error_reg_BMC.ttl"
include "utils/show_pcie_error_reg_DDR.ttl"
include "utils/show_pcie_error_reg_I210.ttl"
include "utils/show_pcie_error_reg_SSD.ttl"
wait prompt_sonic_root
sendln "/usr/sbin/ras-mc-ctl --summary"
; ========== Check PCIE tree + PCIE link status + GET PCIE bandwidth Test ==========
include "utils/pcie_bus.ttl"
; ========== TAKE DATA ==========
include "utils/setup_pmon.ttl"
include "utils/show_dmesg.ttl"
; ========== 10G/1G MGMT Ping Test ==========
wait prompt_sonic_root
sprintf2 strCKPt3 "echo -e '\033[36mCheck Pt3 : Mgmt Ping Test\033[0m'"
sendln strCKPt3
wait prompt_sonic_root
sendln "./Blanton_Script/mgmt_ping_monitor.sh start"
wait prompt_sonic_root
pause 30
sendln "~/Blanton_Script/mgmt_ping_monitor.sh stop"
wait prompt_sonic_root
sendln "cat ~/Blanton_Script/log/mgmt_ping.log"
wait prompt_sonic_root
sendln "~/Blanton_Script/mgmt_ping_monitor.sh clear"
; ========== NFC Test ==========
wait prompt_sonic_root
sprintf2 strCKPt4 "echo -e '\033[36mCheck Pt4 : NFC Test\033[0m'"
sendln strCKPt4
wait prompt_sonic_root
sendln "~/Blanton_Script/nfc_polling.sh start"
wait prompt_sonic_root
sendln "~/Blanton_Script/nfc_polling.sh status"
wait prompt_sonic_root
sendln "sleep 20"
wait prompt_sonic_root
sendln "~/Blanton_Script/nfc_polling.sh stop"
wait prompt_sonic_root
sendln "~/Blanton_Script/nfc_polling.sh report"
; ========== SSD read/write ==========
wait prompt_sonic_root
sprintf2 strCKPt5 "echo -e '\033[36mCheck Pt5 : SSD Test\033[0m'"
sendln strCKPt5
wait prompt_sonic_root
sendln "rm -rf /host/hw-eval/jobs/qfx5252-stress-ssd.log"
wait prompt_sonic_root
sendln "qfx5252-stress-ssd 1G --runtime 30 --passes 2 --write --force --log /host/hw-eval/jobs/qfx5252-stress-ssd.log"
wait prompt_sonic_root
sendln "cat /host/hw-eval/jobs/qfx5252-stress-ssd.log"
; ========== USB read/write ==========
wait prompt_sonic_root
sprintf2 strCKPt6 "echo -e '\033[36mCheck Pt6 : USB Test\033[0m'"
sendln strCKPt6
; ---- Get USB partition node -> usb_dev ----
usb_dev = ''
wait prompt_sonic_root
sendln 'D=$(bash ~/Blanton_Script/usb_target.sh -o dev 2>/dev/null); echo "<<D""EV=${D:-NONE}>>"'
waitregex '<<DEV=([^>]*)>>'
usb_dev = groupmatchstr1
wait prompt_sonic_root
sendln "rm -rf /host/hw-eval/jobs/qfx5252-stress-usb.log"
wait prompt_sonic_root
sprintf2 cmd "qfx5252-stress-usb %s 256M --runtime 30 --passes 2 --write --log /host/hw-eval/jobs/qfx5252-stress-usb.log --force" usb_dev
sendln cmd
wait prompt_sonic_root
sendln "cat /host/hw-eval/jobs/qfx5252-stress-usb.log"
; ========== BMC USB Test ==========
wait prompt_sonic_root
sprintf2 strCKPt7 "echo -e '\033[36mCheck Pt7 : BMC USB Test\033[0m'"
sendln strCKPt7
wait prompt_sonic_root
sendln 'echo "NCMIF=$(ls -d /sys/bus/usb/drivers/cdc_ncm/*/net/* 2>/dev/null | head -n 1 | xargs -r basename)"'
; timeout is GLOBAL and sticky: left at 15, every 'wait' below gives up after
; 15 s instead of blocking, the macro runs ahead of the DUT and the whole
; cycle desynchronises. Restore it BEFORE the branch so both paths are
; covered - the ping block below waits on 'sleep 10', which is already two
; thirds of the 15 s cap on a loaded DUT.
timeout = 15
waitregex 'NCMIF=[A-Za-z0-9_-]+'
ncm_found = result ; hold it: 'result' is reused below
timeout = 0 ; restore, both paths
if ncm_found = 0 then
messagebox 'cdc_ncm interface not found. Ping test skipped.' 'ERROR'
goto skip_ping
endif
strlen matchstr
cut_len = result - 6 ; 'NCMIF=' = 6 chars
strcopy matchstr 7 cut_len ncm_if ; -> ncm_if = "eth2" / "eth3"
sprintf2 cmd 'ip -br link show %s' ncm_if
wait prompt_sonic_root
sendln cmd
wait prompt_sonic_root
sendln 'systemctl stop qfx5252-bmc-usb-net-test.service 2>/dev/null || true'
wait prompt_sonic_root
sendln 'systemctl reset-failed qfx5252-bmc-usb-net-test.service 2>/dev/null || true'
sprintf2 cmd 'systemd-run --unit=qfx5252-bmc-usb-net-test --property=Type=exec /usr/bin/ping -I %s -i 1 -W 2 -w 14400 192.168.200.200' ncm_if
wait prompt_sonic_root
sendln cmd
wait prompt_sonic_root
sendln "sleep 10"
wait prompt_sonic_root
sendln "systemctl stop qfx5252-bmc-usb-net-test.service"
wait prompt_sonic_root
sendln "journalctl -u qfx5252-bmc-usb-net-test.service --no-pager"
:skip_ping
timeout = 0 ; backstop, same as Script B
; ========== 100G Port Setting ==========
wait prompt_sonic_root
sendln "sudo sfputil lpmode off Ethernet513"
wait prompt_sonic_root
sendln "sudo sfputil lpmode off Ethernet514"
wait prompt_sonic_root
sendln "config interface -n asic0 startup Ethernet513"
wait prompt_sonic_root
sendln "config interface -n asic1 startup Ethernet514"
wait prompt_sonic_root
sendln "config save -y"
; ========== First Traffic Test ==========
; Silent MAC
wait prompt_sonic_root
sendln "config feature state lldp disabled"
wait prompt_sonic_root
sendln "config save -y"
; ========== 100G Port Status ==========
wait prompt_sonic_root
sprintf2 strCKPt8 "echo -e '\033[36mCheck Pt8 : Port Status and 15sec Traffic \033[0m'"
sendln strCKPt8
wait prompt_sonic_root
sendln "show interfaces status Ethernet513,Ethernet514"
; ========== Traffic Test ==========
if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then
wait prompt_sonic_root
sendln "blanton_traffic_linespeed ps"
elseif SWB_UNIT0 = 1 && SWB_UNIT1 = 0 then
wait prompt_sonic_root
sendln "blanton_traffic_linespeed ps -u 0"
elseif SWB_UNIT0 = 0 && SWB_UNIT1 = 1 then
wait prompt_sonic_root
sendln "blanton_traffic_linespeed ps -u 1"
else
endif
; ========== BER ==========
; PRBS takes the SerDes out of normal operation, so this runs AFTER the
; traffic report. sleep 30 matches blanton_ber.sh BER_INTERVAL - reporting
; earlier reads an interval that has not finished accumulating.
wait prompt_sonic_root
sprintf2 strCKPt8 "echo -e '\033[36mCheck Pt9 : BER Test \033[0m'"
sendln strCKPt8
if SWB_UNIT0 = 1 && SWB_UNIT1 = 1 then
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh init"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh start"
wait prompt_sonic_root
sendln "sleep 30"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh report"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh stop"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh clear"
elseif SWB_UNIT0 = 1 && SWB_UNIT1 = 0 then
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh init -u 0"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh start -u 0"
wait prompt_sonic_root
sendln "sleep 30"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh report -u 0"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh stop -u 0"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh clear -u 0"
elseif SWB_UNIT0 = 0 && SWB_UNIT1 = 1 then
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh init -u 1"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh start -u 1"
wait prompt_sonic_root
sendln "sleep 30"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh report -u 1"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh stop -u 1"
wait prompt_sonic_root
sendln "./Blanton_Script/blanton_ber.sh clear -u 1"
else
endif
; ========== NVME Err Info ==========
wait prompt_sonic_root
sprintf2 strCKPt9 "echo -e '\033[36mCheck Pt10 : NVME Err Info \033[0m'"
sendln strCKPt9
wait prompt_sonic_root
sendln "/usr/sbin/nvme smart-log -H /dev/nvme0"
wait prompt_sonic_root
sendln "/usr/sbin/smartctl -x /dev/nvme0"
; ========== TAKE DATA ==========
wait prompt_sonic_root
sprintf2 strCKPt10 "echo -e '\033[36mCheck Pt11 : Platform Data \033[0m'"
sendln strCKPt10
include "utils/setup_pmon.ttl"
wait prompt_sonic_root
sprintf2 strCKPt12 "echo -e '\033[36mCheck Pt12 : Dmesg_i2c \033[0m'"
sendln strCKPt12
include "utils/show_dmesg.ttl"
; ========== Check PCIE error counters ==========
wait prompt_sonic_root
sprintf2 strCKPt13 "echo -e '\033[36mCheck Pt13 : PCIE Error Counters \033[0m'"
sendln strCKPt13
include "utils/show_pcie_error_reg_TH6_SWB0.ttl"
include "utils/show_pcie_error_reg_TH6_SWB1.ttl"
include "utils/show_pcie_error_reg_FPGA.ttl"
include "utils/show_pcie_error_reg_BMC.ttl"
include "utils/show_pcie_error_reg_DDR.ttl"
include "utils/show_pcie_error_reg_I210.ttl"
include "utils/show_pcie_error_reg_SSD.ttl"
wait prompt_sonic_root
sendln "/usr/sbin/ras-mc-ctl --summary"
; ========== Show Power on uptime ==========
wait prompt_sonic_root
sendln "show uptime"
; ========== Show Power on uptime ==========
if EN_Cold_Warm_boot = 1 then
wait prompt_sonic_root
sendln "reboot"
elseif EN_Cold_Warm_boot = 2 then
wait prompt_sonic_root
sendln "pcimem /sys/bus/pci/devices/0000:05:00.0/resource0 0x480 w 0xD0000"
else
endif
wait "Booting in blind mode"
endwhile
@@ -22,6 +22,14 @@ cnt_cycle = 0
while 1
cnt_cycle = cnt_cycle + 1
if EN_Cold_Warm_boot = 1 then
sprintf2 log_cycle_msg 'Reboot Cycle Test : %d' cnt_cycle
settitle log_cycle_msg
elseif EN_Cold_Warm_boot = 2 then
sprintf2 log_cycle_msg 'Power Cycle Test : %d' cnt_cycle
settitle log_cycle_msg
else
endif
; ========== Root Login ==========
wait prompt_login
sendln "admin"
@@ -207,7 +215,7 @@ while 1
wait prompt_sonic_root
sendln "rm -rf /host/hw-eval/jobs/qfx5252-stress-usb.log"
wait prompt_sonic_root
sprintf2 cmd "qfx5252-stress-usb %s 256M --runtime 30 --passes 2 --write --log /host/hw-eval/jobs/qfx5252-stress-usb.log" usb_dev
sprintf2 cmd "qfx5252-stress-usb %s 256M --runtime 30 --passes 2 --write --log /host/hw-eval/jobs/qfx5252-stress-usb.log --force" usb_dev
sendln cmd
wait prompt_sonic_root
sendln "cat /host/hw-eval/jobs/qfx5252-stress-usb.log"
@@ -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"
@@ -0,0 +1,98 @@
#!/bin/bash
# Turn TX off/on, or show state, for lanes of one Agera3 retimer on the sys and line side.
usage() {
cat <<USAGE
Usage: $0 <asic 0|1> <retimer-addr> <lane_map> <off|on|status> [--method squelch|power] [--force]
squelch TX squelch on sys and line side; lanes stay powered (works with the installed agera3)
power TX+RX lane power-down, the call SONiC makes on admin down; needs an agera3 with 'power'
--force allow 'off' on lanes that receive a signal
USAGE
exit 1
}
[ $# -ge 4 ] || usage
ASIC=$1; ADDR=$2; MAP=$3; ACT=$4; shift 4
METHOD=squelch; FORCE=0
while [ $# -gt 0 ]; do
case $1 in
--method) METHOD=$2; shift 2 ;;
--force) FORCE=1; shift ;;
*) usage ;;
esac
done
case $ASIC in 0|1) ;; *) usage ;; esac
case $ACT in off|on|status) ;; *) usage ;; esac
case $METHOD in squelch|power) ;; *) usage ;; esac
[[ $ADDR =~ ^0x[0-9a-fA-F]+$ && $MAP =~ ^0x[0-9a-fA-F]{1,2}$ ]] || usage
MAPV=$((MAP))
[ "$MAPV" -ge 1 ] || usage
ag() { sudo timeout 30 agera3 "$ASIC" "$ADDR" --no-cleanup "$@" </dev/null 2>&1; }
if [ "$METHOD" = power ] && ! sudo agera3 -h 2>&1 | grep -q -E '^\s+power '; then
echo "agera3 on this system has no 'power' command; use --method squelch"
exit 4
fi
lock_mask() {
ag rx-pmd-lock get side "$1" lane_map=0xff | awk '$2=="|" && $3=="LOCKED" {m += 2^$1} END {printf "%d", m}'
}
lane_tx() {
local lm
lm=$(printf '0x%02x' $((1 << $2)))
if [ "$METHOD" = squelch ]; then
ag squelch get tx "$1" lane_map=$lm | sed -n 's/.*squelch is \([A-Z]*\).*/\1/p' | awk '{print ($1 == "CLEAR") ? "on" : "off"}'
else
ag power get "$1" lane_map=$lm | awk -v l="$2" '$1 == l && $2 == "|" {print $3}'
fi
}
txoff_mask() {
local m=0 l s
for l in 0 1 2 3 4 5 6 7; do
[ $((MAPV >> l & 1)) = 1 ] || continue
s=$(lane_tx "$1" $l)
case $s in
off) m=$((m | 1 << l)) ;;
on) ;;
*) echo "unknown"; return ;;
esac
done
printf '0x%02x' $m
}
report() {
local side
for side in sys line; do
printf 'asic%s %-6s %-4s lane_map=0x%02x rx_lock=0x%02x tx_off=%s (%s)\n' \
"$ASIC" "$ADDR" "$side" "$MAPV" "$(lock_mask $side)" "$(txoff_mask $side)" "$METHOD"
done
}
[ "$ACT" = status ] && { report; exit 0; }
if [ "$ACT" = off ] && [ $FORCE = 0 ]; then
live=$(( ($(lock_mask sys) | $(lock_mask line)) & MAPV ))
if [ $live != 0 ]; then
printf 'REFUSED: asic%s %s lanes 0x%02x receive a signal; use --force to override\n' "$ASIC" "$ADDR" $live
exit 2
fi
fi
for side in sys line; do
if [ "$METHOD" = squelch ]; then
ag squelch set tx $side lane_map=$MAP $([ $ACT = off ] && echo enable || echo disable)
else
ag power set $side lane_map=$MAP $ACT
fi | grep -E 'FAIL|Error'
done
want=0x00; [ "$ACT" = off ] && want=$(printf '0x%02x' $MAPV)
rc=0
for side in sys line; do
got=$(txoff_mask $side)
printf 'asic%s %-6s %-4s lane_map=0x%02x tx_off=%s expected=%s (%s)\n' "$ASIC" "$ADDR" "$side" "$MAPV" "$got" "$want" "$METHOD"
[ "$got" = "$want" ] || rc=3
done
[ $rc = 0 ] && echo "PASS" || echo "FAIL"
exit $rc
@@ -0,0 +1,103 @@
#!/bin/bash
# Apply off/on/status to the unused retimer lanes and TH6 ports listed below, on each ASIC.
# Same rows apply to both switch boards. lanes: retimer lane_map, sys and line side.
# tsc: TH6 TSC as in HW docs and the "#TSCn" labels in th6-helios.config.yml.
# th6_ports: BCM shell port name or range; used by th6 rows, and by retimer rows with --th6.
UNUSED=$(cat <<'TABLE'
# kind target lanes refdes tsc th6_ports note
retimer 0x102 0xff U22 23 cd80-cd83 no used ports
retimer 0x142 0xff U32 38 cd148-cd151 no used ports
retimer 0x21 0xff U39 7 cd16-cd19 no used ports
retimer 0x240 0xff U67 54 cd212-cd215 no used ports
retimer 0x264 0xff U73 62 cd244-cd247 no used ports
retimer 0x48 0xff U82 15 cd48-cd51 no used ports
retimer 0x202 0xff U92 46 cd180-cd183 no used ports
retimer 0x122 0x30 U18 27 cd111 lanes 4,5 unused
retimer 0x248 0x30 U63 58 cd235 lanes 4,5 unused
retimer 0x2 0x30 U70 3 cd15 lanes 4,5 unused
retimer 0x40 0x30 U75 11 cd47 lanes 4,5 unused
retimer 0x162 0x30 U80 42 cd171 lanes 4,5 unused
retimer 0x222 0x30 U87 50 cd203 lanes 4,5 unused
retimer 0x62 0x30 U96 19 cd79 lanes 4,5 unused
th6 TSC31 - - 31 cd112-cd115 direct TH6 TSC, no retimer
# th6 TSC34 - - 34 cd139 direct TH6 TSC34 lanes 6,7; down and unused in full rack, not in HW list
TABLE
)
DIR=$(cd "$(dirname "$0")" && pwd)
usage() {
cat <<USAGE
Usage: $0 <off|on|status> [--asic 0|1|all] [--method squelch|power] [--th6] [--only <target>] [--force]
retimer rows: retimer lanes on sys and line side, via retimer_lanes.sh
th6 rows : TH6 ports in the th6_ports column, via the BCM shell
--th6 : also act on the th6_ports of retimer rows (TH6 ports feeding those retimer lanes)
--only : act on one row, matched by its target column (e.g. 0x102 or TSC31)
USAGE
exit 1
}
[ $# -ge 1 ] || usage
ACT=$1; shift
ASICS="0 1"; METHOD=squelch; TH6=0; ONLY=""; FORCE=""
while [ $# -gt 0 ]; do
case $1 in
--asic) case $2 in all) ASICS="0 1" ;; 0|1) ASICS=$2 ;; *) usage ;; esac; shift 2 ;;
--method) METHOD=$2; shift 2 ;;
--th6) TH6=1; shift ;;
--only) ONLY=$2; shift 2 ;;
--force) FORCE=--force; shift ;;
*) usage ;;
esac
done
case $ACT in off|on|status) ;; *) usage ;; esac
[ -x "$DIR/retimer_lanes.sh" ] || { echo "retimer_lanes.sh not found next to $0"; exit 1; }
bcm() { docker exec "syncd$1" bcmcmd -t 60 "$2" </dev/null 2>&1 | tr -d '\r'; }
ps_state() { bcm "$1" "ps $2" | sed -E 's/\( +/(/' | awk '$1 ~ /^cd[0-9]+\(/ {print $1, $2}'; }
th6_ports() {
local a=$1 act=$2 ports=$3 st
st=$(ps_state "$a" "$ports")
[ -n "$st" ] || { echo "asic$a th6 $ports: no such ports"; return 3; }
if [ "$act" = status ]; then
echo "$st" | sed "s/^/asic$a th6 /"
return 0
fi
if [ "$act" = off ] && [ -z "$FORCE" ] && echo "$st" | awk '$2 == "up"' | grep -q .; then
echo "REFUSED: asic$a th6 $ports has link up: $(echo "$st" | awk '$2 == "up" {printf "%s ", $1}')"
return 2
fi
bcm "$a" "port $ports enable=$([ "$act" = off ] && echo false || echo true)" >/dev/null
sleep 1
st=$(ps_state "$a" "$ports")
echo "$st" | sed "s/^/asic$a th6 /"
if [ "$act" = off ]; then
echo "$st" | awk '$2 != "!ena"' | grep -q . && return 3
else
echo "$st" | awk '$2 == "!ena"' | grep -q . && return 3
fi
return 0
}
mapfile -t ROWS < <(grep -v -E '^[[:space:]]*(#|$)' <<<"$UNUSED")
ok=0; refused=0; failed=0
for a in $ASICS; do
for row in "${ROWS[@]}"; do
read -r kind target lanes refdes tsc ports note <<<"$row"
[ -n "$ONLY" ] && [ "$target" != "$ONLY" ] && continue
echo "== asic$a $kind $target refdes=$refdes TSC$tsc th6=$ports: $note"
rc=0
case $kind in
retimer)
"$DIR/retimer_lanes.sh" "$a" "$target" "$lanes" "$ACT" --method "$METHOD" $FORCE; rc=$?
if [ $TH6 = 1 ] && [ "$ports" != "-" ] && [ $rc != 2 ]; then
th6_ports "$a" "$ACT" "$ports" || rc=$?
fi ;;
th6) th6_ports "$a" "$ACT" "$ports"; rc=$? ;;
*) echo "unknown kind '$kind'"; rc=1 ;;
esac
case $rc in 0) ok=$((ok + 1)) ;; 2) refused=$((refused + 1)) ;; *) failed=$((failed + 1)) ;; esac
done
done
echo "== $ACT done: ok=$ok refused=$refused failed=$failed"
[ $failed = 0 ]
@@ -15,6 +15,10 @@ sendln "show platform voltage"
wait prompt_sonic_root
sendln "show platform current"
wait prompt_sonic_root
sendln "~/Blanton_Script/TH6_SWB0_power_readback.sh"
wait prompt_sonic_root
sendln "~/Blanton_Script/TH6_SWB1_power_readback.sh"
wait prompt_sonic_root
sendln "show platform ssdhealth"
wait prompt_sonic_root
sendln "show platform leak status"
+44 -1
View File
@@ -1,4 +1,4 @@
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbs set p=3' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbs set p=p31' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbs get' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbsstat STArt Interval=30' "
@@ -7,6 +7,49 @@ bcmcmd -n 0 -c " dsh -c 'phydiag 1-24,40-96,112-168,184-240,256-259,270-308,310-
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbsstat STOp' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbs clear' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbs set p=p31' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbs get' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbsstat STArt Interval=30' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbsstat Ber' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbsstat STOp' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbs clear' "
//BER SWB0/1
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbs set p=p31' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbs get' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbs get' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbs set p=p31' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbs get' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbs get' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbsstat STArt Interval=30' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbsstat STArt Interval=30' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbsstat Ber' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbsstat Ber' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbsstat STOp' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbsstat STOp' "
bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbs clear' "
bcmcmd -n 1 -c " dsh -c 'phydiag 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 prbs clear' "
bcmcmd -n 0 "port 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 en=0"
bcmcmd -n 0 "port 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 en=1"
bcmcmd -n 1 "port 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 en=0"
bcmcmd -n 1 "port 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 en=1"
root@sonic:~# bcmcmd -n 0 -c " dsh -c 'phydiag 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 prbs set p=3' "
dsh -c 'phydiag 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 prbs set p=3'
drivshell>