summaryrefslogtreecommitdiffstats
path: root/target/linux/realtek/files/include/net/rtl/features
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2012-09-13 00:40:35 +0300
committerRoman Yeryomin <roman@advem.lv>2012-12-03 00:13:21 +0200
commit5deb3317cb51ac52de922bb55f8492624018906d (patch)
treec2fbe6346699d9bb0f2100490c3029519bb8fde8 /target/linux/realtek/files/include/net/rtl/features
parent0239d37124f9184b478a42de8a7fa1bc85a6a6fe (diff)
Add realtek target files
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Diffstat (limited to 'target/linux/realtek/files/include/net/rtl/features')
-rw-r--r--target/linux/realtek/files/include/net/rtl/features/rtl_features.h187
-rw-r--r--target/linux/realtek/files/include/net/rtl/features/rtl_ps_hooks.h144
2 files changed, 331 insertions, 0 deletions
diff --git a/target/linux/realtek/files/include/net/rtl/features/rtl_features.h b/target/linux/realtek/files/include/net/rtl/features/rtl_features.h
new file mode 100644
index 000000000..45b2c7466
--- /dev/null
+++ b/target/linux/realtek/files/include/net/rtl/features/rtl_features.h
@@ -0,0 +1,187 @@
+#ifndef RTL_FEATURES_H
+#define RTL_FEATURES_H 1
+
+extern int rtl_nf_conntrack_threshold;
+
+#if defined(CONFIG_RTL_IPTABLES_FAST_PATH) || defined(CONFIG_RTL_HARDWARE_NAT) || defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW)
+#define IS_CLASSD_ADDR(__ipv4addr__) ((((uint32)(__ipv4addr__)) & 0xf0000000) == 0xe0000000)
+#define IS_ALLZERO_ADDR(__ipv4addr__) ((((uint32)(__ipv4addr__)) & 0xffffffff) == 0)
+#define IS_BROADCAST_ADDR(__ipv4addr__) ((((uint32)(__ipv4addr__)) & 0xffffffff) == 0xffffffff)
+#endif
+
+#if defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW)
+struct tcp_state_hash_head
+{
+ enum tcp_conntrack state;
+
+ struct list_head* state_hash;
+};
+struct udp_state_hash_head
+{
+ uint8_t state;
+ struct list_head* state_hash;
+};
+
+#define UDP_UNREPLY (TCP_CONNTRACK_MAX+1)
+#define UDP_ASSURED (TCP_CONNTRACK_MAX+2)
+
+struct DROP_PRORITY{
+ u_int8_t state;
+ u_int16_t threshold;
+};
+
+extern struct tcp_state_hash_head Tcp_State_Hash_Head[];
+extern struct udp_state_hash_head Udp_State_Hash_Head[];
+extern struct DROP_PRORITY drop_priority[];
+
+enum {
+ PROT_ICMP,
+ PROT_TCP,
+ PROT_UDP,
+ PROT_MAX
+};
+#endif
+
+#if defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW)
+#if defined(CONFIG_PROC_FS)
+extern unsigned long rtl_gc_overflow_timout;
+void gc_overflow_timout_proc_init(void);
+#endif
+void clean_from_lists(struct nf_conn *ct, struct net *net);
+void rtl_death_action(struct nf_conn *ct);
+int drop_one_conntrack(const struct nf_conntrack_tuple *orig,const struct nf_conntrack_tuple *repl);
+int32 rtl_nf_conn_GC_init(void);
+int32 rtl_connGC_addList(struct sk_buff *skb, struct nf_conn *ct);
+#endif
+
+#if defined(CONFIG_RTL_IPTABLES_FAST_PATH)
+int rtl_fpTimer_update(struct nf_conn *ct);
+#endif
+
+void rtl_fpAddConnCache(struct nf_conn *ct, struct sk_buff *skb);
+
+#if defined(CONFIG_RTL_LOCAL_PUBLIC) || defined(CONFIG_RTL_MULTIPLE_WAN) || (defined(CONFIG_NET_SCHED)&&defined(CONFIG_RTL_IPTABLES_FAST_PATH)) || defined(CONFIG_RTL_HW_QOS_SUPPORT)
+extern struct net_device *rtl865x_getWanDev(void );
+extern struct net_device *rtl865x_getLanDev(void );
+#endif
+
+#if defined (CONFIG_RTL_LOCAL_PUBLIC) || defined(CONFIG_RTL_HW_QOS_SUPPORT)
+extern int rtl865x_attainDevType(unsigned char *devName, unsigned int *isLanDev, unsigned int *isWanDev);
+#endif
+
+#if defined(CONFIG_RTL_IPTABLES_FAST_PATH) || defined(CONFIG_RTL_HARDWARE_NAT)
+/*2007-12-19*/
+extern int tcp_get_timeouts_by_state(u_int8_t state);
+extern unsigned int nf_ct_udp_timeout;
+extern unsigned int nf_ct_udp_timeout_stream;
+void rtl_check_for_acc(struct nf_conn *ct, unsigned long expires);
+void rtl_delConnCache(struct nf_conn *ct);
+int32 rtl_connCache_timer_update(struct nf_conn *ct);
+#endif
+
+#if defined(CONFIG_RTL_HARDWARE_NAT)
+int rtl865x_handle_nat(struct nf_conn *ct, int act, struct sk_buff *skb);
+int rtl_hwnat_timer_update(struct nf_conn *ct);
+#endif
+
+#if defined(IMPROVE_QOS) && (defined(CONFIG_RTL_IPTABLES_FAST_PATH) || defined(CONFIG_RTL_HARDWARE_NAT))
+void rtl_addConnCache(struct nf_conn *ct, struct sk_buff *skb);
+#endif
+
+#if defined(CONFIG_RTL_819X)
+int32 rtl_nat_init(void);
+#endif
+
+#if defined(CONFIG_NET_SCHED)
+extern int gQosEnabled;
+int32 rtl_qos_init(void);
+int32 rtl_qos_cleanup(void);
+#endif
+
+#if defined(CONFIG_RTL_FAST_BRIDGE)
+int32 rtl_fb_add_br_entry(skb)
+#endif
+
+//#define CONFIG_HARDWARE_NAT_DEBUG
+
+#if defined(CONFIG_RTL_HARDWARE_NAT)
+#define RTL_MULTIPLE_WAN_NUM 2
+
+typedef struct _rtl_masq_if_struct
+{
+ unsigned int valid;
+ unsigned int ipAddr;
+ //struct ipt_entry *masq_entry;
+ char ifName[IFNAMSIZ];
+}rtl_masq_if;
+
+rtl_masq_if *rtl_get_masq_info_by_devName(const char* name);
+#endif
+
+#if defined(CONFIG_RTL_HARDWARE_NAT )
+/*2007-12-19*/
+int32 syn_asic_arp(struct neighbour *n, int add);
+
+#if defined(CONFIG_RTL_MULTIPLE_WAN)
+int32 rtl_get_ps_arp_mapping(u32 ip,void *arp_entry);
+#endif
+#endif
+
+#if defined(FAST_PATH_SPI_ENABLED)
+extern struct nf_conntrack_l4proto **nf_ct_protos[PF_MAX];
+extern unsigned int
+ rtl_nf_conntrack_in(struct net *net, unsigned int dataoff, unsigned int hooknum, struct sk_buff *skb);
+#endif
+
+#if defined(CONFIG_RTL_HARDWARE_NAT)
+int rtl_flush_extern_ip(void);
+int rtl_init_masq_info(void);
+int rtl_check_for_extern_ip(const char *name,
+ unsigned int valid_hooks, struct xt_table_info *newinfo,
+ void *entry0, unsigned int size,
+ unsigned int number, const unsigned int *hook_entries,
+ const unsigned int *underflows);
+#endif
+
+#if defined(CONFIG_RTL_HARDWARE_NAT)
+int rtl865x_handle_nat(struct nf_conn *ct, int act, struct sk_buff *skb);
+int32 rtl_update_ip_tables(char *name, unsigned long event, struct in_ifaddr *ina);
+int32 rtl_fn_insert(struct fib_table *tb, struct fib_config *cfg, struct fib_info *fi);
+int32 rtl_fn_delete(struct fib_table *tb, struct fib_config *cfg);
+int32 rtl_fn_flush(int fz_order, int idx, u32 tb_id, u32 fn_key);
+int32 rtl_ip_vs_conn_expire_check(struct ip_vs_conn *cp);
+int32 rtl_ip_vs_conn_expire_check_delete(struct ip_vs_conn *cp);
+int32 rtl_tcp_state_transition_check(struct ip_vs_conn *cp, int direction, const struct sk_buff *skb, struct ip_vs_protocol *pp);
+int32 rtl_udp_state_transition_check(struct ip_vs_conn *cp, int direction, const struct sk_buff *skb, struct ip_vs_protocol *pp);
+#endif
+
+#if defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW)
+extern int rtl_newGC_session_status_flags;
+extern unsigned long rtl_newGC_session_status_time;
+
+#if (HZ==100)
+#define RTL_FP_SESSION_LEVEL3_INTERVAL (1)
+#define RTL_FP_SESSION_LEVEL1_INTERVAL (200) /* 2 second */
+#elif (HZ==1000)
+#define RTL_FP_SESSION_LEVEL3_INTERVAL (10)
+#define RTL_FP_SESSION_LEVEL1_INTERVAL (2000) /* 2 second */
+#else
+#error "Please adjust the parameter according to the HZ"
+#endif
+
+#if defined(CONFIG_RTL_8198)
+#define RTL_FP_SESSION_LEVEL3_ALLOW_COUNT (40)
+#else
+#define RTL_FP_SESSION_LEVEL3_ALLOW_COUNT (16)
+#endif
+#define RTL_FP_SESSION_LEVEL1_RX_WEIGHT (8)
+
+#define RTL_FP_SESSION_LEVEL_IDLE 0
+#define RTL_FP_SESSION_LEVEL1 1
+#define RTL_FP_SESSION_LEVEL2 2
+#define RTL_FP_SESSION_LEVEL3 3
+//void rtl_fp_mark_invalid(struct nf_conn *ct);
+//enum LR_RESULT rtk_refreshOSConnectionTimer(void);
+#endif
+
+#endif /* RTL_FEATURES_H */
diff --git a/target/linux/realtek/files/include/net/rtl/features/rtl_ps_hooks.h b/target/linux/realtek/files/include/net/rtl/features/rtl_ps_hooks.h
new file mode 100644
index 000000000..6af1b865d
--- /dev/null
+++ b/target/linux/realtek/files/include/net/rtl/features/rtl_ps_hooks.h
@@ -0,0 +1,144 @@
+#ifndef RTL_PS_HOOKS_H
+#define RTL_PS_HOOKS_H 1
+
+#include <linux/netfilter_ipv4.h>
+#include <linux/netfilter/nf_conntrack_common.h>
+#include <linux/netfilter/nf_conntrack_tcp.h>
+
+#include <net/rtl/rtl_types.h>
+#include <net/ip_fib.h>
+#include <net/ip_vs.h>
+
+#include <net/netfilter/nf_conntrack.h>
+#include <net/netfilter/nf_conntrack_core.h>
+#include <net/netfilter/nf_conntrack_helper.h>
+
+#include <net/rtl/features/rtl_features.h>
+#if defined(CONFIG_RTL_FASTBRIDGE)
+#include <net/rtl/features/fast_bridge.h>
+#endif
+
+#define RTL_PS_HOOKS_CONTINUE 0 /* keep the process flow */
+#define RTL_PS_HOOKS_BREAK 1 /* should break from caller's loops */
+#define RTL_PS_HOOKS_RETURN 2 /* should immediately return from the caller function */
+#define RTL_PS_HOOKS_DROP 3
+
+typedef struct {
+ struct net *net;
+ struct nf_conn *ct;
+ struct sk_buff *skb;
+ struct nf_conntrack_l3proto *l3proto;
+ struct nf_conntrack_l4proto *l4proto;
+ u_int8_t protonum;
+ u_int8_t pf;
+ unsigned int hooknum;
+ enum ip_conntrack_info ctinfo;
+ enum tcp_conntrack new_state;
+ enum tcp_conntrack old_state;
+} rtl_nf_conntrack_inso_s;
+
+int32 rtl_nf_conntrack_in_hooks(rtl_nf_conntrack_inso_s *info);
+int32 rtl_nf_conntrack_death_by_timeout_hooks(rtl_nf_conntrack_inso_s *info);
+int32 rtl_nf_conntrack_destroy_hooks(rtl_nf_conntrack_inso_s *info);
+int32 rtl_nf_conntrack_confirm_hooks(rtl_nf_conntrack_inso_s *info);
+int32 rtl_nf_init_conntrack_hooks(rtl_nf_conntrack_inso_s *info);
+int32 rtl_nf_conntrack_init_hooks(void);
+int32 rtl_tcp_packet_hooks(rtl_nf_conntrack_inso_s *info);
+int32 rtl_nf_nat_packet_hooks(rtl_nf_conntrack_inso_s *info);
+int32 rtl_nat_init_hooks(void);
+int32 rtl_nat_cleanup_hooks(void);
+
+int32 rtl_fn_hash_insert_hooks(struct fib_table *tb, struct fib_config *cfg, struct fib_info *fi);
+int32 rtl_fn_hash_delete_hooks(struct fib_table *tb, struct fib_config *cfg);
+int32 rtl_fn_flush_list_hooks(int fz_order, int idx, u32 tb_id, u32 fn_key);
+int32 rtl_fn_hash_replace_hooks(struct fib_table *tb, struct fib_config *cfg, struct fib_info *fi);
+
+int32 rtl_dev_queue_xmit_hooks(struct sk_buff *skb, struct net_device *dev);
+int32 rtl_dev_hard_start_xmit_hooks(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq);
+int32 rtl_netif_receive_skb_hooks(struct sk_buff **pskb);
+
+int32 rtl_br_dev_queue_push_xmit_before_xmit_hooks(struct sk_buff *skb);
+
+#ifdef CONFIG_NET_SCHED
+extern int gQosEnabled;
+#endif
+int32 rtl_neigh_forced_gc_hooks(struct neigh_table *tbl, struct neighbour *n);
+int32 rtl_neigh_flush_dev_hooks(struct neigh_table *tbl, struct net_device *dev, struct neighbour *n);
+int32 rtl_neigh_destroy_hooks(struct neighbour *n);
+int32 rtl_neigh_connect_hooks(struct neighbour *neigh);
+int32 rtl_neigh_timer_handler_pre_update_hooks(struct neighbour *neigh, unsigned state);
+int32 rtl_neigh_timer_handler_during_update_hooks(struct neighbour *neigh, unsigned state);
+int32 rtl_neigh_timer_handler_post_update_hooks(struct neighbour *neigh, unsigned state);
+int32 rtl___neigh_event_send_pre_hooks(struct neighbour *neigh, struct sk_buff *skb);
+int32 rtl___neigh_event_send_post_hooks(struct neighbour *neigh, struct sk_buff *skb);
+int32 rtl_neigh_update_hooks(struct neighbour *n, const u8 *lladdr, uint8 old);
+int32 rtl_neigh_update_post_hooks(struct neighbour *n, const u8 *lladdr, uint8 old);
+int32 rtl_neigh_periodic_timer_hooks(struct neighbour *n, unsigned int refresh);
+int32 rtl_neigh_init_hooks(void);
+#if defined(CONFIG_BRIDGE)
+int32 rtl___br_fdb_get_timeout_hooks(struct net_bridge *br, struct net_bridge_fdb_entry *fdb, const unsigned char *addr);
+#endif
+int32 rtl_translate_table_hooks(const char *name,
+ unsigned int valid_hooks,
+ struct xt_table_info *newinfo,
+ void *entry0,
+ unsigned int size,
+ unsigned int number,
+ const unsigned int *hook_entries,
+ const unsigned int *underflows);
+
+int32 rtl_ip_tables_init_hooks(void);
+
+int32 rtl_masq_device_event_hooks(struct notifier_block *this, struct net_device *dev, unsigned long event);
+int32 rtl_masq_inet_event_hooks(struct notifier_block *this, unsigned long event, void *ptr);
+
+#if defined(CONFIG_IP_VS)
+int32 rtl_ip_vs_conn_expire_hooks1(struct ip_vs_conn *cp);
+int32 rtl_ip_vs_conn_expire_hooks2(struct ip_vs_conn *cp);
+#endif
+
+#if defined(CONFIG_IP_VS_PROTO_TCP)
+int32 rtl_tcp_state_transition_hooks(struct ip_vs_conn *cp, int direction, const struct sk_buff *skb, struct ip_vs_protocol *pp);
+#endif
+
+#if defined(CONFIG_IP_VS_PROTO_UDP)
+int32 rtl_udp_state_transition_hooks(struct ip_vs_conn *cp, int direction, const struct sk_buff *skb, struct ip_vs_protocol *pp);
+#endif
+
+#ifdef CONFIG_PROC_FS
+int rtl_ct_seq_show_hooks(struct seq_file *s, struct nf_conn *ct);
+#endif
+#if 0
+int rtl_get_unique_tuple_hooks(struct nf_conntrack_tuple *tuple,
+ const struct nf_conntrack_tuple *orig_tuple,
+ const struct nf_nat_range *range,
+ struct nf_conn *ct,
+ enum nf_nat_manip_type maniptype,
+ struct nf_nat_protocol *proto);
+
+#endif
+
+int32 rtl_dst_alloc_gc_pre_check_hooks(struct dst_ops * ops);
+int32 rtl_dst_alloc_gc_post_check1_hooks(struct dst_ops * ops);
+int32 rtl_dst_alloc_gc_post_check2_hooks(struct dst_ops * ops, struct dst_entry * dst);
+
+#if defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW)
+int32 clean_from_lists_hooks(struct nf_conn *ct, struct net *net);
+int32 __nf_ct_refresh_acct_proto_hooks(struct nf_conn *ct,
+ enum ip_conntrack_info ctinfo,
+ const struct sk_buff *skb,
+ int do_acct,
+ int *event);
+int32 __drop_one_conntrack_process_hooks1(struct nf_conn* ct, int dropPrioIdx, int factor, int checkFlags, int tcpUdpState);
+int32 __drop_one_conntrack_process_hooks2(struct nf_conn* ct, int dropPrioIdx, int factor, int checkFlags, int tcpUdpState);
+int32 rtl_nf_conn_GC_init_hooks(void);
+#endif
+
+#if defined(CONFIG_BRIDGE)
+int32 rtl_fdb_delete_hooks(struct net_bridge_fdb_entry *f);
+int32 rtl_br_fdb_cleanup_hooks(struct net_bridge *br, struct net_bridge_fdb_entry *f);
+#endif
+
+#endif
+
+