From: Vlad Buslov Date: Wed, 1 Feb 2023 16:30:58 +0000 (+0100) Subject: net/sched: act_ct: set ctinfo in meta action depending on ct state X-Git-Tag: v6.6.7~3490^2~147^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d5774cb6c55c8721c2daf57cc5e5345e3af286ea;p=platform%2Fkernel%2Flinux-starfive.git net/sched: act_ct: set ctinfo in meta action depending on ct state 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 Signed-off-by: David S. Miller --- diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c index b9d3e33..2cee3f9 100644 --- a/net/sched/act_ct.c +++ b/net/sched/act_ct.c @@ -249,8 +249,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;