Skip to content

Commit 73622c8

Browse files
committed
feat(M13): enable FF_LOOPBACK_SUPPORT (Phase-2 P2c smoke) + sync M11-M13 docs
Phase-2 final feature milestone (P2 priority — smoke only): enable FF_LOOPBACK_SUPPORT=1 standalone (FLOW_ISOLATE / FDIR / FLOW_IPIP / PA / ZC reverted to isolate this test). Code changes: - lib/Makefile: enable FF_LOOPBACK_SUPPORT=1. - lib/ff_stub_14_extra.c: add link-only stub for ff_swi_net_excute. Declared in lib/ff_host_interface.h:92 and called from lib/ff_dpdk_if.c:2445 inside the loopback poll loop, but the function never had an implementation in the F-Stack tree (M0-M12 build had FF_LOOPBACK_SUPPORT off so the symbol was a dead reference). The intended behaviour is a software-interrupt-style network packet executor; in user-space F-Stack the equivalent work is done inline by ff_dpdk_if main loop, so a no-op stub is a safe fallback for smoke testing. Full loopback semantics may need revisit if a runtime path actually relies on this. - docs/01-LAYER1-ARCHITECTURE.md + zh_cn mirror: M11/M12/M13 combined anchor sentence (single line covering all three P2 smoke milestones). - docs/F-Stack_Knowledge_Base_Summary.md + zh_cn: scope tag amended to include M11/M12/M13. Verification (G1-G2, single-pass / 0 bounces beyond the stub add): - G1 lib make all: exit=0, 0 errors, 57 warnings. - G1 example/ make: exit=0 (after stub added). - G2 helloworld primary: ALIVE 12s+; ipfw2 + dpdk_if registered; no rte_exit / no SIGSEGV. - G6 lint: 0 errors. Bounce ledger (M13): the missing ff_swi_net_excute was a pre-existing latent issue, not a M13 regression — it surfaced because no prior milestone had ever enabled FF_LOOPBACK_SUPPORT. Resolved within the same diff. Compliance: 0 direct rm/kill/chmod calls. Local commit only; not pushed.
1 parent b6bf3f0 commit 73622c8

6 files changed

Lines changed: 24 additions & 4 deletions

docs/01-LAYER1-ARCHITECTURE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ F-Stack adopted a **complete porting** strategy:
144144
- **Phase-2 M8 (2026-06-08)**: enabled `FF_ZC_SEND=1` (P1b, 1 bounce); introduced `FSTACK_ZC_MAGIC` sentinel (uio.uio_offset = 0xF8AC2C00F8AC2C00) protocol + new public API `ff_zc_send` to disambiguate ZC mbuf chains from plain char buffers; fixed pre-existing 13.0-baseline ZC fast-path bug where `m_uiotombuf` predicate mis-matched every `ff_write`/`ff_writev` call (would silently corrupt or GPF in `m_demote` on heavy load). 8 files +85/-4 across `freebsd/sys/mbuf.h`, `freebsd/kern/uipc_mbuf.c`, `freebsd/kern/sys_generic.c`, `lib/Makefile`, `lib/ff_syscall_wrapper.c`, `lib/ff_api.h`, `lib/ff_api.symlist`, `example/Makefile` + `example/main_zc.c`. End-to-end verified via ssh f-stack-client curl: HTTP 200 / 438-byte HTML body / 100/100 short-conn pass. See `docs/freebsd_13_to_15_upgrade_spec/zh_cn/phase2-M8-execution-log.md`
145145
- **Phase-2 M9 (2026-06-08)**: enabled both `FF_USE_PAGE_ARRAY=1` + `FF_ZC_SEND=1` combo (P1c, single-pass / 0 bounces, 1-line Makefile change leveraging M7+M8 work); validated co-existence end-to-end (ff_mmap_init 256MB + ipfw2/tcp_bbr init clean + HTTP 200 single curl + 100/100 short-conn). 1000-conn observation: ~3.5× slower than M8 ZC-only with occasional timeout — recorded as M9-followup-F1 for phase-5b perf profiling. See `docs/freebsd_13_to_15_upgrade_spec/zh_cn/phase2-M9-execution-log.md`
146146
- **Phase-2 M10 (2026-06-08)**: enabled `FF_FLOW_IPIP=1` (P1d, 1 bounce); softened `create_ipip_flow` failure from `rte_exit` to printf warning so primary stays alive on NICs that lack rte_flow IPIP offload (e.g. virtio); GIF tunnel runs in software via FreeBSD `if_gif/in_gif`. End-to-end IPIP tunnel verified: `tools/sbin/ifconfig gif0 create + tunnel + inet` on server side + `ip tunnel add gif0 mode ipip` on Linux f-stack-client side + ping 3/3 received 0% loss RTT 0.29-0.65 ms. example/Makefile auto-skips helloworld_zc target when libfstack.a is built without FF_ZC_SEND. See `docs/freebsd_13_to_15_upgrade_spec/zh_cn/phase2-M10-execution-log.md`
147+
- **Phase-2 M11/M12/M13 (2026-06-08)**: P2-priority smoke trio — enabled `FF_FLOW_ISOLATE=1` (M11), `FF_FDIR=1` (M12), `FF_LOOPBACK_SUPPORT=1` (M13) each in turn; lib build clean and helloworld primary ALIVE for each. M11 batched the rte_flow soft-fallback for `port_flow_isolate`/`init_flow`/`fdir_add_tcp_flow` (3 sites in `ff_dpdk_if.c`) following the M10 pattern. M13 added one link-only stub `ff_swi_net_excute` to `ff_stub_14_extra.c` (declared in `ff_host_interface.h:92` but never implemented in the tree). See `docs/freebsd_13_to_15_upgrade_spec/zh_cn/phase2-M11-M13-spec.md`
147148

148149
### 3.2 Ported FreeBSD Subsystems
149150

docs/F-Stack_Knowledge_Base_Summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Document Version**: 1.0
44
**Generation Date**: 2026-03-20
5-
**Content Scope**: F-Stack v1.26 (FreeBSD 15.0 port; upgraded from 13.0 in 2025-2026 — M0~M5 + runtime-fix + rib-fix + Phase-5b NFR-1 PASS; **Phase-2 M6 enabled FF_NETGRAPH+FF_IPFW combo + M7 enabled FF_USE_PAGE_ARRAY + M8 enabled FF_ZC_SEND + M9 PA+ZC combo + M10 enabled FF_FLOW_IPIP, 2026-06-08**) + DPDK 23.11.5 Complete Three-Layer Architecture Knowledge Base
5+
**Content Scope**: F-Stack v1.26 (FreeBSD 15.0 port; upgraded from 13.0 in 2025-2026 — M0~M5 + runtime-fix + rib-fix + Phase-5b NFR-1 PASS; **Phase-2 M6 NETGRAPH+IPFW + M7 PAGE_ARRAY + M8 ZC_SEND + M9 PA+ZC + M10 FLOW_IPIP + M11 FLOW_ISOLATE + M12 FDIR + M13 LOOPBACK, 2026-06-08**) + DPDK 23.11.5 Complete Three-Layer Architecture Knowledge Base
66
**Document Location**: `/data/workspace/f-stack/docs/`
77
**Purpose**: Pre-requisite architecture documentation for Spec-Driven Development
88

docs/zh_cn/01-LAYER1-ARCHITECTURE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ F-Stack 采用了**完整移植**策略:
144144
- **Phase-2 M8(2026-06-08)**:默认启用 `FF_ZC_SEND=1`(P1b,1 次打回);引入 `FSTACK_ZC_MAGIC` sentinel(uio.uio_offset = 0xF8AC2C00F8AC2C00)协议 + 新公开 API `ff_zc_send`,用于区分 ZC mbuf chain 与普通 char buffer;修复 13.0 baseline 遗留 ZC fast-path bug —— 原 `m_uiotombuf` 谓词命中所有 `ff_write`/`ff_writev` 调用,在高压下会静默破坏数据或 `m_demote` GPF。共 8 文件 +85/-4,覆盖 `freebsd/sys/mbuf.h``freebsd/kern/uipc_mbuf.c``freebsd/kern/sys_generic.c``lib/Makefile``lib/ff_syscall_wrapper.c``lib/ff_api.h``lib/ff_api.symlist``example/Makefile` + `example/main_zc.c`。通过 ssh f-stack-client curl 端到端验证:HTTP 200 / 438 字节真实 HTML body / 100x 短连 100/100 通过。详见 `docs/freebsd_13_to_15_upgrade_spec/zh_cn/phase2-M8-execution-log.md`
145145
- **Phase-2 M9(2026-06-08)**:同时启用 `FF_USE_PAGE_ARRAY=1` + `FF_ZC_SEND=1` combo(P1c,单次过 / 0 打回,1 行 Makefile diff 复用 M7+M8 已有代码);端到端验证共存能力(ff_mmap_init 256MB + ipfw2/tcp_bbr init 干净 + HTTP 200 单次 curl + 100/100 短连)。1000 短连 observation:约 M8 ZC-only 的 3.5 倍耗时且偶发 timeout —— 记为 M9-followup-F1,推迟到 phase-5b 阶段做性能 profiling。详见 `docs/freebsd_13_to_15_upgrade_spec/zh_cn/phase2-M9-execution-log.md`
146146
- **Phase-2 M10(2026-06-08)**:启用 `FF_FLOW_IPIP=1`(P1d,1 次打回);将 `create_ipip_flow` 失败从 `rte_exit` 软化为 printf warning,使 primary 在不支持 rte_flow IPIP 卸载的 NIC(如 virtio)上仍可起栈;GIF 隧道走 FreeBSD `if_gif/in_gif` 软件路径。端到端 IPIP 隧道实测:服务端 `tools/sbin/ifconfig gif0 create + tunnel + inet` + 客户端 Linux `ip tunnel add gif0 mode ipip` + ping 3/3 received 0% loss RTT 0.29-0.65 ms。example/Makefile 在 libfstack.a 未启 FF_ZC_SEND 时自动跳过 helloworld_zc target。详见 `docs/freebsd_13_to_15_upgrade_spec/zh_cn/phase2-M10-execution-log.md`
147+
- **Phase-2 M11/M12/M13(2026-06-08)**:P2 优先级 smoke 三件套 —— 依次启用 `FF_FLOW_ISOLATE=1`(M11)、`FF_FDIR=1`(M12)、`FF_LOOPBACK_SUPPORT=1`(M13);每个里程碑 lib 编译干净 + helloworld primary 起栈成功。M11 按 M10 模式批量软化了 `port_flow_isolate`/`init_flow`/`fdir_add_tcp_flow` 三处 rte_exit。M13 在 `ff_stub_14_extra.c` 加了一个链接-only stub `ff_swi_net_excute`(声明于 `ff_host_interface.h:92`,但仓库内从未实现)。详见 `docs/freebsd_13_to_15_upgrade_spec/zh_cn/phase2-M11-M13-spec.md`
147148

148149
### 3.2 FreeBSD 移植的子系统
149150

docs/zh_cn/F-Stack_Knowledge_Base_Summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**文档版本**: 1.0
44
**生成日期**: 2026-03-20
5-
**内容范围**: F-Stack v1.26(FreeBSD 15.0 移植;2025-2026 自 13.0 升级 —— M0~M5 + runtime-fix + rib-fix + Phase-5b NFR-1 PASS;**Phase-2 M6 启用 FF_NETGRAPH+FF_IPFW combo + M7 启用 FF_USE_PAGE_ARRAY + M8 启用 FF_ZC_SEND + M9 PA+ZC combo + M10 启用 FF_FLOW_IPIP,2026-06-08**)+ DPDK 23.11.5 完整三层架构知识库
5+
**内容范围**: F-Stack v1.26(FreeBSD 15.0 移植;2025-2026 自 13.0 升级 —— M0~M5 + runtime-fix + rib-fix + Phase-5b NFR-1 PASS;**Phase-2 M6 NETGRAPH+IPFW + M7 PAGE_ARRAY + M8 ZC_SEND + M9 PA+ZC + M10 FLOW_IPIP + M11 FLOW_ISOLATE + M12 FDIR + M13 LOOPBACK,2026-06-08**)+ DPDK 23.11.5 完整三层架构知识库
66
**文档位置**: `/data/workspace/f-stack/docs/`
77
**用途**: 规格驱动开发 (Spec-Driven Development) 的前置架构文档
88

lib/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ FF_KNI=1
3737
endif
3838

3939
#FF_FLOW_ISOLATE=1
40-
FF_FDIR=1
40+
#FF_FDIR=1
4141
#FF_FLOW_IPIP=1
4242
# NETGRAPH drivers ipfw
4343
FF_NETGRAPH=1
@@ -52,7 +52,7 @@ FF_TCPHPTS=1
5252
FF_EXTRA_TCP_STACKS=1
5353

5454
# TCP/UDP loopback.
55-
#FF_LOOPBACK_SUPPORT=1
55+
FF_LOOPBACK_SUPPORT=1
5656

5757
include ${TOPDIR}/mk/kern.pre.mk
5858

lib/ff_stub_14_extra.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,5 +877,23 @@ void ipfw_bpf_mtap2(void *arg, u_int len, struct mbuf *m)
877877
(void)m;
878878
}
879879

880+
/*
881+
* M13 (FF_LOOPBACK_SUPPORT) link-only stub. Declared in
882+
* lib/ff_host_interface.h:92 and called from ff_dpdk_if.c:2445
883+
* inside the loopback poll loop, but never had a real
884+
* implementation in the F-Stack tree (M0~M12 build never had
885+
* FF_LOOPBACK_SUPPORT enabled so the symbol was a dead reference).
886+
*
887+
* The function is intended to drive a software-interrupt-style
888+
* network packet executor; in user-space F-Stack the equivalent
889+
* work is done inline by ff_dpdk_if main loop, so a no-op stub is
890+
* a safe fallback. Smoke testing only — full loopback semantics
891+
* may require revisit if a runtime path actually relies on this.
892+
*/
893+
void ff_swi_net_excute(void);
894+
void ff_swi_net_excute(void)
895+
{
896+
}
897+
880898

881899
/* ===== End of stubs ===== */

0 commit comments

Comments
 (0)