--- zzzz-none-000/linux-5.15.111/net/netfilter/nf_conntrack_core.c 2023-05-11 14:00:40.000000000 +0000 +++ puma7-arm-6670-761/linux-5.15.111/net/netfilter/nf_conntrack_core.c 2024-02-07 09:28:10.000000000 +0000 @@ -9,6 +9,13 @@ * (C) 2005-2012 Patrick McHardy */ +/* +* 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 @@ -29,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +61,7 @@ #include #include "nf_internals.h" +#include __cacheline_aligned_in_smp spinlock_t nf_conntrack_locks[CONNTRACK_LOCKS]; EXPORT_SYMBOL_GPL(nf_conntrack_locks); @@ -698,6 +707,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 = READ_ONCE(ct->timeout) - nfct_time_stamp; @@ -1627,6 +1645,16 @@ 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; +#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. */ @@ -1758,7 +1786,6 @@ exp->expectfn(ct, exp); nf_ct_expect_put(exp); } - return &ct->tuplehash[IP_CT_DIR_ORIGINAL]; } @@ -1828,6 +1855,19 @@ } } nf_ct_set(skb, ct, 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 0; } @@ -1974,6 +2014,15 @@ 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 + ret = nf_conntrack_handle_packet(ct, skb, dataoff, ctinfo, state); if (ret <= 0) { /* Invalid: inverse of the return code tells @@ -2512,6 +2561,12 @@ return net_eq(nf_ct_net(i), data); } +void nf_conntrack_flush_report(struct net *net, u32 portid, int report) +{ + nf_ct_iterate_cleanup_net(net, kill_all, NULL, portid, report); +} +EXPORT_SYMBOL_GPL(nf_conntrack_flush_report); + void nf_conntrack_cleanup_start(void) { conntrack_gc_work.exiting = true;