--- zzzz-none-000/linux-5.15.111/net/ipv4/route.c 2023-05-11 14:00:40.000000000 +0000 +++ puma7-atom-6670-761/linux-5.15.111/net/ipv4/route.c 2024-02-07 10:23:30.000000000 +0000 @@ -57,6 +57,10 @@ * Ilia Sotnikov : Ignore TOS on PMTUD and Redirect * Ilia Sotnikov : Removed TOS from hash calculations */ + /* + * Includes Intel Corporation's changes/modifications dated: 2018. + * Changed/modified portions - Copyright 2018, Intel Corporation. + */ #define pr_fmt(fmt) "IPv4: " fmt @@ -110,6 +114,9 @@ #include #include #include +#ifdef CONFIG_TI_PACKET_PROCESSOR +#include +#endif #include "fib_lookup.h" @@ -1327,7 +1334,26 @@ INDIRECT_CALLABLE_SCOPE unsigned int ipv4_mtu(const struct dst_entry *dst) { - return ip_dst_mtu_maybe_forward(dst, false); + const struct rtable *rt = (const struct rtable *)dst; + unsigned int mtu = rt->rt_pmtu; + + if (!mtu || time_after_eq(jiffies, rt->dst.expires)) + mtu = dst_metric_raw(dst, RTAX_MTU); + + if (mtu) + goto out; + + mtu = READ_ONCE(dst->dev->mtu); + + if (unlikely(ip_mtu_locked(dst))) { + if (rt->rt_uses_gateway && mtu > 576) + mtu = 576; + } + +out: + mtu = min_t(unsigned int, mtu, IP_MAX_MTU); + + return mtu - lwtunnel_headroom(dst->lwtstate, mtu); } EXPORT_INDIRECT_CALLABLE(ipv4_mtu); @@ -1772,6 +1798,10 @@ __be32 saddr) { RT_CACHE_STAT_INC(in_martian_src); +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* Create a NULL PP device to drop all dropped martian packets before they reach the host */ + ti_hil_pp_event (IP_DISCARD_MARTIAN_PKT_IPV4, (void *)skb); +#endif //CONFIG_TI_PACKET_PROCESSOR #ifdef CONFIG_IP_ROUTE_VERBOSE if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) { /* @@ -2420,6 +2450,10 @@ */ martian_destination: RT_CACHE_STAT_INC(in_martian_dst); +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* Create a NULL PP device, to drop all dropped martian dst packets before they reach the host */ + ti_hil_pp_event (IP_DISCARD_MARTIAN_PKT_IPV4, (void *)skb); +#endif //CONFIG_TI_PACKET_PROCESSOR #ifdef CONFIG_IP_ROUTE_VERBOSE if (IN_DEV_LOG_MARTIANS(in_dev)) net_warn_ratelimited("martian destination %pI4 from %pI4, dev %s\n",