--- zzzz-none-000/linux-2.6.39.4/include/linux/skbuff.h 2011-08-03 19:43:28.000000000 +0000 +++ puma6-atom-6490-729/linux-2.6.39.4/include/linux/skbuff.h 2021-11-10 13:38:17.000000000 +0000 @@ -10,6 +10,13 @@ * 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: Oct.2011. + Changed/modified portions - Copyright © 2011, Intel Corporation + 1. TI Meta Data Extensions. + 2. TI Layer 2 Selective Forwarder + */ + #ifndef _LINUX_SKBUFF_H #define _LINUX_SKBUFF_H @@ -30,6 +37,13 @@ #include #include +#ifdef CONFIG_AVM_GENERIC_CONNTRACK +#include +#endif +#ifdef CONFIG_AVM_PA +#include +#endif + /* Don't change this without changing skb_csum_unnecessary! */ #define CHECKSUM_NONE 0 #define CHECKSUM_UNNECESSARY 1 @@ -189,6 +203,61 @@ SKBTX_DRV_NEEDS_SK_REF = 1 << 3, }; +#ifdef CONFIG_TI_PACKET_PROCESSOR + + #include + + #ifdef CONFIG_ARM_AVALANCHE_PPD + #include + #endif + + #include + + #ifdef CONFIG_ARM_AVALANCHE_PDSP_PP + #include + #endif + +/* Egress queue definitions... */ +#define TI_PPM_EGRESS_QUEUE_INVALID (-1) + +/* The structure contains information that needs to be stored on a per packet basis + * for the TI Packet Processor to operate. */ + typedef struct +{ + #ifdef CONFIG_ARM_AVALANCHE_PPD + TI_PP_SESSION ti_session; + #endif + + #ifdef CONFIG_ARM_AVALANCHE_PDSP_PP + AVALANCHE_PP_SESSION_INFO_t pp_session; + #endif + + unsigned int flags; + int input_device_index; + + /* The length of the EPI header is 8 bytes. */ + char ti_epi_header[ 8 ]; + int egress_queue; +#ifdef CONFIG_TI_PACKET_PROCESSOR_STATS + void* ti_match_llc_filter; + void* ti_match_inbound_ip_filter; + void* ti_match_outbound_ip_filter; + void* ti_match_qos_classifier; + void* ti_match_dsg_filter; +#endif + TI_PPP_PACKET_INFO ppp_packet_info; /* PP Path */ + +#if defined(CONFIG_ARM_AVALANCHE_PDSP_PP) && defined(CONFIG_AVM_PP_PRIO_SUPPORT) + void (*statsfunc)(void *arg, unsigned long packets, + unsigned long long bytes); + void *statsfunc_arg; +#endif + + }PP_PACKET_INFO_t; + +#endif /* CONFIG_TI_PACKET_PROCESSOR */ + + /* This data is invariant across clones and lives at * the end of the header data, ie. at skb->end. */ @@ -370,6 +439,17 @@ kmemcheck_bitfield_end(flags1); __be16 protocol; +#ifdef CONFIG_AVM_PA + union { + struct avm_pa_pkt_info pktinfo; + __u8 buf[256]; + } avm_pa; +#define AVM_PKT_INFO(skb) (&(skb)->avm_pa.pktinfo) +#endif +#ifdef CONFIG_AVM_GENERIC_CONNTRACK + struct generic_ct *generic_ct; +#endif + void (*destructor)(struct sk_buff *skb); #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) struct nf_conntrack *nfct; @@ -417,7 +497,40 @@ sk_buff_data_t transport_header; sk_buff_data_t network_header; sk_buff_data_t mac_header; - /* These elements must be at the end, see alloc_skb() for details. */ + +#ifdef CONFIG_TI_META_DATA + unsigned int ti_meta_info; + unsigned int ti_meta_info2; +#endif /* CONFIG_TI_META_DATA */ + +#ifdef CONFIG_INTEL_NF_GWMETA_SUPPORT + __u32 ti_gw_meta; +#endif /* INTEL_NF_GWMETA_SUPPORT */ + +#ifdef CONFIG_TI_DOCSIS_INPUT_DEV + struct net_device *ti_docsis_input_dev; +#endif /* CONFIG_TI_DOCSIS_INPUT_DEV */ + +#ifdef CONFIG_INTEL_DOCSIS_ICMP_IIF + int docsis_icmp_iif; +#endif /* CONFIG_INTEL_DOCSIS_ICMP_IIF */ + +#ifdef CONFIG_TI_L2_SELECTIVE_FORWARDER + unsigned long long ti_selective_fwd_dev_info; +#endif /* CONFIG_TI_L2_SELECTIVE_FORWARDER */ + +#ifdef CONFIG_TI_PACKET_PROCESSOR + PP_PACKET_INFO_t pp_packet_info; + __u16 vpid_vlan_tci; // Need to save the vpid vlan tci before it will erased - We will use it in the ingress_hook. +#endif /* CONFIG_TI_PACKET_PROCESSOR */ +#ifdef CONFIG_NET_DEBUG_SKBUFF_LEAK + void *last_user; +#endif + + void *destructor_info; /* AVM extension */ + unsigned long uniq_id; /* AVM extension */ + + /* These elements must be at the end, see alloc_skb() for details. */ sk_buff_data_t tail; sk_buff_data_t end; unsigned char *head, @@ -434,6 +547,23 @@ #include +#ifdef CONFIG_TI_PACKET_PROCESSOR +#ifdef CONFIG_ARM_AVALANCHE_PDSP_PP +#ifdef CONFIG_AVM_PP_PRIO_SUPPORT +static inline void +avalanche_pp_set_statsfunc(struct sk_buff *skb, + void (*statsfunc)(void *arg, + unsigned long packets, + unsigned long long bytes), + void *arg) +{ + skb->pp_packet_info.statsfunc = statsfunc; + skb->pp_packet_info.statsfunc_arg = arg; +} +#endif +#endif +#endif + /* * skb might have a dst pointer attached, refcounted or not. * _skb_refdst low order bit is set if refcount was _not_ taken @@ -487,6 +617,15 @@ return (struct rtable *)skb_dst(skb); } +#ifdef CONFIG_NET_DEBUG_SKBUFF_LEAK +static inline void skb_track_caller(struct sk_buff *skb) +{ + skb->last_user = __builtin_return_address(0); +} +#else +#define skb_track_caller(skb) do { } while (0) +#endif + extern void kfree_skb(struct sk_buff *skb); extern void consume_skb(struct sk_buff *skb); extern void __kfree_skb(struct sk_buff *skb); @@ -893,6 +1032,7 @@ struct sk_buff *prev, struct sk_buff *next, struct sk_buff_head *list) { + skb_track_caller(newsk); newsk->next = next; newsk->prev = prev; next->prev = prev->next = newsk; @@ -1047,6 +1187,7 @@ { struct sk_buff *next, *prev; + skb_track_caller(skb); list->qlen--; next = skb->next; prev = skb->prev; @@ -1252,6 +1393,7 @@ */ static inline void skb_reserve(struct sk_buff *skb, int len) { + skb_track_caller(skb); skb->data += len; skb->tail += len; } @@ -1490,6 +1632,7 @@ */ static inline void skb_orphan(struct sk_buff *skb) { + skb_track_caller(skb); if (skb->destructor) skb->destructor(skb); skb->destructor = NULL; @@ -1534,6 +1677,7 @@ } extern struct sk_buff *dev_alloc_skb(unsigned int length); +extern struct sk_buff *dev_alloc_skb_nowarn(unsigned int length); extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, unsigned int length, gfp_t gfp_mask); @@ -1576,7 +1720,7 @@ * * %NULL is returned if there is no free memory. */ -static inline struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask) +static inline struct page *__netdev_alloc_page(struct net_device *dev __attribute__((unused)), gfp_t gfp_mask) { return alloc_pages_node(NUMA_NO_NODE, gfp_mask, 0); } @@ -1594,7 +1738,7 @@ return __netdev_alloc_page(dev, GFP_ATOMIC); } -static inline void netdev_free_page(struct net_device *dev, struct page *page) +static inline void netdev_free_page(struct net_device *dev __attribute__((unused)), struct page *page) { __free_page(page); } @@ -1618,7 +1762,7 @@ { int delta = 0; - if (headroom < NET_SKB_PAD) + if (headroom < (unsigned int)NET_SKB_PAD) headroom = NET_SKB_PAD; if (headroom > skb_headroom(skb)) delta = headroom - skb_headroom(skb); @@ -1956,6 +2100,7 @@ static inline void __net_timestamp(struct sk_buff *skb) { skb->tstamp = ktime_get_real(); + skb_track_caller(skb); } static inline ktime_t net_timedelta(ktime_t t) @@ -1977,11 +2122,11 @@ #else /* CONFIG_NETWORK_PHY_TIMESTAMPING */ -static inline void skb_clone_tx_timestamp(struct sk_buff *skb) +static inline void skb_clone_tx_timestamp(struct sk_buff *skb __attribute__((unused))) { } -static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) +static inline bool skb_defer_rx_timestamp(struct sk_buff *skb __attribute__((unused))) { return false; } @@ -2064,6 +2209,18 @@ 0 : __skb_checksum_complete(skb); } +#ifdef CONFIG_AVM_GENERIC_CONNTRACK +static inline enum generic_ct_dir skb_get_ct_dir(struct sk_buff *skb) +{ + return skb->nfctinfo ? GENERIC_CT_DIR_REPLY : GENERIC_CT_DIR_ORIGINAL; +} + +static inline void skb_set_ct_dir(struct sk_buff *skb, enum generic_ct_dir dir) +{ + skb->nfctinfo = (dir & 1); +} +#endif + #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) extern void nf_conntrack_destroy(struct nf_conntrack *nfct); static inline void nf_conntrack_put(struct nf_conntrack *nfct) @@ -2101,8 +2258,12 @@ atomic_inc(&nf_bridge->use); } #endif /* CONFIG_BRIDGE_NETFILTER */ -static inline void nf_reset(struct sk_buff *skb) +static inline void nf_reset(struct sk_buff *skb __attribute__((unused))) { +#ifdef CONFIG_AVM_GENERIC_CONNTRACK + generic_ct_put(skb->generic_ct); + skb->generic_ct = 0; +#endif #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) nf_conntrack_put(skb->nfct); skb->nfct = NULL; @@ -2118,8 +2279,12 @@ } /* Note: This doesn't put any conntrack and bridge info in dst. */ -static inline void __nf_copy(struct sk_buff *dst, const struct sk_buff *src) +static inline void __nf_copy(struct sk_buff *dst __attribute__((unused)), const struct sk_buff *src __attribute__((unused))) { +#ifdef CONFIG_AVM_GENERIC_CONNTRACK + dst->generic_ct = generic_ct_get(src->generic_ct); + dst->nfctinfo = src->nfctinfo; +#endif #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) dst->nfct = src->nfct; nf_conntrack_get(src->nfct); @@ -2137,6 +2302,9 @@ static inline void nf_copy(struct sk_buff *dst, const struct sk_buff *src) { +#ifdef CONFIG_AVM_GENERIC_CONNTRACK + generic_ct_put(dst->generic_ct); +#endif #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) nf_conntrack_put(dst->nfct); #endif @@ -2160,10 +2328,10 @@ skb->secmark = 0; } #else -static inline void skb_copy_secmark(struct sk_buff *to, const struct sk_buff *from) +static inline void skb_copy_secmark(struct sk_buff *to __attribute__((unused)), const struct sk_buff *from __attribute__((unused))) { } -static inline void skb_init_secmark(struct sk_buff *skb) +static inline void skb_init_secmark(struct sk_buff *skb __attribute__((unused))) { } #endif @@ -2207,7 +2375,7 @@ return skb->sp; } #else -static inline struct sec_path *skb_sec_path(struct sk_buff *skb) +static inline struct sec_path *skb_sec_path(struct sk_buff *skb __attribute__((unused))) { return NULL; } @@ -2253,7 +2421,7 @@ * Instead of forcing ip_summed to CHECKSUM_NONE, we can * use this helper, to document places where we make this assertion. */ -static inline void skb_checksum_none_assert(struct sk_buff *skb) +static inline void skb_checksum_none_assert(struct sk_buff *skb __attribute__((unused))) { #ifdef DEBUG BUG_ON(skb->ip_summed != CHECKSUM_NONE); @@ -2261,5 +2429,15 @@ } bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off); + +#ifdef CONFIG_AVM_PA +static inline void avm_pa_add_local_session(PKT *pkt, struct sock *sk) +{ + struct avm_pa_pkt_info *info = AVM_PKT_INFO(pkt); + if (info->ptype_pid_handle && info->is_accelerated == 0) + _avm_pa_add_local_session(pkt, sk); +} +#endif + #endif /* __KERNEL__ */ #endif /* _LINUX_SKBUFF_H */