--- zzzz-none-000/linux-4.9.279/net/ipv4/ip_output.c 2021-08-08 06:38:54.000000000 +0000 +++ puma7-arm-6591-750/linux-4.9.279/net/ipv4/ip_output.c 2023-02-08 10:58:16.000000000 +0000 @@ -41,6 +41,10 @@ * datagrams. * Hirokazu Takahashi: sendfile() on UDP works now. */ +/* + * Includes Intel Corporation's changes/modifications dated: 2011, 2014, 2018. + * Changed/modified portions - Copyright (c) 2011-2018, Intel Corporation. + */ #include #include @@ -81,6 +85,25 @@ #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, @@ -100,6 +123,16 @@ iph->tot_len = htons(skb->len); ip_send_check(iph); +#ifdef CONFIG_TI_ICMP_ECHO_REPLY_NETFILTER_BYPASS + if(iph->protocol == IPPROTO_ICMP) { + struct icmphdr *icmph = (struct icmphdr *)((unsigned char *)(iph)+iph->ihl*4); + + /* hack to short circuit the Netfilter logic for ICMP echo reply */ + if(icmph->type == ICMP_ECHOREPLY) { + return 1; + } + } +#endif /* CONFIG_TI_ICMP_ECHO_REPLY_NETFILTER_BYPASS */ /* if egress device is enslaved to an L3 master device pass the * skb to its handler for processing @@ -188,6 +221,11 @@ unsigned int hh_len = LL_RESERVED_SPACE(dev); struct neighbour *neigh; u32 nexthop; +#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); @@ -215,6 +253,17 @@ if (res < 0 || res == LWTUNNEL_XMIT_DONE) return res; } +#ifdef CONFIG_TI_PACKET_PROCESSOR +#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) + + ct = (struct nf_conn *)skb->nfct; + + if (ct != NULL) + { + ti_hil_pp_event( TI_CT_NETFILTER_CANCEL_DISCARD_ACCELERATION, skb->nfct ); + } +#endif +#endif rcu_read_lock_bh(); nexthop = (__force u32) rt_nexthop(rt, ip_hdr(skb)->daddr); @@ -511,6 +560,26 @@ #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 /* CONFIG_TI_PACKET_PROCESSOR */ + skb_copy_secmark(to, from); } @@ -785,6 +854,18 @@ ip_send_check(iph); +#ifdef CONFIG_TI_PACKET_PROCESSOR + /* If this is not the last frag, clear the PTID Flag */ + if (left > 0 ) + { +#ifdef 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; @@ -891,7 +972,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 sk_buff *skb; @@ -1038,6 +1123,11 @@ skb_shinfo(skb)->tskey = tskey; tskey = 0; +#ifdef CONFIG_TI_META_DATA + /* Fill in the meta information from the cookie. */ + skb->ti_meta_info = ti_meta_info; +#endif /* CONFIG_TI_META_DATA */ + /* * Find where to start putting bytes. */ @@ -1214,7 +1304,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, @@ -1539,7 +1633,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);