--- zzzz-none-000/linux-5.15.111/include/linux/skbuff.h 2023-05-11 14:00:40.000000000 +0000 +++ puma7-arm-6670-761/linux-5.15.111/include/linux/skbuff.h 2024-02-07 09:28:07.000000000 +0000 @@ -6,6 +6,12 @@ * Alan Cox, * Florian La Roche, */ + /* + Includes Intel Corporation's changes/modifications dated: Oct.2011, 2020. + Changed/modified portions - Copyright © 2011-2020, Intel Corporation + 1. TI Meta Data Extensions. + 2. TI Layer 2 Selective Forwarder + */ #ifndef _LINUX_SKBUFF_H #define _LINUX_SKBUFF_H @@ -265,6 +271,7 @@ /* always valid & non-NULL from FORWARD on, for physdev match */ struct net_device *physoutdev; + struct net_bridge_port *forward_port; union { /* prerouting: detect dnat in orig/reply direction */ __be32 ipv4_daddr; @@ -497,6 +504,81 @@ #define SKBFL_ZEROCOPY_FRAG (SKBFL_ZEROCOPY_ENABLE | SKBFL_SHARED_FRAG) +#ifdef CONFIG_TI_PACKET_PROCESSOR + + #include + + #ifdef CONFIG_ARM_AVALANCHE_PPD + #include + #endif + + #ifdef CONFIG_TI_PACKET_PROCESSOR_STATS + #include + #endif + + #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 + struct PpsgcAssignedGroupCounters assignedGroupCounters; + #endif + + }PP_PACKET_INFO_t; + +#ifdef CONFIG_INTEL_KERNEL_SKB_COOKIE + typedef union + { + unsigned int raw[ 0 ]; + struct + { + PP_PACKET_INFO_t pp_packet_info; + void *nfct; + /* Add the additinal info below ... */ + +#define AVM_PKT_INFO_MAX 256 + /* Reserve space for avm_pa_pkt_info. The data needs to be maintained + * when packets arrive from the ATOM and go back to it (i.e. packets + * destined to the CPE). It is not necessary for packets that are destined + * to the ARM anyway. + * + * !! If you change the buffer size, the ATOM must be updated too !! + * + * Reserve unconditionally, so that ARM doesn't need to be recompiled + * if avm_pa is disabled + */ + __u8 avm_pa[AVM_PKT_INFO_MAX]; + }s; + } + SKB_INTEL_COOKIE; +#else + #define SKB_INTEL_COOKIE PP_PACKET_INFO_t +#endif + +#endif /* CONFIG_TI_PACKET_PROCESSOR */ + /* * The callback notifies userspace to release buffers when skb DMA is done in * lower device, the skb last reference should be 0 when calling this. @@ -564,6 +646,11 @@ unsigned int gso_type; u32 tskey; +#if defined(CONFIG_PPA_PUMA7) && !defined(CONFIG_ARM_AVALANCHE_SOC) + __u8 pid: 6, + dir: 1, + pool_skb: 1; +#endif /* * Warning : all fields before dataref are cleared in __alloc_skb() */ @@ -809,6 +896,11 @@ #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) unsigned long _nfct; #endif +#if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) +#ifdef CONFIG_BRIDGE_EBT_FORWARD + struct net_bridge_port *bridge_forward_port; +#endif +#endif unsigned int len, data_len; __u16 mac_len, @@ -939,7 +1031,6 @@ #ifdef CONFIG_NETWORK_SECMARK __u32 secmark; #endif - union { __u32 mark; __u32 reserved_tailroom; @@ -967,6 +1058,62 @@ __u32 headers_end[0]; /* public: */ +#ifdef CONFIG_TI_META_DATA + unsigned int ti_meta_info; + unsigned int ti_meta_info2; + unsigned int ti_ds_traffic_prio; +#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 + + #if PUMA7_OR_NEWER_SOC_TYPE + #ifdef CONFIG_INTEL_KERNEL_SKB_COOKIE + + SKB_INTEL_COOKIE * intel_cookie; + #define SKB_GET_PP_INFO_P(skb) (&(skb)->intel_cookie->s.pp_packet_info) + #ifdef CONFIG_NF_CONNTRACK + #define SKB_GET_COOKIE_NFCT_P(skb) ((skb)->intel_cookie->s.nfct) + #endif + #define SKB_GET_COOKIE_P(skb) ((skb)->intel_cookie) + + #else + + PP_PACKET_INFO_t * pp_packet_info; + #define SKB_GET_PP_INFO_P(skb) ((skb)->pp_packet_info) + #define SKB_GET_COOKIE_P(skb) ((skb)->pp_packet_info) + + #endif + + #else + PP_PACKET_INFO_t pp_packet_info; + #define SKB_GET_PP_INFO_P(skb) (&(skb)->pp_packet_info) + #endif + /* Need this field to save the vpid vlan_tci before it will erased + * We will use it in the ingress hook to reproduce + * the vlan_tci of the real internal vpid's Vlan. */ + __u16 vpid_vlan_tci; + + __u16 parent_vpid_vlan_tci; +#endif /* CONFIG_TI_PACKET_PROCESSOR */ +/* ======================================================================== */ + /* These elements must be at the end, see alloc_skb() for details. */ sk_buff_data_t tail; sk_buff_data_t end; @@ -1145,6 +1292,11 @@ bool skb_try_coalesce(struct sk_buff *to, struct sk_buff *from, bool *fragstolen, int *delta_truesize); +#if PUMA7_OR_NEWER_SOC_TYPE && defined (CONFIG_TI_PACKET_PROCESSOR) +extern void* __alloc_skb_intel_cookie(void); +extern void kfree_skb_intel_cookie(struct sk_buff *skb); +#endif + struct sk_buff *__alloc_skb(unsigned int size, gfp_t priority, int flags, int node); struct sk_buff *__build_skb(void *data, unsigned int frag_size); @@ -4837,5 +4989,15 @@ return page_pool_return_skb_page(virt_to_page(data)); } +#if defined(CONFIG_PPA_PUMA7) && !defined(CONFIG_ARM_AVALANCHE_SOC) +struct skb_buf_manager_cb { + bool (*is_bm_skb)(struct sk_buff *skb); + int (*bm_free_skb)(struct sk_buff *skb); +}; + +int skb_register_buf_manager(struct skb_buf_manager_cb *cb); +int skb_unregister_buf_manager(void); +#endif + #endif /* __KERNEL__ */ #endif /* _LINUX_SKBUFF_H */