1
0
This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
TP-Link_Archer-XR500v/EN7526G_3.18Kernel_SDK/linux-3.18.21/include/linux/ecnt_skbuff.h
2024-07-22 01:58:46 -03:00

289 lines
8.4 KiB
C
Executable File

#ifndef _LINUX_ECNT_SKBUFF_H
#define _LINUX_ECNT_SKBUFF_H
#include <linux/kernel.h>
#include <linux/kmemcheck.h>
#include <linux/compiler.h>
#include <linux/time.h>
#include <linux/bug.h>
#include <linux/cache.h>
#include <linux/atomic.h>
#include <asm/types.h>
#include <linux/spinlock.h>
#include <linux/net.h>
#include <linux/textsearch.h>
#include <net/checksum.h>
#include <linux/rcupdate.h>
#include <linux/hrtimer.h>
#include <linux/dma-mapping.h>
#include <linux/netdev_features.h>
#include <linux/sched.h>
#include <net/flow_keys.h>
#if defined(TCSUPPORT_RA_HWNAT)
#include <linux/foe_hook.h>
#endif
extern void skbmgr_4k_pool_init(void);
extern void skbmgr_pool_init(void);
extern atomic_t g_used_skb_num;
extern int g_max_skb_num;
extern int peak_skb_num;
#if defined(CONFIG_CPU_TC3162) || defined(CONFIG_MIPS_TC3262)
//only one skbmgr pool for every CPU. shnwind 20101215.
#define SKBMGR_SINGLE_QUEUE
#ifdef SKBMGR_SINGLE_QUEUE
#define SKBMGR_QUEUE_ID 0
#define SKBMGR_MAX_QUEUE 1
#else
#define SKBMGR_QUEUE_ID smp_processor_id()
#define SKBMGR_MAX_QUEUE NR_CPUS
#endif
extern atomic_t skbmgr_alloc_no;
extern atomic_t skbmgr_4k_alloc_no;
#define SKBMGR_INDICATION 1
#define SKBMGR_4K_INDICATION 2
#endif
#define MULTICAST_MASK 0xf0000
#define SKBUF_COPYTOLAN (1 << 26)
#if 1//def CONFIG_QOS
#define QOS_DEFAULT_MARK 0x00000008
#define QOS_FILTER_MARK 0x000000f0
#define QOS_HH_PRIORITY 0x00000010
#define QOS_NODROP_MARK 0x00000001
/* no queue marked packets to default queue */
#define QOS_PRIORITY_DEFAULT 0x00000080
#define QOS_DOT1P_MARK 0x00000f00
#define QOS_RULE_INDEX_MARK 0x0000f002
#define QOS_RTP_MARK 0x00000004
#define LANIF_MASK 0xf0000000
#if defined(TCSUPPORT_CT)
//#define WANIF_MASK 0x7f0000
#else
#endif
#define MULTICAST_MASK 0xf0000
#define SKBUF_COPYTOLAN (1 << 26)
#define SKBUF_TCCONSOLE (1 << 27)
/* the last bit is used as route policy mask */
#define ROUTE_POLICY_MASK (1 << 24)
//#define QOS_WANIF_MARK 0xff000
//#define QOS_DSCP_MARK 0x3f00000
#endif
#if (defined(TCSUPPORT_WAN_GPON) || defined (TCSUPPORT_WAN_EPON))
#define QOS_TSID_MARK 0x1f
#define QOS_TSE_MARK 0x20
#define DS_PKT_FORM_WAN 0x80
#define DS_PKT_MAPPING_MARK 0x30
#define DS_PKT_MAPPING_TO_ONE 0x10
#define DS_PKT_MAPPING_TO_MULTI 0x20
#define DS_QUEUE_ID_MARK 0x07
#define DS_TRTCM_ENABLE_MARK 0x40
#define DS_TRTCM_ID_MARK 0x1f
#define setDownQueueID(x,y) do{(x) &= (~DS_QUEUE_ID_MARK); (x) |= ((y)&DS_QUEUE_ID_MARK);}while(0)
#define getDownQueueID(x) ((x) & DS_QUEUE_ID_MARK)
#endif
#define PON_PKT_FROM_CPE (1<<0)
#define PON_PKT_FROM_LAN (1<<1)
#define PON_PKT_FROM_WLAN (1<<2)
#define PON_PKT_FROM_WAN (1<<3)
#define PON_PKT_FROM_USB (1<<4)
#define PON_PKT_FROM_IGMP (1<<5)
#define PON_PKT_INSERT_FLAG (1<<6)
#define PON_PKT_ROUTING_FLAG (1<<7)
#define PON_PKT_SEND_TO_WAN (1<<8)
#define PON_VLAN_RX_CALL_HOOK (1<<9)
#define PON_VLAN_TX_CALL_HOOK (1<<10)
#define PON_USER_GROUP_FLAG (1<<11)
#if defined(TCSUPPORT_PON_VLAN) || (defined(TCSUPPORT_PON_IP_HOST) && (defined(TCSUPPORT_GPON_MAPPING) || defined(TCSUPPORT_EPON_MAPPING)))
#define PON_PKT_VOIP_RX (1<<12)
#define PON_PKT_VOIP_TX (1<<13)
#define PON_MULTICAST_ANI_FILTER_FLAG (1<<14)
#define PON_LEAVE_PKT_DEAL (1<<15)
#endif
#if defined(TCSUPPORT_PON_MAC_FILTER)
#define PKT_FROM_LAN (1<<0)
#define PKT_FROM_WAN (1<<1)
#define PKT_SEND_TO_WAN (1<<2)
#define PKT_FILTER_FLAG (1<<3)
#define PON_MAC_FILTER_RX_CALL_HOOK (1<<4)
#define PON_MAC_FILTER_TX_CALL_HOOK (1<<5)
#define PKT_SEND_TO_LAN (1<<6)
#endif
#if defined(TCSUPPORT_VLAN_TAG) || defined(TCSUPPORT_CT_VLAN_TAG)
#define VLAN_PACKET (1<<0)
#define VLAN_2TAGS_PACKET (1<<1)
#define ROUTING_MODE_PACKET (1<<2)
#define VLAN_TAG_FROM_INDEV (1<<3)
#define VLAN_TAG_INSERT_FLAG (1<<4)
#define VLAN_TAG_CHECK_FLAG (1<<5)
#define VLAN_TAG_FROM_WAN (1<<6)
#if defined(TCSUPPORT_CT_VLAN_BIND) || defined(TCSUPPORT_LAN_VLAN)
#define VLAN_TAG_FOR_DNS (1<<7)
#ifdef TCSUPPORT_LAN_VLAN
#define VLAN_TAG_FOR_DHCP (1<<8)
#endif
#endif
#ifdef TR143
#define VLAN_TAG_PBIT_RESERVE0 (1<<8)
#define VLAN_TAG_PBIT_RESERVE1 (1<<9)
#define VLAN_TAG_PBIT_RESERVE2 (1<<10)
#define VLAN_TAG_PBIT_RESERVE3 (1<<11)
#endif
#if defined(TCSUPPORT_CT_PORTSLIMIT)
#define VLAN_TAG_IGMP_QUERYFLAG (1<<12)
#endif
#if defined(TCSUPPORT_CT_DS_LIMIT)
#define DATASPEED_LIMIT_ENABLE (1<<13)
#endif
#ifdef TCSUPPORT_LAN_VLAN
#define VLAN_TAG_FOR_BOARDCAST (1<<12)
#endif
#endif
#define XPON_IGMP_IS_MULTICAST (1<<0)
#define XPON_IGMP_UPSTREAM_RESTORE (1<<1)
#define XPON_IGMP_UPSTREAM_RECOVERY (1<<2)
#define XPON_IGMP_DOWNSTREAM_VLAN_HANDLE (1<<3)
#if defined(TCSUPPORT_CT)
#ifdef TCSUPPORT_PORTBIND//CONFIG_PORT_BINDING
#define MASK_ORIGIN_DEV 0x1 /* flag for port bind set origin dev name */
#define MASK_OUT_DEV 0x2 /* flag for port bind set origin dev name */
#define IFNAMSIZ 16
#endif
#else
#ifdef CONFIG_PORT_BINDING
#define MASK_ORIGIN_DEV 0x1 /* flag for port bind set origin dev name */
#define MASK_OUT_DEV 0x2 /* flag for port bind set origin dev name */
#define IFNAMSIZ 16
#endif
#endif
/*simulation unmatch flag in skb->mark,downstream only*/
#define DOWNSTREAM_SIMULATION_MASK (1<<31)
//#ifdef CONFIG_SMUX /*include/linux/if.h*/
/* smux calls */
#define SIOCSIFSMUX 0x89c0 /* add or rem smux interface */
//#endif
#ifdef TCSUPPORT_XPON_HAL_API_EXT
#define PKTQOS_QUEUE_LENGTH (256)
#else
#define PKTQOS_QUEUE_LENGTH (64) //(128) /* 16*8 */
#endif
#if defined(TCSUPPORT_FWC_ENV)
/*
*define skb->mark for FHWC
*
*|31...29|28...17| 16 | 15 | 14 |
* | | | | |
* | | | | |----> L2, L3 data flow flag, 0:L3, 1:L2
* | | | |---------> Pbit remark flag, set if pbit is remarked
* | | |--------------> Queue remark flag, if set, see bits 13-11
* | |---------------------> reserve
* |-----------------------------> FH reserve for Bind
*
*|13 12 11|10...5|4...1| 0 |
* | | | |
* | | | |---------> XPON reserve
* | | |--------------> From port,0~3:Lan, 4-7:wifi, 8:USB, 15:PON
* | |-------------------->
* |----------------------------> Queue number
*
*/
#define FHWC_L2_L3_MARK_POS (14)
#define FHWC_MARK_ROUTE_PKT(skb) (skb->mark &= ~(1<<FHWC_L2_L3_MARK_POS))
#define FHWC_MARK_BRIDGE_PKT(skb) (skb->mark |= 1<<FHWC_L2_L3_MARK_POS)
#define FHWC_IS_MARKED_ROUTE_PKT(skb) (!FHWC_IS_MARKED_BRIDGE_PKT(skb))
#define FHWC_IS_MARKED_BRIDGE_PKT(skb) ((skb->mark >> FHWC_L2_L3_MARK_POS) & 0x01)
#endif
#if defined(TCSUPPORT_WAN_GPON)
#define IS_PKT_FROM_DS_UNICAST_GEM(skb) \
({ \
typecheck(struct sk_buff *, skb); \
((skb->pon_mark & DS_PKT_FORM_WAN) && (0 == skb->gem_type) ); \
})
#define IS_PKT_FROM_DS_MULTICAST_GEM(skb) \
({ \
typecheck(struct sk_buff *, skb); \
((skb->pon_mark & DS_PKT_FORM_WAN) && (1 == skb->gem_type) ); \
})
#endif
struct ecnt_sk_buff {
};
typedef struct ecnt_sk_buff ecnt_sk_buff_t;
#ifdef TCSUPPORT_XPON_HAL_API_MCST
typedef struct
{
struct list_head list;
int proto; //ipv6 or ipv4
int index; //get from skb buff
int vlan_tag_num;
int outer_vlan;
int inner_vlan;
short int hwnat_vid;
short int wifinum; //wifi ra counts
//short int lannum; //lan counts
// bit0-->bit3 for eth0.1-->eth0.4 bit8-->bit11 for ra0-->ra3 bit12~bit15 for rai1~rai4
unsigned long mask; //port mask
unsigned char grp_addr[16];
unsigned char src_addr[16];
struct timer_list age_timer;
}IGMP_HWNATEntry_t;
#else
/*move from br_private.h*/
/*this struct is also for hw nat using, not add compile option*/
typedef struct IGMP_HWNATEntry_s
{
struct list_head list;
#ifdef TCSUPPORT_MULTICAST_SPEED
struct rcu_head rcu;
#endif
int proto;
int index;
// bit0-->bit3 for eth0.1-->eth0.4 bit8-->bit11 for ra0-->ra3 bit12~bit15 for rai1~rai4
unsigned long mask;
unsigned char wifinum;
unsigned char grp_addr[16];
unsigned char src_addr[16];
struct timer_list age_timer;
}IGMP_HWNATEntry_t;
#endif
typedef struct
{
struct list_head list;
int index;
unsigned long port_mask;
}multicast_flood_hwentry_t;
#endif