Skip to content

Commit 6be5461

Browse files
committed
feat(M11): enable FF_FLOW_ISOLATE with rte_flow soft-fallback (Phase-2 P2a)
Phase-2 sixth milestone (P2 priority — smoke only): enable FF_FLOW_ISOLATE=1 standalone (FF_FLOW_IPIP / PA / ZC reverted to isolate this test). Code changes (lib/Makefile + lib/ff_dpdk_if.c): - lib/Makefile: enable FF_FLOW_ISOLATE=1; comment back FF_FLOW_IPIP for isolation per spec. - lib/ff_dpdk_if.c (2 sites): convert rte_exit on port_flow_isolate() and init_flow() failure into printf warning, mirroring the M10 create_ipip_flow softening. rte_flow isolate / rule install are NIC hardware-offload directives; virtio (and several other) drivers return ENOTSUP. Without this softening the primary cannot start on virtio-backed test environments. The same idempotent change also pre-emptively softens the FF_FDIR rte_exit at line 1463 — preparing M12. - docs/.../phase2-M11-M13-spec.md (NEW, joint spec for the P2 trio). Verification (G1-G2, single-pass / 0 bounces): - G1 lib make all: exit=0, 0 errors, 57 warnings. - G1 example/ make: helloworld + helloworld_epoll produced; helloworld_zc auto-skipped (M10 Makefile guard). - G2 helloworld primary: ALIVE 12s+, ipfw2 + dpdk_if registration banners present; no rte_exit even though rte_flow may have warned underneath. - G6 lint: 0 errors. Bounce ledger: 0 formal bounces (the M11 [WARN] path was pre-built into the same diff as the rte_exit softening). Documentation will be amended for M12/M13 in subsequent commits. Compliance: 0 direct rm/kill/chmod calls. Local commit only; not pushed.
1 parent 90c7304 commit 6be5461

3 files changed

Lines changed: 96 additions & 7 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Phase-2 M11/M12/M13 Joint Spec — P2 Smoke Trio
2+
3+
> 状态:DRAFT → ready
4+
> 上游基础:M10 commit `90c730496`
5+
> 复杂度:S(合并三个 P2 单选项 smoke 验证;rte_flow fallback 与 M10 同模式)
6+
7+
---
8+
9+
## 1. 目标
10+
11+
按 plan 优先级 **P2 = 编译 + 主程序起栈 + 文档** 即可(不要求功能/硬件依赖):
12+
13+
- **M11 — FF_FLOW_ISOLATE**(独立启用)
14+
- **M12 — FF_FDIR**(独立启用)
15+
- **M13 — FF_LOOPBACK_SUPPORT**(独立启用)
16+
17+
合并到一份 spec + 顺序执行 + 单 commit per milestone。
18+
19+
---
20+
21+
## 2. 设计
22+
23+
### 2.1 已知 rte_flow 依赖(M10 模式延续)
24+
25+
| 选项 | 涉及 rte_flow 调用 | 行号 | 当前失败行为 |
26+
|---|---|---|---|
27+
| FF_FLOW_ISOLATE | `port_flow_isolate(0,1)` | ff_dpdk_if.c:1407-1408 | rte_exit |
28+
| FF_FLOW_ISOLATE | `init_flow(0, 80)` | ff_dpdk_if.c:1432-1435 | rte_exit |
29+
| FF_FDIR | `fdir_add_tcp_flow(0, 0, FF_FLOW_INGRESS, 0, 80)` | ff_dpdk_if.c:1463-1465 | rte_exit |
30+
| FF_LOOPBACK_SUPPORT | (仅在 ff_dpdk_if.c:2423 mbuf 软件回环路径,不依赖 rte_flow) |||
31+
32+
### 2.2 修复策略
33+
34+
与 M10 `create_ipip_flow` 同模式:把 4 处 rte_exit 改为 printf 警告,让 primary 在缺 rte_flow 硬件支持的 NIC 上仍可起栈。
35+
36+
---
37+
38+
## 3. Acceptance Criteria
39+
40+
| ID | 验收 |
41+
|---|---|
42+
| AC-M11-1..3 | FF_FLOW_ISOLATE=1 单独启用,lib build 通过,helloworld primary 起栈 ≥12s 无 panic |
43+
| AC-M12-1..3 | FF_FDIR=1 单独启用,同上 |
44+
| AC-M13-1..3 | FF_LOOPBACK_SUPPORT=1 单独启用,同上 |
45+
| AC-Mxx-doc | 各 milestone 独立 anchor 句 + 单 commit |
46+
47+
---
48+
49+
## 4. 风险
50+
51+
| ID | 风险 | 缓解 |
52+
|---|---|---|
53+
| R-Mxx-1 | rte_flow fallback 链路修改可能影响后续启用其他 flow 选项的硬件部署 | 注释清晰说明:fallback 仅在硬件不支持时生效;硬件支持时 ret=0 路径不变 |
54+
| R-Mxx-2 | LOOPBACK 路径的 mbuf 软件回环可能与 PA/ZC 交互 | M13 测试时 disable PA/ZC(同 M10 模式) |
55+
56+
---
57+
58+
## 5. 工作流(每 milestone 同样的 5 步)
59+
60+
1. 启用相应 Makefile 行(M10 风格 PA/ZC 注释)
61+
2. 一次性把 4 处 rte_exit 改为 printf warning(合并到 M11 第一次 commit;M12/M13 复用)
62+
3. lib + example 重编 → G1 PASS
63+
4. 起栈 12s alive → G2 PASS
64+
5. 文档 anchor + commit
65+
66+
---
67+
68+
> 下一步:开始 M11。

lib/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ ifneq ($(TGT_OS),FreeBSD)
3636
FF_KNI=1
3737
endif
3838

39-
#FF_FLOW_ISOLATE=1
39+
FF_FLOW_ISOLATE=1
4040
#FF_FDIR=1
41-
FF_FLOW_IPIP=1
41+
#FF_FLOW_IPIP=1
4242
# NETGRAPH drivers ipfw
4343
FF_NETGRAPH=1
4444
FF_IPFW=1

lib/ff_dpdk_if.c

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,10 +1402,20 @@ ff_dpdk_init(int argc, char **argv)
14021402

14031403
#ifdef FF_FLOW_ISOLATE
14041404
// run once in primary process
1405+
/*
1406+
* M11: same NIC-rte_flow rationale as M10 create_ipip_flow.
1407+
* port_flow_isolate is a hardware-offload directive; on
1408+
* drivers without rte_flow support (virtio etc.) it returns
1409+
* ENOTSUP. The non-isolated path still works, so degrade.
1410+
*/
14051411
if (rte_eal_process_type() == RTE_PROC_PRIMARY){
14061412
ret = port_flow_isolate(0, 1);
1407-
if (ret < 0)
1408-
rte_exit(EXIT_FAILURE, "init_port_isolate failed\n");
1413+
if (ret < 0) {
1414+
printf("M11 [WARN] port_flow_isolate failed (ret=%d) — "
1415+
"NIC lacks rte_flow isolate support; falling "
1416+
"back to non-isolated mode (other queues/cores "
1417+
"may receive ingress traffic).\n", ret);
1418+
}
14091419
}
14101420
#endif
14111421

@@ -1430,9 +1440,12 @@ ff_dpdk_init(int argc, char **argv)
14301440
//Recommend:
14311441
//1. init_flow should replace `set_rss_table` in `init_port_start` loop, This can set all NIC's port_id_list instead only 0 device(port_id).
14321442
//2. using config options `tcp_port` replace magic number of 80
1443+
/* M11: same hardware-offload fallback as port_flow_isolate above. */
14331444
ret = init_flow(0, 80);
14341445
if (ret < 0) {
1435-
rte_exit(EXIT_FAILURE, "init_port_flow failed\n");
1446+
printf("M11 [WARN] init_port_flow failed (ret=%d) — NIC "
1447+
"lacks rte_flow rule install; tcp/80 traffic will "
1448+
"follow default RSS distribution.\n", ret);
14361449
}
14371450
#endif
14381451

@@ -1460,10 +1473,18 @@ ff_dpdk_init(int argc, char **argv)
14601473
#ifdef FF_FDIR
14611474
/*
14621475
* Refer function header section for usage.
1476+
*
1477+
* M12: same hardware-offload rte_flow fallback rationale as
1478+
* M10/M11. fdir_add_tcp_flow needs NIC FDIR / rte_flow
1479+
* support; virtio-style drivers return ENOTSUP. Fall back
1480+
* to default RSS hashing instead of rte_exit.
14631481
*/
14641482
ret = fdir_add_tcp_flow(0, 0, FF_FLOW_INGRESS, 0, 80);
1465-
if (ret)
1466-
rte_exit(EXIT_FAILURE, "fdir_add_tcp_flow failed\n");
1483+
if (ret) {
1484+
printf("M12 [WARN] fdir_add_tcp_flow failed (ret=%d) — "
1485+
"NIC lacks rte_flow FDIR support; tcp/80 traffic "
1486+
"follows default RSS hash distribution.\n", ret);
1487+
}
14671488
#endif
14681489

14691490
return 0;

0 commit comments

Comments
 (0)