[SRU][J:linux-bluefield][PATCH v2 05/10] net/sched: act_ct: set ctinfo in meta action depending on ct state

Tony Duan yifeid at nvidia.com
Tue May 16 22:59:54 UTC 2023


From: Vlad Buslov <vladbu at nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/2019264

Currently tcf_ct_flow_table_fill_actions() function assumes that only
established connections can be offloaded and always sets ctinfo to either
IP_CT_ESTABLISHED or IP_CT_ESTABLISHED_REPLY strictly based on direction
without checking actual connection state. To enable UDP NEW connection
offload set the ctinfo, metadata cookie and NF_FLOW_HW_ESTABLISHED
flow_offload flags bit based on ct->status value.

Signed-off-by: Vlad Buslov <vladbu at nvidia.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit d5774cb6c55c8721c2daf57cc5e5345e3af286ea)
Signed-off-by: Paul Blakey <paulb at nvidia.com>
Signed-off-by: Tony Duan <yifeid at nvidia.com>
---
 net/sched/act_ct.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index eb26f27..1c21743 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -253,8 +253,10 @@ static int tcf_ct_flow_table_fill_actions(struct net *net,
 	switch (tdir) {
 	case FLOW_OFFLOAD_DIR_ORIGINAL:
 		dir = IP_CT_DIR_ORIGINAL;
-		ctinfo = IP_CT_ESTABLISHED;
-		set_bit(NF_FLOW_HW_ESTABLISHED, &flow->flags);
+		ctinfo = test_bit(IPS_SEEN_REPLY_BIT, &ct->status) ?
+			IP_CT_ESTABLISHED : IP_CT_NEW;
+		if (ctinfo == IP_CT_ESTABLISHED)
+			set_bit(NF_FLOW_HW_ESTABLISHED, &flow->flags);
 		break;
 	case FLOW_OFFLOAD_DIR_REPLY:
 		dir = IP_CT_DIR_REPLY;
-- 
1.8.3.1




More information about the kernel-team mailing list