--- zzzz-none-000/linux-5.15.111/net/ipv4/ip_output.c 2023-05-11 14:00:40.000000000 +0000 +++ puma7-atom-6670-761/linux-5.15.111/net/ipv4/ip_output.c 2024-02-07 10:23:30.000000000 +0000 @@ -42,6 +42,12 @@ * datagrams. * Hirokazu Takahashi: sendfile() on UDP works now. */ +/* + Includes MaxLinear's changes dated: 2022. + Changed portions - Copyright 2020-2022, MaxLinear, Inc. + Includes Intel Corporation's changes dated: 2018,2020. + Changed portions - Copyright 2018-2020, Intel Corporation. +*/ #include #include @@ -83,6 +89,27 @@ #include #include +#include + +#if PUMA7_OR_NEWER_SOC_TYPE +# ifdef CONFIG_ARM_AVALANCHE_SOC +# include +# else +# include +# endif +#endif + +#ifdef CONFIG_TI_DOCSIS_INPUT_DEV +# define DBRIDGE_IFINDEX_CHK(__ifindex, format, args...) \ +{ \ + if (((__ifindex) < 0) || ((__ifindex) >= TI_MAX_DEVICE_INDEX)) \ + { \ + printk("\n===>>> %s - %d: Currupt " #__ifindex " - %d\n" format, __func__, __LINE__, __ifindex, ##args); \ + BUG(); \ + } \ +} +#endif + static int ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int mtu, @@ -112,6 +139,18 @@ skb->protocol = htons(ETH_P_IP); + if (avm_pa_dev_local_out(AVM_PA_NET_IP_DEVINFO(net), skb) == AVM_PA_RX_STOLEN) + return 0; + +#ifdef CONFIG_TI_ICMP_ECHO_REPLY_NETFILTER_BYPASS + if(iph->protocol == IPPROTO_ICMP) { + struct icmphdr *icmph = (struct icmphdr *)((unsigned char *)(iph)+iph->ihl*4); + if(icmph->type == ICMP_ECHOREPLY) { + return 1; + } + } +#endif /* CONFIG_TI_ICMP_ECHO_REPLY_NETFILTER_BYPASS */ + return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk, skb, NULL, skb_dst(skb)->dev, dst_output); @@ -199,6 +238,11 @@ unsigned int hh_len = LL_RESERVED_SPACE(dev); struct neighbour *neigh; bool is_v6gw = false; +#ifdef CONFIG_TI_PACKET_PROCESSOR +# if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) + const struct nf_conn *ct; +# endif +#endif if (rt->rt_type == RTN_MULTICAST) { IP_UPD_PO_STATS(net, IPSTATS_MIB_OUTMCAST, skb->len); @@ -211,6 +255,16 @@ return -ENOMEM; } +#ifdef CONFIG_TI_PACKET_PROCESSOR +# if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) + ct = (struct nf_conn *)skb_nfct(skb); + if (ct != NULL) + { + ti_hil_pp_event( TI_CT_NETFILTER_CANCEL_DISCARD_ACCELERATION, (void *)ct ); + } +# endif +#endif + if (lwtunnel_xmit_redirect(dst->lwtstate)) { int res = lwtunnel_xmit(skb); @@ -563,11 +617,31 @@ #ifdef CONFIG_NET_SCHED to->tc_index = from->tc_index; #endif +#ifdef CONFIG_AVM_PA + memcpy(AVM_PKT_INFO(to), AVM_PKT_INFO(from), sizeof(*AVM_PKT_INFO(to))); +#endif nf_copy(to, from); skb_ext_copy(to, from); #if IS_ENABLED(CONFIG_IP_VS) to->ipvs_property = from->ipvs_property; #endif +#ifdef CONFIG_TI_DOCSIS_INPUT_DEV + to->ti_docsis_input_dev = from->ti_docsis_input_dev; + if (to->ti_docsis_input_dev) + { + DBRIDGE_IFINDEX_CHK(to->ti_docsis_input_dev->ifindex, "dev %p, devname %s, ti_docsis_input_dev %p, ti_docsis_input_dev->name %s", to->dev, to->dev ? to->dev->name : NULL, to->ti_docsis_input_dev, to->ti_docsis_input_dev->name); + } +#endif /* CONFIG_TI_DOCSIS_INPUT_DEV */ +#ifdef CONFIG_INTEL_DOCSIS_ICMP_IIF + to->docsis_icmp_iif = from->docsis_icmp_iif; +#endif /* CONFIG_INTEL_DOCSIS_ICMP_IIF */ +#ifdef CONFIG_TI_L2_SELECTIVE_FORWARDER + to->ti_selective_fwd_dev_info = from->ti_selective_fwd_dev_info; +#endif /* CONFIG_TI_L2_SELECTIVE_FORWARDER */ +#ifdef CONFIG_TI_PACKET_PROCESSOR + memcpy((void *)SKB_GET_PP_INFO_P(to), (void *)SKB_GET_PP_INFO_P(from), sizeof(*SKB_GET_PP_INFO_P(from))); +#endif + skb_copy_secmark(to, from); } @@ -910,6 +984,18 @@ * Put this fragment into the sending queue. */ skb2->tstamp = tstamp; +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* If this is not the last frag, clear the PTID Flag */ + if (state.left > 0 ) + { +#if PUMA7_OR_NEWER_SOC_TYPE + *(Uint32*)(SKB_GET_PP_INFO_P(skb2)->ti_epi_header) &= (~PAL_CPPI4_HOSTDESC_NETINFW0_PTID_FLAG_MASK); +#else + SKB_GET_PP_INFO_P(skb2)->ti_epi_header[4] = 0; +#endif + } +#endif /* CONFIG_TI_PACKET_PROCESSOR */ + err = output(net, sk, skb2); if (err) goto fail; @@ -964,7 +1050,11 @@ int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), void *from, int length, int transhdrlen, - unsigned int flags) + unsigned int flags +#ifdef CONFIG_TI_META_DATA +,unsigned int ti_meta_info +#endif +) { struct inet_sock *inet = inet_sk(sk); struct ubuf_info *uarg = NULL; @@ -1113,6 +1203,9 @@ if (!skb) goto error; +#ifdef CONFIG_TI_META_DATA + skb->ti_meta_info = ti_meta_info; +#endif /* CONFIG_TI_META_DATA */ /* * Fill in the control structures */ @@ -1325,7 +1418,11 @@ return __ip_append_data(sk, fl4, &sk->sk_write_queue, &inet->cork.base, sk_page_frag(sk), getfrag, - from, length, transhdrlen, flags); + from, length, transhdrlen, flags +#ifdef CONFIG_TI_META_DATA + ,ipc->ti_meta_info +#endif + ); } ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, @@ -1646,7 +1743,11 @@ err = __ip_append_data(sk, fl4, &queue, cork, ¤t->task_frag, getfrag, - from, length, transhdrlen, flags); + from, length, transhdrlen, flags +#ifdef CONFIG_TI_META_DATA + ,ipc->ti_meta_info +#endif + ); if (err) { __ip_flush_pending_frames(sk, &queue, cork); return ERR_PTR(err);