--- zzzz-none-000/linux-4.9.279/net/netfilter/nf_conntrack_core.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-arm-6591-750/linux-4.9.279/net/netfilter/nf_conntrack_core.c 2023-02-08 10:58:16.000000000 +0000 @@ -12,6 +12,13 @@ * published by the Free Software Foundation. */ +/* +* Includes MaxLinear's changes dated: 2021. +* Changed portions - Copyright 2020-2021, MaxLinear, Inc. +* Includes Intel Corporation's changes dated: 2014, 2020. +* Changed portions - Copyright 2014-2020, IntelCorporation. +*/ + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include @@ -33,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +65,8 @@ #include #include +#include + #define NF_CONNTRACK_VERSION "0.5.0" int (*nfnetlink_parse_nat_setup_hook)(struct nf_conn *ct, @@ -490,6 +500,15 @@ if (test_and_set_bit(IPS_DYING_BIT, &ct->status)) return false; +#if defined(CONFIG_TI_PACKET_PROCESSOR) && defined(CONFIG_INTEL_KERNEL_PP_DRIVER_LOCAL) + /* Generate an event indicating the connection tracking entry is being deleted. */ + ti_hil_pp_event (TI_CT_NETFILTER_DELETE, (void *)ct); + + /* Did the HIL profile take over or not? */ + if ((ct->ti_pp_status_flag & TI_PP_KILL_CONNTRACK) == 0) + return false; /* HIL Profile took over... */ +#endif + tstamp = nf_conn_tstamp_find(ct); if (tstamp) { s32 timeout = ct->timeout - nfct_time_stamp; @@ -1136,6 +1155,18 @@ nf_ct_zone_add(ct, zone); +#if defined(CONFIG_TI_PACKET_PROCESSOR) && defined(CONFIG_INTEL_KERNEL_PP_DRIVER_LOCAL) +#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) + INIT_LIST_HEAD(&ct->tuplehash[IP_CT_DIR_ORIGINAL].pp_session_list_head); + INIT_LIST_HEAD(&ct->tuplehash[IP_CT_DIR_REPLY ].pp_session_list_head); + ct->tuplehash[IP_CT_DIR_ORIGINAL].rst_tcp_win = 0; + ct->tuplehash[IP_CT_DIR_REPLY].rst_tcp_win = 0; + ct->ti_pp_status_flag = 0; + + INIT_LIST_HEAD( &ct->ti_pp_scb_id ); +#endif /* CONFIG_NF_CONNTRACK || CONFIG_NF_CONNTRACK_MODULE */ +#endif /* CONFIG_TI_PACKET_PROCESSOR */ + /* Because we use RCU lookups, we set ct_general.use to zero before * this is inserted in any list. */ @@ -1280,7 +1311,6 @@ exp->expectfn(ct, exp); nf_ct_expect_put(exp); } - return &ct->tuplehash[IP_CT_DIR_ORIGINAL]; } @@ -1345,6 +1375,18 @@ } skb->nfct = &ct->ct_general; skb->nfctinfo = *ctinfo; + +#if defined(CONFIG_TI_PACKET_PROCESSOR) && defined(CONFIG_INTEL_KERNEL_PP_DRIVER_LOCAL) + { + struct ct_entry_created_t entry_info; + + entry_info.skb = skb; + entry_info.ct = ct; + /* Generate an event indicating that a connection tracking + * entry has been created. */ + ti_hil_pp_event(TI_CT_ENTRY_CREATED, (void *)(&entry_info)); + } +#endif //CONFIG_TI_PACKET_PROCESSOR return ct; } @@ -1419,6 +1461,14 @@ goto out; } +#if defined(CONFIG_TI_PACKET_PROCESSOR) && defined(CONFIG_INTEL_KERNEL_PP_DRIVER_LOCAL) + /* Check if the packet belongs to a connection which has not been acclerated? + * For all packets matching the connection make sure the BYPASS flag is set. */ + if (ct->ti_pp_status_flag & TI_PP_BYPASS) + { + TI_HIL_ADD_PP_INFO_FLAGS(skb, TI_HIL_PACKET_FLAG_PP_SESSION_BYPASS); + } +#endif NF_CT_ASSERT(skb->nfct); /* Decide what timeout policy we want to apply to this flow. */ @@ -1700,6 +1750,12 @@ } EXPORT_SYMBOL_GPL(nf_ct_free_hashtable); +void nf_conntrack_flush_report(struct net *net, u32 portid, int report) +{ + nf_ct_iterate_cleanup(net, kill_all, NULL, portid, report); +} +EXPORT_SYMBOL_GPL(nf_conntrack_flush_report); + static int untrack_refs(void) { int cnt = 0, cpu;