mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
a73909ec21e00fc9e61e752baa66d502a27fb796
Per v3-phase-15-t2-batch-11-port-plan.md §7 11a scope (LOCKED
2026-04-22). Port-model port of V2 identify.go + queue model +
controller-id registry. Unlocks Go-harness admin Identify path
+ existing IO path; Linux nvme connect still gated on 11b
Property/Features/KeepAlive/AER work.
core/frontend/nvme/protocol.go
Added admin opcode constants: adminGetLogPage, adminIdentify,
adminAbort, adminSetFeatures, adminGetFeatures, adminAsyncEvent,
adminKeepAlive. Fabric types: fcPropertySet, fcPropertyGet,
fcDisconnect. CNS codes for Identify. identifySize constant.
VS version constant (nvmeVersion13 only — declared and used;
unused nvmeVersion14 removed per port-model discipline).
core/frontend/nvme/target.go
New adminController struct + Target-level CNTLID registry:
allocAdminController(subNQN, hostNQN, volumeID) *adminController
lookupAdminController(id) *adminController
releaseAdminController(id)
CNTLIDs allocated monotonically from 1 (0 reserved); released
on admin-session close.
core/frontend/nvme/session.go
Session now carries qid / qidSet / ctrl / target references.
newSession signature extended to take *Target.
handleCapsuleCmd refactored per port plan §3.4 R5:
- Fabric commands bypass the qid gate (they establish it)
- Post-Connect: route by s.qid via adminDispatch / ioDispatch
- Admin queue accepts admin opcodes only (Invalid Opcode for IO)
- IO queue accepts IO opcodes only (Invalid Opcode for admin)
handleFabric split into handleAdminConnect + handleIOConnect:
- QID decoded from CDW10[31:16]
- Admin Connect: CNTLID must be 0xFFFF or 0x0000 (request new);
allocate + register + reply with CNTLID in DW0[15:0]
- IO Connect: cite existing CNTLID; validate exists + SubNQN
matches; pin ctrl pointer. HostNQN NOT cross-checked (V2
parity + Linux spec-compat) — T8 owns auth.
- Double-Connect on same session rejected (qidSet gate)
close() releases admin CNTLID from Target registry. IO sessions
outliving admin hold their pinned ctrl pointer; new IO Connects
citing a released CNTLID fail registry lookup with
ConnectInvalidHost.
core/frontend/nvme/identify.go (NEW — port-model port of V2)
Four CNS builders per NVMe 1.3 §5.15.2:
- Identify Controller (4 KiB)
- Identify Namespace (4 KiB)
- Active NS List
- NS Descriptor List (NGUID designator NIDT=0x02)
11 deep-read corrections applied (port plan §3.5 D1-D11):
D1 Serial derived from VolumeID via sha256 (R1 symmetry with
Batch 10.5 follow-up #2 VPD 0x80); no "SWF00001" stub
D2 CMIC / ANACAP / ANAGRPMAX / NANAGRPID / NS ANAGRPID = 0
(ANA log is 11c-conditional)
D3 ONCS (WriteZeros + DSM) = 0 (not implemented)
D4 NSFEAT (thin-prov/Trim) = 0
D5 DLFEAT (deallocate) = 0
D6 AERL = 0 (one pending-AER slot; finding #2)
D7 OFCS (Disconnect) = 0 (not in Batch 11 scope)
D8 SubNQN NUL-terminated (not space-padded) at offset 768
D9 LBAF[0] LBADS = 9 for 512B (bits.TrailingZeros32)
D10 IOCCSZ = (64 + MaxH2CDataLength) / 16 = 2052
D11 VS = NVMe 1.3; MNAN = 1
NGUID derivation (R1 / port plan §3.3 N1):
NGUID[16] = sha256(SubsysNQN + "\x00" + VolumeID)[:16]
EUI-64[8] = NGUID[:8]
Deterministic + per-volume unique + per-subsystem unique.
QA A-tier pins determinism in a separate file.
core/frontend/nvme/client_support_test.go
Rewrote nvmeClient to open admin (QID=0) + IO (QID=1) TCP
connection pair. Admin Connect allocates CNTLID, IO Connect
cites it. writeCmd/readCmd route through ioConn (back-compat
with ckpt 7 tests). adminIdentify(cns, nsid) added. Existing
L1 and L2-harness tests now exercise real multi-queue Connect.
core/frontend/nvme/identify_test.go (NEW)
20 sw-owned tests:
- D1-D11 field pins on Identify Controller (10 tests)
- Identify Namespace fields (4 tests: size, NSFEAT+DLFEAT,
ANAGRPID, LBAF, NGUID/EUI)
- Active NS List + NS Descriptor List (2 tests)
- Queue routing enforcement (2 tests: admin-rejects-IO,
IO-rejects-admin)
- CNTLID lifecycle (2 tests: unknown rejected with
ConnectInvalidHost 0x82; preset rejected with
ConnectInvalidParameters 0x80)
- End-to-end (1 test: admin Identify all 4 CNS + IO Write/Read)
core/frontend/iscsi/t2_v2port_scsi_inquiry_test.go (QA-authored)
QA closed the Batch 10.5 follow-up #2 N1 symmetry pin via
TestT2V2Port_SCSI_InquiryVPD80_SerialDerivationDeterministic
(4 sub-tests: same-VolumeID determinism, different-VolumeID
collision, hex-shape, operator-override bypass).
core/frontend/nvme/t2_v2port_support_test.go (QA-authored, NEW)
Skeleton shared utilities for Batch 11 A-tier tests per
v3-phase-15-t2-batch-11-test-skeleton.md. Pre-authored to
slot in when 11a lands; compiles today.
Tests green (no regressions):
core/frontend/nvme: 51 tests (was 28 pre-11a; +23 including
QA skeleton support helpers)
core/frontend/iscsi: 106 tests (was 104; +2 QA VPD 0x80
symmetric pin)
All other packages: unchanged.
Full regression: frontend 17.6s / iscsi 31.2s / nvme 31.2s
Stop-rule audit:
- In-allowlist per decision §5.2: Identify (all 4 CNS) ✓
- QA finding #1 (11a includes A10 + A10.5) ✓
- QA finding #3 (ANA fields zero in 11a/11b) ✓
- §6 #4 advertised≡implemented: OACS/OAES/ONCS/CMIC/ANACAP
/KAS/OFCS all zero aligned with un-ported admin commands ✓
- §6 #7 no V2 adapter.go / write_retry.go / bufpool.go ported ✓
- No core/authority / core/adapter imports in nvme package ✓
- No AssignmentInfo / authority-minting literals ✓
- Stale R/W semantics unchanged (IO path unmodified) ✓
- N1 symmetry: Serial derives per VolumeID (ckpt 10.5 lesson) ✓
Sign tier per port plan §7: T2B-NVMe-provisional remains.
11a acceptance met (Go-harness Identify + IO round-trip green).
Linux nvme connect still gated on 11b (Property+Features+KATO).
Pre-commit self-review applied 2 fixes:
I1: Removed unused nvmeVersion14 constant (dead code)
I2: Removed sw-added HostNQN cross-check in handleIOConnect
(V2 doesn't do it; Linux-compat safer)
Known items flagged for 11b or later:
K1: IO sessions outliving admin use pinned ctrl pointer; new
IO Connects fail. Documented in §3.1 A10.5 note.
K2: connected + qidSet tracked separately (dispatch gate vs
re-Connect gate)
K3: NSID=0xFFFFFFFF (broadcast) mapped to NSID=1 internally
K5: adminDispatch ctx parameter unused until 11b
QA-owned A-tier tests pending (per port plan §4):
- TestT2V2Port_NVMe_IdentifyNamespaceDescriptor_Deterministic
(4 pins: R1 a-d)
- TestT2V2Port_NVMe_IdentifyAdvertisedFeatures_AreServed
(walks advertised bits; §6 stop-rule #4 enforcement)
- TestT2V2Port_NVMe_NoAuthorityOrStorageBleed_AdminSurface
(AST boundary guard extended to identify.go)
Languages
Go
84.7%
Rust
7.7%
Shell
2.7%
templ
1.5%
Java
1%
Other
2.1%