--- zzzz-none-000/linux-2.6.39.4/net/core/skbuff.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-atom-6490-729/linux-2.6.39.4/net/core/skbuff.c 2021-11-10 13:38:18.000000000 +0000 @@ -31,11 +31,20 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ +/* + * Includes Intel Corporation's changes/modifications dated: [11/07/2011]. +* Changed/modified portions - Copyright © [2011], Intel Corporation. +*/ /* * The functions in this file will not compile correctly with gcc 2.4.x */ - +/* + Includes Intel Corporation's changes/modifications dated: [Oct.2011]. + Changed/modified portions - Copyright © 2011, Intel Corporation + 1. TI Meta Data Extensions. + 2. TI Layer 2 Selective Forwarder +*/ #include #include #include @@ -67,9 +76,21 @@ #include #include #include +#include #include "kmap_skb.h" +#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 struct kmem_cache *skbuff_head_cache __read_mostly; static struct kmem_cache *skbuff_fclone_cache __read_mostly; @@ -146,6 +167,8 @@ BUG(); } +static unsigned int global_uniq_id = 1; + /* Allocate a new skbuff. We do this ourselves so we can fill in a few * 'private' fields and also do memory statistics to find all the * [BEEP] leaks. @@ -196,12 +219,14 @@ * the tail pointer in struct sk_buff! */ memset(skb, 0, offsetof(struct sk_buff, tail)); + skb_track_caller(skb); skb->truesize = size + sizeof(struct sk_buff); atomic_set(&skb->users, 1); skb->head = data; skb->data = data; skb_reset_tail_pointer(skb); skb->end = skb->tail + size; + skb->uniq_id = global_uniq_id++ & 0xffffff; // AVM extension #ifdef NET_SKBUFF_DATA_USES_OFFSET skb->mac_header = ~0U; #endif @@ -211,6 +236,51 @@ memset(shinfo, 0, offsetof(struct skb_shared_info, dataref)); atomic_set(&shinfo->dataref, 1); kmemcheck_annotate_variable(shinfo->destructor_arg); + +#ifdef CONFIG_TI_META_DATA + skb->ti_meta_info = 0; + skb->ti_meta_info2= 0; +#endif /* CONFIG_TI_META_DATA */ + +#ifdef CONFIG_INTEL_NF_GWMETA_SUPPORT + skb->ti_gw_meta= 0; +#endif /* INTEL_NF_GWMETA_SUPPORT */ + +#ifdef CONFIG_TI_DOCSIS_INPUT_DEV + skb->ti_docsis_input_dev = NULL; +#endif /* CONFIG_TI_DOCSIS_INPUT_DEV */ + +#ifdef CONFIG_INTEL_DOCSIS_ICMP_IIF + skb->docsis_icmp_iif = 0; +#endif /* CONFIG_INTEL_DOCSIS_ICMP_IIF */ + + +#ifdef CONFIG_TI_L2_SELECTIVE_FORWARDER + skb->ti_selective_fwd_dev_info = 0; +#endif /* CONFIG_TI_L2_SELECTIVE_FORWARDER */ + +#ifdef CONFIG_TI_PACKET_PROCESSOR + memset((void *)&skb->pp_packet_info, 0, sizeof(skb->pp_packet_info)); + skb->pp_packet_info.egress_queue = TI_PPM_EGRESS_QUEUE_INVALID; + skb->pp_packet_info.pp_session.ingress.vpid_handle = (Uint8)-1; + skb->pp_packet_info.pp_session.egress.vpid_handle = (Uint8)-1; +#ifndef CONFIG_MACH_PUMA5 + skb->pp_packet_info.pp_session.session_handle = AVALANCHE_PP_MAX_ACCELERATED_SESSIONS; /* Set invalid session */ +#endif +#ifdef PPP_DEBUG +#ifdef CONFIG_FTRACE + skb->pp_packet_info.ppp_packet_info.allocTime = sched_clock(); +#endif +#endif +#endif /* CONFIG_TI_PACKET_PROCESSOR */ + +#ifdef CONFIG_TI_PACKET_PROCESSOR_STATS + skb->pp_packet_info.ti_match_llc_filter = NULL; + skb->pp_packet_info.ti_match_inbound_ip_filter = NULL; + skb->pp_packet_info.ti_match_outbound_ip_filter = NULL; + skb->pp_packet_info.ti_match_qos_classifier = NULL; + skb->pp_packet_info.ti_match_dsg_filter = NULL; +#endif /* CONFIG_TI_PACKET_PROCESSOR_STATS */ if (fclone) { struct sk_buff *child = skb + 1; @@ -224,6 +294,7 @@ child->fclone = SKB_FCLONE_UNAVAILABLE; } out: + avm_simple_profiling_skb(0, skb); return skb; nodata: kmem_cache_free(cache, skb); @@ -291,6 +362,22 @@ } EXPORT_SYMBOL(dev_alloc_skb); + +/* AVM/RSP 20100413 + * This version of dev_alloc_skb does not die if there are no + * free pages in interrupt context + */ +struct sk_buff *dev_alloc_skb_nowarn(unsigned int length) +{ + /* + * There is more code here than it seems: + * __dev_alloc_skb is an inline + */ + return __dev_alloc_skb(length, GFP_ATOMIC | __GFP_NOWARN); +} +EXPORT_SYMBOL(dev_alloc_skb_nowarn); + + static void skb_drop_list(struct sk_buff **listp) { struct sk_buff *list = *listp; @@ -371,14 +458,18 @@ static void skb_release_head_state(struct sk_buff *skb) { - skb_dst_drop(skb); -#ifdef CONFIG_XFRM - secpath_put(skb->sp); -#endif if (skb->destructor) { WARN_ON(in_irq()); skb->destructor(skb); } + skb_dst_drop(skb); +#ifdef CONFIG_XFRM + secpath_put(skb->sp); +#endif +#if defined(CONFIG_AVM_GENERIC_CONNTRACK) + generic_ct_put(skb->generic_ct); +#endif + #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) nf_conntrack_put(skb->nfct); #endif @@ -400,6 +491,7 @@ /* Free everything but the sk_buff shell. */ static void skb_release_all(struct sk_buff *skb) { + avm_simple_profiling_skb(NULL, skb); skb_release_head_state(skb); skb_release_data(skb); } @@ -415,6 +507,7 @@ void __kfree_skb(struct sk_buff *skb) { + avm_simple_profiling_skb(0, skb); skb_release_all(skb); kfree_skbmem(skb); } @@ -517,6 +610,9 @@ new->sp = secpath_get(old->sp); #endif memcpy(new->cb, old->cb, sizeof(old->cb)); +#ifdef CONFIG_AVM_PA + memcpy(&new->avm_pa.pktinfo, &old->avm_pa.pktinfo, sizeof(old->avm_pa.pktinfo)); +#endif new->csum = old->csum; new->local_df = old->local_df; new->pkt_type = old->pkt_type; @@ -564,6 +660,8 @@ n->cloned = 1; n->nohdr = 0; n->destructor = NULL; + n->destructor_info = 0; // AVM extension + C(uniq_id); C(tail); C(end); C(head); @@ -574,6 +672,37 @@ atomic_inc(&(skb_shinfo(skb)->dataref)); skb->cloned = 1; +#ifdef CONFIG_TI_META_DATA + C(ti_meta_info); + C(ti_meta_info2); +#endif /* CONFIG_TI_META_DATA */ + +#ifdef CONFIG_TI_DOCSIS_INPUT_DEV + C(ti_docsis_input_dev); + if (n->ti_docsis_input_dev) + { + DBRIDGE_IFINDEX_CHK(n->ti_docsis_input_dev->ifindex, "dev %p, devname %s, ti_docsis_input_dev %p, ti_docsis_input_dev->name %s", n->dev, n->dev ? n->dev->name : NULL, n->ti_docsis_input_dev, n->ti_docsis_input_dev->name); + } +#endif /* CONFIG_TI_DOCSIS_INPUT_DEV */ + +#ifdef CONFIG_INTEL_DOCSIS_ICMP_IIF + C(docsis_icmp_iif); +#endif /* CONFIG_INTEL_DOCSIS_ICMP_IIF */ + +#ifdef CONFIG_TI_L2_SELECTIVE_FORWARDER + C(ti_selective_fwd_dev_info); +#endif /* CONFIG_TI_L2_SELECTIVE_FORWARDER */ + +#ifdef CONFIG_TI_PACKET_PROCESSOR + memcpy((void *)&n->pp_packet_info, (void *)&skb->pp_packet_info, sizeof(skb->pp_packet_info)); +#ifdef PPP_DEBUG + n->pp_packet_info.ppp_packet_info.num_clones++; +#ifdef CONFIG_FTRACE + if (n->fclone == SKB_FCLONE_UNAVAILABLE) + n->pp_packet_info.ppp_packet_info.allocTime = sched_clock(); +#endif +#endif +#endif /* CONFIG_TI_PACKET_PROCESSOR */ return n; #undef C } @@ -654,6 +783,39 @@ skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size; skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs; skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type; + + +#ifdef CONFIG_TI_META_DATA + new->ti_meta_info = old->ti_meta_info; + new->ti_meta_info2 = old->ti_meta_info2; +#endif /* CONFIG_TI_META_DATA */ + +#ifdef CONFIG_INTEL_NF_GWMETA_SUPPORT + new->ti_gw_meta = old->ti_gw_meta; +#endif /* INTEL_NF_GWMETA_SUPPORT */ + +#ifdef CONFIG_TI_DOCSIS_INPUT_DEV + new->ti_docsis_input_dev = old->ti_docsis_input_dev ; + if (new->ti_docsis_input_dev) + { + DBRIDGE_IFINDEX_CHK(new->ti_docsis_input_dev->ifindex, "dev %p, devname %s, ti_docsis_input_dev %p, ti_docsis_input_dev->name %s", new->dev, new->dev ? new->dev->name : NULL, new->ti_docsis_input_dev, new->ti_docsis_input_dev->name); + } +#endif /* CONFIG_TI_DOCSIS_INPUT_DEV */ + +#ifdef CONFIG_INTEL_DOCSIS_ICMP_IIF + new->docsis_icmp_iif = old->docsis_icmp_iif; +#endif /* CONFIG_INTEL_DOCSIS_ICMP_IIF */ + +#ifdef CONFIG_TI_L2_SELECTIVE_FORWARDER + new->ti_selective_fwd_dev_info = old->ti_selective_fwd_dev_info; +#endif /* CONFIG_TI_L2_SELECTIVE_FORWARDER */ + +#ifdef CONFIG_TI_PACKET_PROCESSOR + memcpy((void *)&new->pp_packet_info, (void *)&old->pp_packet_info, sizeof(old->pp_packet_info)); +#ifdef PPP_DEBUG + new->pp_packet_info.ppp_packet_info.num_copies++; +#endif +#endif /* CONFIG_TI_PACKET_PROCESSOR */ } /** @@ -940,6 +1102,7 @@ if (skb_mac_header_was_set(skb)) n->mac_header += off; #endif + n->uniq_id = skb->uniq_id; return n; } @@ -2780,6 +2943,9 @@ 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); +#if defined(CONFIG_AVM_GENERIC_CONNTRACK) + generic_ct_init(); +#endif } /**