diff options
author | Roman Yeryomin <roman@advem.lv> | 2013-05-17 20:40:24 +0300 |
---|---|---|
committer | Roman Yeryomin <roman@advem.lv> | 2013-05-17 20:40:24 +0300 |
commit | e6d87036412b952cb083eff2dc716aee97a771f2 (patch) | |
tree | 273dd3daaa85553832d3cc6d48276229dc7fbe09 /target/linux/realtek/files/include/net/rtl | |
parent | a18fec42221baa52fff4c5ffd45ec8f32e3add36 (diff) |
Move to rsdk 3.2.4. Compiles cleanly.
Signed-off-by: Roman Yeryomin <roman@advem.lv>
Diffstat (limited to 'target/linux/realtek/files/include/net/rtl')
11 files changed, 891 insertions, 430 deletions
diff --git a/target/linux/realtek/files/include/net/rtl/fastpath/fastpath_core.h b/target/linux/realtek/files/include/net/rtl/fastpath/fastpath_core.h index 9d02db024..64d45862b 100644 --- a/target/linux/realtek/files/include/net/rtl/fastpath/fastpath_core.h +++ b/target/linux/realtek/files/include/net/rtl/fastpath/fastpath_core.h @@ -71,8 +71,8 @@ /***********************************cary:refine filter.c**********************************/ #define FASTPATH_FILTER 1 /***********************************************************************************/ -#define CUSTOM_RSP_PACKET -#define DOS_FILTER +#define CUSTOM_RSP_PACKET +#define DOS_FILTER #define URL_FILTER //#define URL_CONTENT_AUTHENTICATION @@ -89,12 +89,51 @@ #define NO_ARP_USED // 2008.01.09, Forrest Lin. Use kernel route cache already. #define INVALID_PATH_BY_FIN +#if defined(CONFIG_RTL_FAST_PPPOE) +#define MAX_PPPOE_ENTRY 16 +struct pppoe_info +{ + char wan_dev[IFNAMSIZ]; /* Local device to use */ + char ppp_dev[IFNAMSIZ]; /* Local device to use */ + unsigned char our_mac[6]; + unsigned char peer_mac[6]; + unsigned int our_ip; + unsigned int peer_ip; + unsigned short sid; + unsigned short valid; + unsigned long last_rx; + unsigned long last_tx; + unsigned char txHdrCache[22]; +#if defined (CONFIG_RTL_FAST_PPPOE_DEBUG) + unsigned int total_rx; + unsigned int total_tx; +#endif +}; + + +int __init fast_pppoe_init(void); +int __exit fast_pppoe_exit(void); + +int clear_pppoe_info(char *ppp_dev, char *wan_dev, unsigned short sid, + unsigned int our_ip,unsigned int peer_ip, + unsigned char * our_mac, unsigned char *peer_mac); + +int set_pppoe_info(char *ppp_dev, char *wan_dev, unsigned short sid, + unsigned int our_ip,unsigned int peer_ip, + unsigned char * our_mac, unsigned char *peer_mac); + +unsigned long get_pppoe_last_rx_tx(char *ppp_dev, char *wan_dev, unsigned short sid, + unsigned int our_ip,unsigned int peer_ip, + unsigned char * our_mac, unsigned char *peer_mac, + unsigned long *last_rx, unsigned long *last_tx); + + +int check_and_pull_pppoe_hdr(struct sk_buff *skb); + +void check_and_restore_pppoe_hdr(struct sk_buff *skb); + +int fast_pppoe_xmit(struct sk_buff *skb); -#if defined(FAST_L2TP) -#if 0 - #define DEBUGP printk -#else - #define DEBUGP(fmt, args...) {} #endif #ifdef URL_CONTENT_AUTHENTICATION @@ -103,7 +142,7 @@ typedef struct _unAuth_skb_s { - struct list_head list; + struct list_head list; int id; /*skb->iphdr.id*/ uint32 saddr; uint32 daddr; @@ -114,6 +153,13 @@ typedef struct _unAuth_skb_s int rtl_urlContent_auth(struct sk_buff *skb); #endif +#if defined(FAST_L2TP) +#if 0 + #define DEBUGP printk +#else + #define DEBUGP(fmt, args...) {} +#endif + #define control_message 0x8000 #define connect_control 0xc @@ -122,8 +168,8 @@ int rtl_urlContent_auth(struct sk_buff *skb); struct l2tp_info { - struct net_device *wan_dev; - struct net_device *ppp0_dev; + void *wan_dev; + void *ppp0_dev; unsigned long last_xmit; __u32 daddr; __u32 saddr; @@ -131,7 +177,7 @@ struct l2tp_info __u16 cid; /* Caller ID */ unsigned char mac_header[ETH_HLEN]; __u16 valid; - + }; @@ -165,7 +211,7 @@ struct l2tp_header __u16 Ns; /* Optional next sent */ __u16 Nr; /* Optional next received */ }; -extern void (*l2tp_tx_id_hook)(struct sk_buff *skb); +extern void (*l2tp_tx_id_hook)(void *skb); #endif @@ -199,6 +245,26 @@ struct pptp_info { }; */ +struct pptp_acc_info { + unsigned long fast_pptp_lastxmit; + int valid; + void *wanDev; + unsigned char ourMac[ETHER_ADDR_LEN]; + __u16 ourCallID; + __u32 ourIp; + unsigned char peerMac[ETHER_ADDR_LEN]; + __u16 peerCallID; + __u32 peerIp; + unsigned int tx_seqno; + unsigned int rx_seqno; + __u16 tx_ipID; + __u16 ipID; + unsigned int tx_seqno_daemon; + unsigned int rx_seqno_daemon; + void *pppDev; + struct ppp_channel *pppChan; +}; + extern int fast_pptp_fw; @@ -276,32 +342,33 @@ void register_customRspHook(int *_cusRsp401_func,int *_cusRspTCPFinAck_func,int void unregister_customRspHook(void); void register_customRspStr(char *_str); void unregister_customRspStr(void); - int GenerateHTTP401(struct sk_buff *skb); + int GenerateHTTP401(void *skb); #endif #ifdef DOS_FILTER - extern int filter_enter(struct sk_buff *skb); + extern int filter_enter(void *skb); extern int __init filter_init(void); extern void __exit filter_exit(void); extern void filter_addconnect(ipaddr_t ipaddr); extern void filter_delconnect(ipaddr_t ipaddr); + extern int filter_checkConnect(__u32 ipaddr); #endif #ifdef FAST_PPTP - extern void fast_pptp_filter(struct sk_buff *skb); - extern void fast_pptp_sync_rx_seq(struct sk_buff *skb); + extern void fast_pptp_filter(void *skb); + extern void fast_pptp_sync_rx_seq(void *skb); extern int __init fast_pptp_init(void); extern void __exit fast_pptp_exit(void); - extern int fast_pptp_to_lan(struct sk_buff **pskb); - extern int Check_GRE_rx_net_device(struct sk_buff *skb); + extern int fast_pptp_to_lan(void **pskb); + extern int Check_GRE_rx_net_device(void *skb); extern int pptp_tcp_finished; #endif #ifdef FAST_L2TP extern int __init fast_l2tp_init(void); extern void __exit fast_l2tp_exit(void); - extern int fast_l2tp_to_wan(struct sk_buff *skb); - extern void fast_l2tp_rx(struct sk_buff *skb); - extern void l2tp_tx_id(struct sk_buff *skb); + extern int fast_l2tp_to_wan(void *skb); + extern void fast_l2tp_rx(void *skb); + extern void l2tp_tx_id(void *skb); extern int fast_l2tp_fw; #endif @@ -320,7 +387,7 @@ void unregister_customRspStr(void); #define ROUTE_TABLE_ENTRY_MAX 64 #if !defined(CONFIG_RTL8186_KB_N) -#if defined(CONFIG_RTL_8198) || defined(CONFIG_RTL_92D_SUPPORT) +#if defined(CONFIG_RTL_8198) || defined(CONFIG_RTL_92D_SUPPORT) ||defined(CONFIG_RTL_819XD) ||(defined(CONFIG_RTL_8196E)&&defined(CONFIG_RTL_SDRAM_GE_32M)) #define NAPT_TABLE_LIST_MAX 4096 #define NAPT_TABLE_ENTRY_MAX 4096 #define PATH_TABLE_LIST_MAX 4096 @@ -358,7 +425,7 @@ enum LR_RESULT LR_ERROR_PARAMETER = -2, /* The given parameter error */ LR_EXIST = -3, /* The entry you want to add has been existed, add failed */ LR_NONEXIST = -4, /* The specified entry is not found */ - + LR_NOBUFFER = -1000, /* Out of Entry Space */ LR_INVAPARAM = -1001, /* Invalid parameters */ LR_NOTFOUND = -1002, /* Entry not found */ @@ -440,8 +507,8 @@ enum LR_RESULT rtk_delSession( uint8* ifname ); enum LR_RESULT rtk_addNaptConnection(rtl_fp_napt_entry *fpNaptEntry, #if defined(IMPROVE_QOS) - struct sk_buff *pskb, struct nf_conn *ct, -#endif + void *pskb, void *ct, +#endif enum NP_FLAGS flags); enum LR_RESULT rtk_delNaptConnection( rtl_fp_napt_entry *fpNaptEntry); #if defined(IMPROVE_QOS) @@ -455,7 +522,7 @@ int32 rtl_br_fdb_time_update(void *br, void *fdb, const unsigned char *addr); int32 rtl_fp_dev_queue_xmit_check(struct sk_buff *skb, struct net_device *dev); int32 rtl_fp_dev_hard_start_xmit_check(struct sk_buff *skb, struct net_device *dev, struct netdev_queue *txq); -#if defined(IMPROVE_QOS) || defined(CONFIG_RTL_HW_QOS_SUPPORT) +#if defined(IMPROVE_QOS) || defined(CONFIG_RTL_HW_QOS_SUPPORT) //To query hardware address based on IP through arp table of dev int arp_req_get_ha(__be32 queryIP, struct net_device *dev, unsigned char * resHwAddr); #endif @@ -597,8 +664,8 @@ int fastpath_dump_napt_entry_num(char *page, int len); chksum = htons((uint16) accumulate); \ } \ }while(0) /* Checksum adjustment */ - - + + #define FASTPATH_ADJUST_CHKSUM_NAPT(ip_mod, ip_org, port_mod, port_org, chksum) \ do { \ s32 accumulate = 0; \ @@ -638,27 +705,31 @@ int init_table_napt(int napt_tbl_list_max, int napt_tbl_entry_max); #endif int init_table_path(int path_tbl_list_max, int path_tbl_entry_max); int udp_fragCache_init(int udp_frag_entry_max); +int negative_fragCache_init(void); void fastpath_set_qos_mark(struct sk_buff *skb, unsigned int preRouteMark, unsigned int postRouteMark); int fast_path_pre_process_check(struct iphdr *iph, struct tcphdr *tcphupuh, struct sk_buff *skb); int fast_path_post_process_xmit_check(struct iphdr *iph, struct tcphdr *tcphupuh, struct sk_buff *skb); int fast_path_post_process_return_check(struct iphdr *iph, struct tcphdr *tcphupuh, struct sk_buff *skb); int ip_finish_output3(struct sk_buff *skb); -__IRAM_GEN int enter_fast_path(struct sk_buff *skb); +#if defined (CONFIG_RTL_FAST_PPPOE) +int ip_finish_output4(struct sk_buff *skb); +#endif +__IRAM_GEN int enter_fast_path(void *skb); uint8 *FastPath_Route(ipaddr_t dIp); int FastPath_Enter(struct sk_buff **skb); extern int Get_fast_pptp_fw(void); #ifdef CONFIG_FAST_PATH_MODULE extern int (*fast_path_hook)(struct sk_buff **pskb) ; extern enum LR_RESULT (*FastPath_hook1)( ipaddr_t ip, ipaddr_t mask ); -extern enum LR_RESULT (*FastPath_hook2)( ipaddr_t ip, ipaddr_t mask, ipaddr_t gateway, uint8* ifname, enum RT_FLAGS flags ); +extern enum LR_RESULT (*FastPath_hook2)( ipaddr_t ip, ipaddr_t mask, ipaddr_t gateway, uint8* ifname, enum RT_FLAGS flags ); extern int (*fast_path_hook)(struct sk_buff **pskb) ; extern enum LR_RESULT (*FastPath_hook3)( ipaddr_t ip, ipaddr_t mask, ipaddr_t gateway, uint8* ifname, enum RT_FLAGS flags ); extern enum LR_RESULT (*FastPath_hook4)( rtl_fp_napt_entry *fpNaptEntry); extern enum LR_RESULT (*FastPath_hook5)( ipaddr_t ip, ether_addr_t* mac, enum ARP_FLAGS flags ); enum LR_RESULT (*FastPath_hook6)( rtl_fp_napt_entry *fpNaptEntry, #if defined(IMPROVE_QOS) - struct sk_buff *pskb, struct nf_conn *ct, -#endif + struct sk_buff *pskb, struct nf_conn *ct, +#endif enum NP_FLAGS flags); extern enum LR_RESULT (*FastPath_hook7)( ipaddr_t ip ); extern enum LR_RESULT (*FastPath_hook8)( ipaddr_t ip, ether_addr_t* mac, enum ARP_FLAGS flags ); @@ -666,12 +737,12 @@ extern int (*FastPath_hook9)( void ); extern int (*FastPath_hook10)(struct sk_buff *skb); extern enum LR_RESULT (*FastPath_hook11)(rtl_fp_napt_entry *fpNaptEntry, uint32 interval); -extern int fast_pptp_to_wan(struct sk_buff *skb); +extern int fast_pptp_to_wan(void *skb); #endif /* ---------------------------------------------------------------------------------------------------- */ #if defined(FASTPATH_FILTER) -#define RTL_FILTER_CONTENT_MAXNUM 40 +#define RTL_FILTER_CONTENT_MAXNUM 40 #define RTL_TABLE_FILTER_ENTRY_COUNT 10 #define IP_RANGE_TABLE 1 #define MAC_TABLE 2 @@ -691,7 +762,7 @@ typedef struct _rlt_filter_table_head typedef struct _filter_ipRange_fastpath { struct list_head list; - uint32 addr_start; /*ipaddr start*/ + uint32 addr_start; /*ipaddr start*/ uint32 addr_end; /*address end*/ uint32 flag; /*0 bit: default action[0:block,1:forward];1 bit: src ip or dest ip[0:src, 1:dest];2 bit: refer both direction*/ /*bit 9: valid 1; invalid 0*/ @@ -701,7 +772,7 @@ typedef struct _filter_ipRange_fastpath #define RTL_URL_FILTER_CONTENT_MAXNUM_FASTPATH 40 typedef struct _url_table_head_entry_fastpath { - struct list_head list; + struct list_head list; uint32 flag; int (*func)(struct sk_buff *skb); }url_table_head_entry_fastpath; @@ -723,7 +794,7 @@ typedef struct _rtl_mac_entry_fastpath { struct list_head list; char mac[ETHER_ADDR_LEN]; - uint8 flag; + uint8 flag; }rtl_mac_entry_fastpath; typedef struct _rtl_sch_entry_fastpath @@ -745,7 +816,7 @@ typedef struct _filter_table_info typedef struct _filter_table_list { struct list_head table_list; - struct list_head item_list; + struct list_head item_list; uint32 type; //type uint32 flag; uint32 num; @@ -754,8 +825,8 @@ typedef struct _filter_table_list typedef struct _filter_item_entry { - struct list_head item_list; - struct list_head rule_list; + struct list_head item_list; + struct list_head rule_list; uint32 relation_flag; //bit0: is the first condition? 1;0 //bit1: have next condition? 1:0 [next table condition] //bit2: have "and" logic condition?1:0 @@ -764,7 +835,7 @@ typedef struct _filter_item_entry //bit8: all match flag 1: all, 0: not all //bit9: NULL flag, 1:NULL, 0: not NULL uint32 index; - uint32 flag; + uint32 flag; char data[RTL_FILTER_CONTENT_MAXNUM]; }filter_item_entry; @@ -783,8 +854,128 @@ extern filter_table_list table_list_head; #define RTL_FASTPATH_PPP0_DEV_NAME "ppp0" #if defined(CONFIG_RTL_NF_CONNTRACK_GARBAGE_NEW) -void rtl_fp_mark_invalid(struct nf_conn *ct); +void rtl_fp_mark_invalid(void *ct); +#endif + +#define FASTPTH_INDEPENDENCE_KERNEL 1 +#if defined(FASTPTH_INDEPENDENCE_KERNEL) +extern struct dst_entry *dst_tmp; +extern int ppp_start_xmit(struct sk_buff *skb, struct net_device *dev); +extern struct sk_buff *ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb, int is_fast_fw); + +__be16 rtl_get_skb_protocol(struct sk_buff *skb); +void rtl_set_skb_protocol(struct sk_buff *skb,__be16 protocol); + + +unsigned char rtl_get_skb_type(struct sk_buff *skb); + +__wsum rtl_get_skb_csum(struct sk_buff *skb); + +unsigned int rtl_get_skb_len(struct sk_buff *skb); + +unsigned char *rtl_get_skb_data(struct sk_buff* skb); +void rtl_set_skb_data(struct sk_buff *skb, int offset, int action); + +unsigned char *rtl_skb_mac_header(struct sk_buff * skb); +void rtl_skb_set_mac_header(struct sk_buff *skb, int offset); +int rtl_skb_mac_header_was_set(struct sk_buff *skb); + +void rtl_set_skb_dmac(struct sk_buff *skb, void *device); +void rtl_set_skb_smac(struct sk_buff *skb, void *device); + + +unsigned char *rtl_skb_network_header(struct sk_buff * skb); +void rtl_skb_set_network_header(struct sk_buff * skb,const int offset); +void rtl_skb_reset_network_header(struct sk_buff *skb); +void rtl_set_skb_network_header(struct sk_buff * skb, unsigned char *network_header); + +unsigned char *rtl_skb_transport_header(struct sk_buff * skb); +void rtl_skb_set_transport_header(struct sk_buff * skb,const int offset); +void rtl_skb_reset_transport_header(struct sk_buff *skb); +void rtl_set_skb_transport_header(struct sk_buff * skb, unsigned char *transport_header); + + +unsigned int rtl_get_skb_pppoe_flag(struct sk_buff * skb); +void rtl_set_skb_pppoe_flag(struct sk_buff * skb,unsigned int pppoe_flag); + +unsigned char *rtl_skb_pull(struct sk_buff *skb, unsigned int len); +unsigned char *rtl_skb_push(struct sk_buff *skb, unsigned int len); + +int rtl_ppp_proto_check(struct sk_buff *skb, unsigned char* ppp_proto); +unsigned int rtl_ipt_do_table(struct sk_buff * skb, unsigned int hook, void *in, void *out); +int rtl_ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr, u8 tos); +int rtl_skb_dst_check(struct sk_buff *skb); +void rtl_set_skb_ip_summed(struct sk_buff *skb, int value); +void rtl_dst_release(struct sk_buff *skb); + +__u32 rtl_get_skb_mark(struct sk_buff *skb); +void rtl_set_skb_mark(struct sk_buff *skb, unsigned int value); +void rtl_store_skb_dst(struct sk_buff *skb); +void rtl_set_skb_dst(struct sk_buff *skb); +int rtl_tcp_get_timeouts(void *ptr); +int rtl_arp_req_get_ha(__be32 queryIP, void *device, unsigned char * resHwAddr); + + +u_int8_t rtl_get_ct_protonum(void *ct_ptr, enum ip_conntrack_dir dir); +unsigned long rtl_get_ct_udp_status(void *ct_ptr); +u_int8_t rtl_get_ct_tcp_state(void *ct_ptr); +__be32 rtl_get_ct_ip_by_dir(void *ct_ptr, enum ip_conntrack_dir dir, int flag); +__be16 rtl_get_ct_port_by_dir(void *ct_ptr, enum ip_conntrack_dir dir, int flag); +void rtl_set_ct_timeout_expires(void *ct_ptr, unsigned long value); +unsigned long rtl_hold_time(void *br_ptr); +void rtl_set_fdb_aging(void *fdb_ptr, unsigned long value); +unsigned long rtl_get_fdb_aging(void *fdb_ptr); + +struct ethhdr *rtl_eth_hdr(struct sk_buff *skb); +struct iphdr *rtl_ip_hdr(struct sk_buff *skb); + + +struct net_device * rtl_get_dev_by_name(char *name); + +struct net_device *rtl_get_skb_dev(struct sk_buff* skb); +void rtl_set_skb_dev(struct sk_buff *skb, struct net_device *dev); + +char *rtl_get_skb_dev_name(struct sk_buff *skb); + +void rtl_set_skb_inDev(struct sk_buff *skb); + + + +struct net_device *rtl_get_skb_rx_dev(struct sk_buff* skb); +void rtl_set_skb_rx_dev(struct sk_buff* skb,struct net_device *dev); + +char * rtl_get_ppp_dev_name(struct net_device *ppp_dev); +void * rtl_get_ppp_dev_priv(struct net_device *ppp_dev); + +int rtl_call_skb_ndo_start_xmit(struct sk_buff *skb); + +void rtl_inc_ppp_stats(struct ppp *ppp, int act, int len); + +void *rtl_set_skb_tail(struct sk_buff *skb, int offset, int action); +struct sk_buff *rtl_ppp_receive_nonmp_frame(struct ppp *ppp, struct sk_buff *skb, int is_fast_fw); +int rtl_ppp_start_xmit(struct sk_buff *skb, struct net_device *dev); +void rtl_set_skb_cb(struct sk_buff *skb, char *value, int len); +int rtl_ppp_vj_check(struct ppp* ppp); +void *rtl_get_ppp_xmit_pending(struct ppp* ppp); +void rtl_set_ppp_xmit_pending(struct ppp* ppp, struct sk_buff* skb); +void rtl_set_skb_nfct(struct sk_buff *skb, void *value); +struct neighbour *rtl_neigh_lookup(const void *pkey, struct net_device *dev); +struct hh_cache *rtl_get_hh_from_neigh(struct neighbour *neigh); +seqlock_t rtl_get_lock_from_hh(struct hh_cache * hh); +unsigned short rtl_get_len_from_hh(struct hh_cache * hh); +unsigned long *rtl_get_data_from_hh(struct hh_cache * hh); +unsigned int rtl_skb_headroom(struct sk_buff *skb); +int rtl_skb_cloned(struct sk_buff *skb); +int rtl_skb_shared(const struct sk_buff *skb); +#if defined(CONFIG_RTL_DSCP_IPTABLE_CHECK) && defined(IMPROVE_QOS) +__u8 rtl_get_skb_orig_dscp(struct sk_buff *skb); #endif +void rtl_conntrack_drop_check_hook(struct nf_conn *ct_tmp, uint16 ipprotocol, struct nf_conn *ct); +int rtl_Add_Pattern_ACL_For_ContentFilter(void); +#endif + +#define RTL_FSTPATH_TTL_ADJUST 1 +void get_fastpath_module_info(unsigned char *buf); #endif /* __FASTPATH_CORE_H__ */ 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 index 45b2c7466..9b7e567e5 100644 --- a/target/linux/realtek/files/include/net/rtl/features/rtl_features.h +++ b/target/linux/realtek/files/include/net/rtl/features/rtl_features.h @@ -1,7 +1,9 @@ #ifndef RTL_FEATURES_H
#define RTL_FEATURES_H 1
+extern char __conntrack_drop_check(void* tmp);
extern int rtl_nf_conntrack_threshold;
+extern int drop_priority_max_idx;
#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)
@@ -13,7 +15,7 @@ extern int rtl_nf_conntrack_threshold; struct tcp_state_hash_head
{ enum tcp_conntrack state; - +
struct list_head* state_hash; }; struct udp_state_hash_head @@ -47,20 +49,21 @@ enum { 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);
+void clean_from_lists(void *ct, void *net);
+void rtl_death_action(void *ct);
int drop_one_conntrack(const struct nf_conntrack_tuple *orig,const struct nf_conntrack_tuple *repl);
+int isReservedConntrack(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);
+int32 rtl_connGC_addList(void *skb, void *ct);
#endif
#if defined(CONFIG_RTL_IPTABLES_FAST_PATH)
-int rtl_fpTimer_update(struct nf_conn *ct);
+int rtl_fpTimer_update(void *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) +#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 @@ -80,8 +83,9 @@ 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);
+int32 rtl865x_handle_nat(struct nf_conn *ct, int act, struct sk_buff *skb);
int rtl_hwnat_timer_update(struct nf_conn *ct);
+#define CONFIG_RTL_AVOID_ADDING_WLAN_PKT_TO_HW_NAT 1
#endif
#if defined(IMPROVE_QOS) && (defined(CONFIG_RTL_IPTABLES_FAST_PATH) || defined(CONFIG_RTL_HARDWARE_NAT))
@@ -133,9 +137,9 @@ 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)
+#if defined(CONFIG_RTL_HARDWARE_NAT)
int rtl_flush_extern_ip(void);
-int rtl_init_masq_info(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,
@@ -144,7 +148,7 @@ int rtl_check_for_extern_ip(const char *name, #endif
#if defined(CONFIG_RTL_HARDWARE_NAT) -int rtl865x_handle_nat(struct nf_conn *ct, int act, struct sk_buff *skb);
+int32 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);
@@ -172,7 +176,7 @@ extern unsigned long rtl_newGC_session_status_time; #if defined(CONFIG_RTL_8198)
#define RTL_FP_SESSION_LEVEL3_ALLOW_COUNT (40)
#else
-#define RTL_FP_SESSION_LEVEL3_ALLOW_COUNT (16)
+#define RTL_FP_SESSION_LEVEL3_ALLOW_COUNT (16)
#endif
#define RTL_FP_SESSION_LEVEL1_RX_WEIGHT (8) @@ -181,7 +185,35 @@ extern unsigned long rtl_newGC_session_status_time; #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); +//enum LR_RESULT rtk_refreshOSConnectionTimer(void);
+
+#if 1 //defined(CONFIG_RTL_GC_INDEPENDENCE_ON_KERNEL)
+int rtl_gc_threshold_check(struct net* net);
+void rtl_list_del(struct nf_conn* ct);
+void rtl_hlist_nulls_del_rcu(struct nf_conn* ct, enum ip_conntrack_dir dir);
+void rtl_list_add_tail(struct nf_conn* ct, int proto, int flag);
+int rtl_test_bit(struct nf_conn* ct, int num);
+int rtl_del_ct_timer(struct nf_conn *ct);
+void rtl_add_ct_timer(struct nf_conn *ct);
+void rtl_list_move_tail(struct nf_conn *ct, int proto, int state);
+unsigned long rtl_get_ct_timer_expires(struct nf_conn* ct);
+void rtl_nf_ct_stat_inc(struct net* net);
+int rtl_skb_network_offset(struct sk_buff *skb);
+u_int8_t rtl_new_gc_get_ct_protonum(void *ct_ptr, enum ip_conntrack_dir dir);
+struct iphdr *rtl_new_gc_ip_hdr(struct sk_buff *skb);
+__be16 rtl_new_gc_get_skb_protocol(struct sk_buff *skb);
+unsigned long rtl_new_gc_get_ct_udp_status(void *ct_ptr);
+u_int8_t rtl_new_gc_get_ct_tcp_state(void *ct_ptr);
+void rtl_new_gc_set_ct_timeout_expires(void *ct_ptr, unsigned long value);
+__be32 rtl_new_gc_get_ct_ip_by_dir(void *ct_ptr, enum ip_conntrack_dir dir, int flag);
+__be16 rtl_new_gc_get_ct_port_by_dir(void *ct_ptr, enum ip_conntrack_dir dir, int flag);
+#endif
+
#endif +#define CONFIG_RTL_URL_PATCH 1
+#if defined(CONFIG_RTL_URL_PATCH)
+#define URL_PROTO_PORT 80
+#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 index 6af1b865d..8605b5462 100644 --- 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 @@ -1,8 +1,9 @@ -#ifndef RTL_PS_HOOKS_H +#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_common.h>
+
#include <linux/netfilter/nf_conntrack_tcp.h> #include <net/rtl/rtl_types.h> @@ -55,13 +56,15 @@ int32 rtl_fn_hash_replace_hooks(struct fib_table *tb, struct fib_config *cfg, st 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_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); @@ -75,10 +78,11 @@ 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 +#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, @@ -112,7 +116,7 @@ int rtl_ct_seq_show_hooks(struct seq_file *s, struct nf_conn *ct); 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, + struct nf_conn *ct,
enum nf_nat_manip_type maniptype, struct nf_nat_protocol *proto); @@ -134,11 +138,17 @@ int32 __drop_one_conntrack_process_hooks2(struct nf_conn* ct, int dropPrioIdx, i 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 - +
+#if defined(CONFIG_BRIDGE)
+int32 rtl_fdb_create_hooks(struct net_bridge_fdb_entry *fdb,const unsigned char *addr);
+int32 rtl865x_addAuthFDBEntry_hooks(const unsigned char *addr);
+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, unsigned long delay);
+
+#endif
+
+
#endif +
diff --git a/target/linux/realtek/files/include/net/rtl/rtk_vlan.h b/target/linux/realtek/files/include/net/rtl/rtk_vlan.h index 71764b61f..0a7f16f36 100644 --- a/target/linux/realtek/files/include/net/rtl/rtk_vlan.h +++ b/target/linux/realtek/files/include/net/rtl/rtk_vlan.h @@ -10,12 +10,16 @@ struct vlan_info {
int global_vlan; // 0/1 - global vlan disable/enable
- int is_lan; // 1: eth-lan/wlan port, 0: wan port
+ int is_lan; // 1: eth-lan/wlan port, 0: wan port
int vlan; // 0/1: disable/enable vlan
int tag; // 0/1: disable/enable tagging
int id; // 1~4090: vlan id
int pri; // 0~7: priority;
int cfi; // 0/1: cfi
+#if defined(CONFIG_RTK_VLAN_NEW_FEATURE)
+ int forwarding_rule; // 0:disabled/1: bridge/2:NAT
+ int index;
+#endif
};
struct _vlan_tag {
@@ -25,14 +29,28 @@ struct _vlan_tag { struct vlan_tag {
union
- {
+ {
unsigned long v;
struct _vlan_tag f;
- };
+ };
+};
+
+#if defined(CONFIG_RTK_VLAN_NEW_FEATURE)
+extern struct vlan_info management_vlan;
+extern unsigned char lan_macaddr[6];
+struct vlan_info_item {
+ struct vlan_info info;
+ struct net_device *dev;
};
+struct net_device *rtl_get_wan_from_vlan_info(void);
+int rtl_add_vlan_info(struct vlan_info *info, struct net_device *dev);
+struct vlan_info_item *rtl_get_vlan_info_item_by_dev(struct net_device *dev);
+
+#endif
+
#if defined(CONFIG_RTL_HW_STP)
-uint32 rtl865x_getVlanPortMask(uint32 vid);
+uint32 rtl865x_getVlanPortMask(uint32 vid);
#endif
#endif // _RTK_VLAN_H
diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_arp_api.h b/target/linux/realtek/files/include/net/rtl/rtl865x_arp_api.h index 73ed95a2b..23f48e0c2 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_arp_api.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_arp_api.h @@ -24,4 +24,8 @@ int32 rtl865x_getArpMapping(ipaddr_t ip, rtl865x_arpMapping_entry_t * arp_mappin int32 rtl_set_callback_for_ps_arp(int (*call_back_fn)(u32 ip,rtl865x_arpMapping_entry_t *entry)); #endif +#if 1//#if defined(CONFIG_RTL_AVOID_ADDING_WLAN_PKT_TO_HW_NAT) +int32 rtl865x_isEthArp(ipaddr_t ip); +#endif + #endif diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_fdb_api.h b/target/linux/realtek/files/include/net/rtl/rtl865x_fdb_api.h index b2fb2390a..edbab8ccc 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_fdb_api.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_fdb_api.h @@ -10,17 +10,62 @@ #endif #define FDB_STATIC 0x01 /* flag for FDB: process static entry only */ -#define FDB_DYNAMIC 0x02 /* flag for FDB: process dynamic entry only */ +#define FDB_DYNAMIC 0x02 /* flag for FDB: process dynamic entry only */ + +#define RTL865x_FDB_NUMBER 4 +#define RTL865x_L2_TYPEI 0x0001 /* Referenced by ARP/PPPoE */ +#define RTL865x_L2_TYPEII 0x0002 /* Referenced by Protocol */ +#define RTL865x_L2_TYPEIII 0x0004 /* Referenced by PCI/Extension Port */ +#define CONFIG_RTL865X_SYNC_L2 1 +#define RTL865X_FDBENTRY_TIMEOUT 0x1001 /*fdb entry time out*/ +#define RTL865X_FDBENTRY_450SEC 0x1002 /*fdb entry 450s timing*/ +#define RTL865X_FDBENTRY_300SEC 0x1004 /*fdb entry 300s timing*/ +#define RTL865X_FDBENTRY_150SEC 0x1008 /*fdb entry 150s timing*/ + +/*#define ETHER_ADDR_LEN 6 +typedef struct ether_addr_s { + uint8 octet[ETHER_ADDR_LEN]; +} ether_addr_t;*/ +/* +typedef struct rtl865x_tblAsicDrv_l2Param_s { + ether_addr_t macAddr; + uint32 memberPortMask; //extension ports [rtl8651_totalExtPortNum-1:0] are located at bits [RTL8651_PORT_NUMBER+rtl8651_totalExtPortNum-1:RTL8651_PORT_NUMBER] + uint32 ageSec; + uint32 cpu:1, + srcBlk:1, + isStatic:1, + nhFlag:1, + fid:2, + auth:1; + +} rtl865x_tblAsicDrv_l2Param_t;*/ + +//extern typedef struct rtl865x_tblAsicDrv_l2Param_s rtl865x_tblAsicDrv_l2Param_t; + + void update_hw_l2table(const char *srcName,const unsigned char *addr); int32 rtl_get_hw_fdb_age(uint32 fid,ether_addr_t *mac, uint32 flags); -int32 rtl865x_addAuthFDBEntry(const unsigned char *addr, int32 auth, int32 port); +int32 rtl865x_addAuthFDBEntry(const unsigned char *addr, int32 auth, int32 port, int32 srcblk); int32 rtl865x_setRestrictPortNum(int32 port, uint8 isEnable, int32 number); int32 rtl865x_check_authfdbentry_Byport(int32 port_num, const unsigned char *macAddr); int32 rtl865x_enableLanPortNumRestrict(uint8 isEnable); +int32 rtl865x_delAuthLanFDBEntry(uint16 l2Type, const unsigned char *addr); +int32 rtl865x_delLanFDBEntry(uint16 l2Type, const unsigned char *addr); + +int32 rtl865x_arrangeFdbEntry(const unsigned char *timeout_addr, int32 *port); +//extern int32 rtl865x_Lookup_fdb_entry(uint32 fid, ether_addr_t *mac, uint32 flags, uint32 *col_num, rtl865x_tblAsicDrv_l2Param_t *L2buff); + +int32 rtl865x_getPortNum(const unsigned char *addr); +int32 rtl865x_ConvertPortMasktoPortNum(int32 portmask); +int32 rtl865x_addFDBEntry(const unsigned char *addr); + #if defined(CONFIG_RTL865X_LANPORT_RESTRICTION) #define LAN_RESTRICT_PORT_NUMBER 9 +#define RTL_LAN_RESTRICT_STAT2 2 +#define RTL_LAN_RESTRICT_STAT1 1 +#define RTL_LAN_RESTRICT_STAT0 0 typedef struct _lan_restrict_info { @@ -32,6 +77,17 @@ typedef struct _lan_restrict_info extern lan_restrict_info lan_restrict_tbl[LAN_RESTRICT_PORT_NUMBER]; + +//int32 rtl865x_addAuthFDBEntry_hooks(struct net_bridge_fdb_entry *fdb,const unsigned char *addr); + + +int32 lan_restrict_getBlockAddr(int32 port , const unsigned char *swap_addr); +int32 lan_restrict_CheckStatusByport(int32 port); + + + + + int32 rtl_check_fdb_entry_check_exist(uint32 fid, ether_addr_t *mac, uint32 flags); int32 rtl_check_fdb_entry_check_srcBlock(uint32 fid, ether_addr_t *mac, int32 *SrcBlk); int32 lanrestrict_callbackFn_for_add_fdb(void *param); diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_multicast.h b/target/linux/realtek/files/include/net/rtl/rtl865x_multicast.h index 2b55ad5b8..3552c3432 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_multicast.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_multicast.h @@ -1,41 +1,41 @@ -#ifndef RTL865X_MULTICAST_H
-#define RTL865X_MULTICAST_H
-
-#define RTL865X_NETWORK_INTERFACE_DATA_STRUCTURE
-
-#define RTL865X_MULTICAST_TABLE_AGE 35
-#define RTL865X_MULTICAST_TABLE_ASIC_FULL_AGE 35
-#define RTL865X_MULTICAST_TABLE_ASIC_AGE 10 /* we would always write this value into ASIC */
-#define RTL865X_MULTICAST_SWAP_THRESHOLD 400
-#define SINGLE_BITMASK_ISSET(x) ((x & (x - 1)) == 0) /* chenyl: only 1 bit is set in vlanMask */
-
-
-/*================================================
- * Multicast Data Structure
- *================================================*/
-#define TBLDRV_MULTICAST_DATA_STRUCTURE
-
-/* mcast entry flag */
-#define RTL865X_MULTICAST_PPPOEPATCH_CPUBIT 0x01
-#define RTL865X_MULTICAST_EXTIP_SET 0x02
-#define RTL865X_MULTICAST_UPLOADONLY 0x04
-
-#define MAX_MCAST_FWD_DESCRIPTOR_CNT 256
-#define MAX_MCAST_TABLE_ENTRY_CNT 128
-
+#ifndef RTL865X_MULTICAST_H +#define RTL865X_MULTICAST_H + +#define RTL865X_NETWORK_INTERFACE_DATA_STRUCTURE + +#define RTL865X_MULTICAST_TABLE_AGE 35 +#define RTL865X_MULTICAST_TABLE_ASIC_FULL_AGE 35 +#define RTL865X_MULTICAST_TABLE_ASIC_AGE 10 /* we would always write this value into ASIC */ +#define RTL865X_MULTICAST_SWAP_THRESHOLD 400 +#define SINGLE_BITMASK_ISSET(x) ((x & (x - 1)) == 0) /* chenyl: only 1 bit is set in vlanMask */ + + +/*================================================ + * Multicast Data Structure + *================================================*/ +#define TBLDRV_MULTICAST_DATA_STRUCTURE + +/* mcast entry flag */ +#define RTL865X_MULTICAST_PPPOEPATCH_CPUBIT 0x01 +#define RTL865X_MULTICAST_EXTIP_SET 0x02 +#define RTL865X_MULTICAST_UPLOADONLY 0x04 + +#define MAX_MCAST_FWD_DESCRIPTOR_CNT 256 +#define MAX_MCAST_TABLE_ENTRY_CNT 128 + /* * List definitions. */ -#define MC_LIST_HEAD(name, type) \
+#define MC_LIST_HEAD(name, type) \ struct name { \ struct type *lh_first; /* first element */ \ } -#define MC_LIST_HEAD_INITIALIZER(head) \
+#define MC_LIST_HEAD_INITIALIZER(head) \ { NULL } -#define MC_LIST_ENTRY(type) \
+#define MC_LIST_ENTRY(type) \ struct { \ struct type *le_next; /* next element */ \ struct type **le_prev; /* address of previous next element */ \ @@ -45,18 +45,18 @@ struct { \ * List functions. */ -#define MC_LIST_EMPTY(head) ((head)->lh_first == NULL)
+#define MC_LIST_EMPTY(head) ((head)->lh_first == NULL) -#define MC_LIST_FIRST(head) ((head)->lh_first)
+#define MC_LIST_FIRST(head) ((head)->lh_first) -#define MC_LIST_FOREACH(var, head, field) \
+#define MC_LIST_FOREACH(var, head, field) \ for((var) = (head)->lh_first; (var); (var) = (var)->field.le_next) -#define MC_LIST_INIT(head) do { \
+#define MC_LIST_INIT(head) do { \ (head)->lh_first = NULL; \ } while (0) -#define MC_LIST_INSERT_AFTER(listelm, elm, field) do { \
+#define MC_LIST_INSERT_AFTER(listelm, elm, field) do { \ if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ (listelm)->field.le_next->field.le_prev = \ &(elm)->field.le_next; \ @@ -64,32 +64,32 @@ struct { \ (elm)->field.le_prev = &(listelm)->field.le_next; \ } while (0) -#define MC_LIST_INSERT_BEFORE(listelm, elm, field) do { \
+#define MC_LIST_INSERT_BEFORE(listelm, elm, field) do { \ (elm)->field.le_prev = (listelm)->field.le_prev; \ (elm)->field.le_next = (listelm); \ *(listelm)->field.le_prev = (elm); \ (listelm)->field.le_prev = &(elm)->field.le_next; \ } while (0) -#define MC_LIST_INSERT_HEAD(head, elm, field) do { \
+#define MC_LIST_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.le_next = (head)->lh_first) != NULL) \ (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ (head)->lh_first = (elm); \ (elm)->field.le_prev = &(head)->lh_first; \ } while (0) -#define MC_LIST_NEXT(elm, field) ((elm)->field.le_next)
+#define MC_LIST_NEXT(elm, field) ((elm)->field.le_next) -#define MC_LIST_REMOVE(elm, field) do { \
+#define MC_LIST_REMOVE(elm, field) do { \ if ((elm)->field.le_next != NULL) \ (elm)->field.le_next->field.le_prev = \ - (elm)->field.le_prev; \
- if ((elm)->field.le_prev != NULL) \
- *(elm)->field.le_prev = (elm)->field.le_next; \
+ (elm)->field.le_prev; \ + if ((elm)->field.le_prev != NULL) \ + *(elm)->field.le_prev = (elm)->field.le_next; \ } while (0) -
-
-
+ + + /* * Counting Tail queue definitions. @@ -186,22 +186,22 @@ struct { \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ (head)->tqh_count--;\ } while (0) -
-#define ETHERNET_DEVICE_TYPE 0
-#define WIRELESS_DEVICE_TYPE 1
-#define VIRTUAL_DEVICE_TYPE 2
-typedef struct rtl865x_mcast_fwd_descriptor_s{
- char netifName[16];
- unsigned int descPortMask;
- char toCpu;
- unsigned int vid;
- unsigned int fwdPortMask;
- MC_LIST_ENTRY(rtl865x_mcast_fwd_descriptor_s) next;
-
-}rtl865x_mcast_fwd_descriptor_t;
-
-typedef MC_LIST_HEAD(mcast_fwd_descriptor_head_s, rtl865x_mcast_fwd_descriptor_s) mcast_fwd_descriptor_head_t;
-
+ +#define ETHERNET_DEVICE_TYPE 0 +#define WIRELESS_DEVICE_TYPE 1 +#define VIRTUAL_DEVICE_TYPE 2 +typedef struct rtl865x_mcast_fwd_descriptor_s{ + char netifName[16]; + unsigned int descPortMask; + char toCpu; + unsigned int vid; + unsigned int fwdPortMask; + MC_LIST_ENTRY(rtl865x_mcast_fwd_descriptor_s) next; + +}rtl865x_mcast_fwd_descriptor_t; + +typedef MC_LIST_HEAD(mcast_fwd_descriptor_head_s, rtl865x_mcast_fwd_descriptor_s) mcast_fwd_descriptor_head_t; + /* * Tail queue definitions. */ @@ -290,71 +290,71 @@ struct { \ (head)->tqh_last = (elm)->field.tqe_prev; \ *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ } while (0) -
-typedef struct rtl865x_tblDrv_mCast_s {
- unsigned int sip;
- unsigned int dip;
- unsigned short svid;
- unsigned short port;
- unsigned int mbr;
- unsigned short age;
- unsigned short cpu;
- unsigned int extIp;
- /*above field is for asic table usage*/
- mcast_fwd_descriptor_head_t fwdDescChain;
- unsigned int count;
- unsigned int maxPPS;
- unsigned char cpuHold;
- unsigned char flag;
- unsigned char inAsic;
- unsigned char unKnownMCast;
-#if defined(CONFIG_RTL8196C_REVISION_B) || defined (CONFIG_RTL8198_REVISION_B)
- unsigned short liveTime;
-#endif
- TAILQ_ENTRY(rtl865x_tblDrv_mCast_s) nextMCast;
-
-} rtl865x_tblDrv_mCast_t;
-
-struct rtl865x_multicastTable{
-
- struct freeList_s {
-
- TAILQ_HEAD( _FreeMultiCastEntry, rtl865x_tblDrv_mCast_s) freeMultiCast;
- } freeList;
-
- struct inuseList_s {
- TAILQ_HEAD( _InuseMCast, rtl865x_tblDrv_mCast_s) *mCastTbl;
- }inuseList;
-
-};
-
-typedef struct rtl865x_mCastConfig_s{
- unsigned int externalPortMask;
-
-}rtl865x_mCastConfig_t;
-
-int rtl865x_initMulticast(rtl865x_mCastConfig_t * mCastConfig);
-int rtl865x_reinitMulticast(void);
-
-int rtl865x_addMulticastExternalPort(unsigned int extPort);
-int rtl865x_delMulticastExternalPort(unsigned int extPort);
-
-int rtl865x_setMulticastExternalPortMask(unsigned int extPortMask);
-int rtl865x_getMulticastExternalPortMask(void);
-
-int rtl865x_addMulticastExternalPortMask(unsigned int extPortMask);
-int rtl865x_delMulticastExternalPortMask(unsigned int extPortMask);
-
-rtl865x_tblDrv_mCast_t *rtl865x_findMCastEntry(unsigned int mAddr, unsigned int sip, unsigned short svid, unsigned short sport);
-
-int rtl865x_addMulticastEntry(unsigned int mAddr, unsigned int sip, unsigned short svid, unsigned short sport,
- rtl865x_mcast_fwd_descriptor_t * newFwdDescChain,
- int flushOldChain, unsigned int extIp, char cpuHold, unsigned char flag);
-
-int rtl865x_delMulticastEntry(unsigned int mcast_addr);
-
-int rtl865x_genVirtualMCastFwdDescriptor(unsigned int forceToCpu, unsigned int fwdPortMask, rtl865x_mcast_fwd_descriptor_t *fwdDescriptor);
-int rtl865x_blockMulticastFlow(unsigned int srcVlanId, unsigned int srcPort,unsigned int srcIpAddr, unsigned int destIpAddr);
-
-#endif
-
+ +typedef struct rtl865x_tblDrv_mCast_s { + unsigned int sip; + unsigned int dip; + unsigned short svid; + unsigned short port; + unsigned int mbr; + unsigned short age; + unsigned short cpu; + unsigned int extIp; + /*above field is for asic table usage*/ + mcast_fwd_descriptor_head_t fwdDescChain; + unsigned int count; + unsigned int maxPPS; + unsigned char cpuHold; + unsigned char flag; + unsigned char inAsic; + unsigned char unKnownMCast; +#if defined(CONFIG_RTL8196C_REVISION_B) || defined (CONFIG_RTL8198_REVISION_B) || defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) + unsigned short liveTime; +#endif + TAILQ_ENTRY(rtl865x_tblDrv_mCast_s) nextMCast; + +} rtl865x_tblDrv_mCast_t; + +struct rtl865x_multicastTable{ + + struct freeList_s { + + TAILQ_HEAD( _FreeMultiCastEntry, rtl865x_tblDrv_mCast_s) freeMultiCast; + } freeList; + + struct inuseList_s { + TAILQ_HEAD( _InuseMCast, rtl865x_tblDrv_mCast_s) *mCastTbl; + }inuseList; + +}; + +typedef struct rtl865x_mCastConfig_s{ + unsigned int externalPortMask; + +}rtl865x_mCastConfig_t; + +int rtl865x_initMulticast(rtl865x_mCastConfig_t * mCastConfig); +int rtl865x_reinitMulticast(void); + +int rtl865x_addMulticastExternalPort(unsigned int extPort); +int rtl865x_delMulticastExternalPort(unsigned int extPort); + +int rtl865x_setMulticastExternalPortMask(unsigned int extPortMask); +int rtl865x_getMulticastExternalPortMask(void); + +int rtl865x_addMulticastExternalPortMask(unsigned int extPortMask); +int rtl865x_delMulticastExternalPortMask(unsigned int extPortMask); + +rtl865x_tblDrv_mCast_t *rtl865x_findMCastEntry(unsigned int mAddr, unsigned int sip, unsigned short svid, unsigned short sport); + +int rtl865x_addMulticastEntry(unsigned int mAddr, unsigned int sip, unsigned short svid, unsigned short sport, + rtl865x_mcast_fwd_descriptor_t * newFwdDescChain, + int flushOldChain, unsigned int extIp, char cpuHold, unsigned char flag); + +int rtl865x_delMulticastEntry(unsigned int mcast_addr); + +int rtl865x_genVirtualMCastFwdDescriptor(unsigned int forceToCpu, unsigned int fwdPortMask, rtl865x_mcast_fwd_descriptor_t *fwdDescriptor); +int rtl865x_blockMulticastFlow(unsigned int srcVlanId, unsigned int srcPort,unsigned int srcIpAddr, unsigned int destIpAddr); + +#endif + diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_nat.h b/target/linux/realtek/files/include/net/rtl/rtl865x_nat.h index 1471a8fee..4cdbc60e9 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_nat.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_nat.h @@ -1,122 +1,122 @@ -#ifndef RTL865X_NAT_H -#define RTL865X_NAT_H - -#define FLAG_QOS_ENABLE 1 - -/* NAT timeout value */ -#define TCP_TIMEOUT 120 /* 120 secs */ -#define UDP_TIMEOUT 90 /* 90 secs */ -#define TCP_OVERRIDE_ELASPED_THRESHOLD 60 /* 60 secs */ -#define UDP_OVERRIDE_ELASPED_THRESHOLD 30 /* 30 secs */ - -#define TCP_CLOSED_FLOW 8 - -#define RTL865X_PROTOCOL_UDP 0 -#define RTL865X_PROTOCOL_TCP 1 - -#define NAT_INBOUND 0x00000001 -#define NAT_OUTBOUND 0x00000002 -#define NAT_PRI_PROCESSED 0x00000004 -#define NAT_PRI_HALF_PROCESSED 0x00000008 - -#define NAT_PRE_RESERVED 0x00000100 -#define RESERVE_EXPIRE_TIME 3 /*uinit:seconds*/ - -#define NAT_INUSE(_n_) ( ((_n_)->flags&(NAT_INBOUND|NAT_OUTBOUND)) ) -#define SET_NAT_FLAGS(_n_, _v_) ((_n_)->flags |= (_v_)) -#define CLR_NAT_FLAGS(_n_, _v_) ((_n_)->flags &= (~(_v_))) -#define NAT_INVALID(_n_) ( ((_n_)->flags=0) ) - -#define MAX_EXTPORT_TRY_CNT 8 - -#define RTL_NAPT_ACCELERATION_FAIL -1 -#define RTL_NAPT_FULL_ACCELERATION 0 -#define RTL_NAPT_OUTBOUND_ACCELERATION 1 -#define RTL_NAPT_INBOUND_ACCELERATION 2 - -#define CONFIG_RTL_INBOUND_COLLISION_AVOIDANCE -#define CONFIG_RTL_HALF_NAPT_ACCELERATION - -typedef struct _rtl865x_napt_entry +#ifndef RTL865X_NAT_H
+#define RTL865X_NAT_H
+
+#define FLAG_QOS_ENABLE 1
+
+/* NAT timeout value */
+#define TCP_TIMEOUT 120 /* 120 secs */
+#define UDP_TIMEOUT 90 /* 90 secs */
+#define TCP_OVERRIDE_ELASPED_THRESHOLD 60 /* 60 secs */
+#define UDP_OVERRIDE_ELASPED_THRESHOLD 30 /* 30 secs */
+
+#define TCP_CLOSED_FLOW 8
+
+#define RTL865X_PROTOCOL_UDP 0
+#define RTL865X_PROTOCOL_TCP 1
+
+#define NAT_INBOUND 0x00000001
+#define NAT_OUTBOUND 0x00000002
+#define NAT_PRI_PROCESSED 0x00000004
+#define NAT_PRI_HALF_PROCESSED 0x00000008
+
+#define NAT_PRE_RESERVED 0x00000100
+#define RESERVE_EXPIRE_TIME 3 /*uinit:seconds*/
+
+#define NAT_INUSE(_n_) ( ((_n_)->flags&(NAT_INBOUND|NAT_OUTBOUND)) )
+#define SET_NAT_FLAGS(_n_, _v_) ((_n_)->flags |= (_v_))
+#define CLR_NAT_FLAGS(_n_, _v_) ((_n_)->flags &= (~(_v_)))
+#define NAT_INVALID(_n_) ( ((_n_)->flags=0) )
+
+#define MAX_EXTPORT_TRY_CNT 8
+
+#define RTL_NAPT_ACCELERATION_FAIL -1
+#define RTL_NAPT_FULL_ACCELERATION 0
+#define RTL_NAPT_OUTBOUND_ACCELERATION 1
+#define RTL_NAPT_INBOUND_ACCELERATION 2
+
+#define CONFIG_RTL_INBOUND_COLLISION_AVOIDANCE
+#define CONFIG_RTL_HALF_NAPT_ACCELERATION
+
+typedef struct _rtl865x_napt_entry
{ - uint32 protocol; //RTL865X_PROTOCOL_UDP or RTL865X_PROTOCOL_TCP - ipaddr_t intIp; - uint32 intPort; - ipaddr_t extIp; - uint32 extPort; - ipaddr_t remIp; - uint32 remPort; -}rtl865x_napt_entry; - -typedef struct _rtl865x_priority -{ - int32 uplinkPrio; - int32 downlinkPrio; -}rtl865x_priority; - -typedef struct _rtl865x_qos_mark -{ - int32 uplinkMark; - int32 downlinkMark; -}rtl865x_qos_mark; - -int32 rtl865x_nat_init(void); -int32 rtl865x_nat_reinit(void); -/* -@func enum RTL_RESULT | rtl865x_addNaptConnection | Add a NAPT Flow -@parm enum RTL_NP_PROTOCOL | protocol | The protocol to add -@parm ipaddr_t | intIp | Internal IP address -@parm uint32 | intPort | Internal Port -@parm ipaddr_t | extIp | External IP address -@parm uint32 | extPort | External Port -@parm ipaddr_t | remIp | Remote IP address -@parm uint32 | remPort | Remote Port -@parm enum RTL_NP_FLAGS | flags | reserved for future used -@rvalue RTL_SUCCESS | Add success (can be ASIC-accelerated) -@rvalue RTL_SUCCESS | Add success (cannot be ASIC-accelerated) -@rvalue RTL_ERROR_PARAMETER | Error parameter is given -@rvalue RTL_EXIST | Add an existed flow -@rvalue RTL_FAILED | General failure -@comm - Add a NAPT Flow Entry to L4 TCP/UDP NAPT Table(1024-Entry) -@devnote - Insert into ip_nat_setup_info() function in file net/ipv4/netfilter/ip_nat_core.c -*/ -int32 rtl865x_addNaptConnection(rtl865x_napt_entry *naptEntry, rtl865x_priority *prio); -/* -@func enum RTL_RESULT | rtl865x_delNaptConnection | Delete a NAPT Flow -@parm enum RTL_NP_PROTOCOL | protocol | The protocol to delete -@parm ipaddr_t | intIp | Internal IP address -@parm uint32 | intPort | Internal Port -@parm ipaddr_t | extIp | External IP address -@parm uint32 | extPort | External Port -@parm ipaddr_t | remIp | Remote IP address -@parm uint32 | remPort | Remote Port -@rvalue RTL_SUCCESS | Delete success -@rvalue RTL_NONEXIST | Delete a non-existed flow -@rvalue RTL_FAILED | General failure -@comm - Delete a NAPT Flow Entry of L4 TCP/UDP NAPT Table(1024-Entry) -@devnote - Insert into ip_nat_cleanup_conntrack() function in file net/ipv4/netfilter/ip_nat_core.c -*/ -int32 rtl865x_delNaptConnection(rtl865x_napt_entry *naptEntry); - -int32 rtl865x_naptSync(rtl865x_napt_entry *naptEntry, uint32 refresh); - -#if defined (CONFIG_RTL_INBOUND_COLLISION_AVOIDANCE) -int rtl865x_optimizeExtPort(unsigned short origDelta, unsigned int rangeSize, unsigned short *newDelta); - -int rtl865x_getAsicNaptHashScore(rtl865x_napt_entry *naptEntry, - uint32 *naptHashScore); - -int32 rtl865x_preReserveConn(rtl865x_napt_entry *naptEntry); - -#endif -#if defined(CONFIG_RTL_HARDWARE_NAT) -int32 rtl_nat_expire_interval_update(int proto, int32 interval); -int32 rtl865x_nat_reinit(void); -#endif - -#endif - + uint32 protocol; //RTL865X_PROTOCOL_UDP or RTL865X_PROTOCOL_TCP
+ ipaddr_t intIp;
+ uint32 intPort;
+ ipaddr_t extIp;
+ uint32 extPort;
+ ipaddr_t remIp;
+ uint32 remPort;
+}rtl865x_napt_entry;
+
+typedef struct _rtl865x_priority
+{
+ int32 uplinkPrio;
+ int32 downlinkPrio;
+}rtl865x_priority;
+
+typedef struct _rtl865x_qos_mark
+{
+ int32 uplinkMark;
+ int32 downlinkMark;
+}rtl865x_qos_mark;
+
+int32 rtl865x_nat_init(void);
+int32 rtl865x_nat_reinit(void);
+/*
+@func enum RTL_RESULT | rtl865x_addNaptConnection | Add a NAPT Flow
+@parm enum RTL_NP_PROTOCOL | protocol | The protocol to add
+@parm ipaddr_t | intIp | Internal IP address
+@parm uint32 | intPort | Internal Port
+@parm ipaddr_t | extIp | External IP address
+@parm uint32 | extPort | External Port
+@parm ipaddr_t | remIp | Remote IP address
+@parm uint32 | remPort | Remote Port
+@parm enum RTL_NP_FLAGS | flags | reserved for future used
+@rvalue RTL_SUCCESS | Add success (can be ASIC-accelerated)
+@rvalue RTL_SUCCESS | Add success (cannot be ASIC-accelerated)
+@rvalue RTL_ERROR_PARAMETER | Error parameter is given
+@rvalue RTL_EXIST | Add an existed flow
+@rvalue RTL_FAILED | General failure
+@comm
+ Add a NAPT Flow Entry to L4 TCP/UDP NAPT Table(1024-Entry)
+@devnote
+ Insert into ip_nat_setup_info() function in file net/ipv4/netfilter/ip_nat_core.c
+*/
+int32 rtl865x_addNaptConnection(rtl865x_napt_entry *naptEntry, rtl865x_priority *prio);
+/*
+@func enum RTL_RESULT | rtl865x_delNaptConnection | Delete a NAPT Flow
+@parm enum RTL_NP_PROTOCOL | protocol | The protocol to delete
+@parm ipaddr_t | intIp | Internal IP address
+@parm uint32 | intPort | Internal Port
+@parm ipaddr_t | extIp | External IP address
+@parm uint32 | extPort | External Port
+@parm ipaddr_t | remIp | Remote IP address
+@parm uint32 | remPort | Remote Port
+@rvalue RTL_SUCCESS | Delete success
+@rvalue RTL_NONEXIST | Delete a non-existed flow
+@rvalue RTL_FAILED | General failure
+@comm
+ Delete a NAPT Flow Entry of L4 TCP/UDP NAPT Table(1024-Entry)
+@devnote
+ Insert into ip_nat_cleanup_conntrack() function in file net/ipv4/netfilter/ip_nat_core.c
+*/
+int32 rtl865x_delNaptConnection(rtl865x_napt_entry *naptEntry);
+
+int32 rtl865x_naptSync(rtl865x_napt_entry *naptEntry, uint32 refresh);
+
+#if defined (CONFIG_RTL_INBOUND_COLLISION_AVOIDANCE)
+int rtl865x_optimizeExtPort(unsigned short origDelta, unsigned int rangeSize, unsigned short *newDelta);
+
+int rtl865x_getAsicNaptHashScore(rtl865x_napt_entry *naptEntry,
+ uint32 *naptHashScore);
+
+int32 rtl865x_preReserveConn(rtl865x_napt_entry *naptEntry);
+
+#endif
+#if defined(CONFIG_RTL_HARDWARE_NAT)
+int32 rtl_nat_expire_interval_update(int proto, int32 interval);
+int32 rtl865x_nat_reinit(void);
+#endif
+
+#endif
+
diff --git a/target/linux/realtek/files/include/net/rtl/rtl865x_netif.h b/target/linux/realtek/files/include/net/rtl/rtl865x_netif.h index e2c0c956e..415d70266 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl865x_netif.h +++ b/target/linux/realtek/files/include/net/rtl/rtl865x_netif.h @@ -1,10 +1,10 @@ /* -* Copyright c Realtek Semiconductor Corporation, 2008 +* Copyright c Realtek Semiconductor Corporation, 2008 * All rights reserved. -* +* * Program : network interface driver header file -* Abstract : -* Author : hyking (hyking_liu@realsil.com.cn) +* Abstract : +* Author : hyking (hyking_liu@realsil.com.cn) */ #ifndef RTL865X_NETIF_H @@ -28,7 +28,7 @@ #if 1 //def CONFIG_RTL_LAYERED_DRIVER_ACL typedef struct _rtl865x_AclRule_s { - union + union { /* MAC ACL rule */ struct { @@ -36,7 +36,7 @@ typedef struct _rtl865x_AclRule_s ether_addr_t _srcMac, _srcMacMask; uint16 _typeLen, _typeLenMask; } MAC; - + /* IP Group ACL rule */ struct { @@ -50,31 +50,31 @@ typedef struct _rtl865x_AclRule_s { uint8 _proto, _protoMask, _flagMask;// flag & flagMask only last 3-bit is meaning ful uint32 _FOP:1, _FOM:1, _httpFilter:1, _httpFilterM:1, _identSrcDstIp:1, _identSrcDstIpM:1; - union + union { uint8 _flag; - struct + struct { uint8 pend1:5, pend2:1, _DF:1, //don't fragment flag _MF:1; //more fragments flag } s; - } un; - } ip; - + } un; + } ip; + /* ICMP ACL rule */ - struct + struct { uint8 _type, _typeMask, _code, _codeMask; - } icmp; - + } icmp; + /* IGMP ACL rule */ struct { uint8 _type, _typeMask; - } igmp; - + } igmp; + /* TCP ACL rule */ struct { @@ -94,20 +94,20 @@ typedef struct _rtl865x_AclRule_s _syn:1, //sync bit _fin:1; //fin bit }s; - }un; + }un; }tcp; - + /* UDP ACL rule */ - struct + struct { uint16 _srcPortUpperBound, _srcPortLowerBound; - uint16 _dstPortUpperBound, _dstPortLowerBound; - }udp; - }is; - }L3L4; + uint16 _dstPortUpperBound, _dstPortLowerBound; + }udp; + }is; + }L3L4; /* Source filter ACL rule */ - struct + struct { ether_addr_t _srcMac, _srcMacMask; uint16 _srcPort, _srcPortMask; @@ -117,9 +117,9 @@ typedef struct _rtl865x_AclRule_s uint32 _ignoreL4:1, //L2 rule _ignoreL3L4:1; //L3 rule } SRCFILTER; - + /* Destination filter ACL rule */ - struct + struct { ether_addr_t _dstMac, _dstMacMask; uint16 _vlanIdx, _vlanIdxMask; @@ -135,7 +135,7 @@ typedef struct _rtl865x_AclRule_s #endif }un_ty; - + uint32 ruleType_:5, actionType_:4, pktOpApp_:3, @@ -145,17 +145,17 @@ typedef struct _rtl865x_AclRule_s upDown_:1,//0: uplink acl rule for hw qos; 1: downlink acl rule for hw qos #endif nexthopIdx_:5, /* Index of nexthop table (NOT L2 table) */ /* used as network interface index for 865xC qos system */ - ratelimtIdx_:4; /* Index of rate limit table */ /* used as outputQueue index for 865xC qos system */ + ratelimtIdx_:4; /* Index of rate limit table */ /* used as outputQueue index for 865xC qos system */ + - uint32 netifIdx_:3, /*for redirect*/ pppoeIdx_:3, /*for redirect*/ L2Idx_:10, /* Index of L2 table */ inv_flag:8, /*mainly for iptables-->acl rule, when iptables rule has invert netif flag, this acl rule is added to other netifs*/ aclIdx:7; /* aisc entry idx */ - + struct _rtl865x_AclRule_s *pre,*next; - + }rtl865x_AclRule_t; @@ -203,7 +203,7 @@ typedef struct _rtl865x_AclRule_s /* ICMP ACL Rule Definition */ #define icmpType_ un_ty.L3L4.is.icmp._type -#define icmpTypeMask_ un_ty.L3L4.is.icmp._typeMask +#define icmpTypeMask_ un_ty.L3L4.is.icmp._typeMask #define icmpCode_ un_ty.L3L4.is.icmp._code #define icmpCodeMask_ un_ty.L3L4.is.icmp._codeMask @@ -323,6 +323,7 @@ typedef struct _rtl865x_AclRule_s #define RTL865X_ACLTBL_ALL_TO_CPU 127 // This rule is always "To CPU" #define RTL865X_ACLTBL_DROP_ALL 126 //This rule is always "Drop" #define RTL865X_ACLTBL_PERMIT_ALL 125 // This rule is always "Permit" +#define RTL865X_ACLTBL_IPV6_TO_CPU 124 #define MAX_IFNAMESIZE 16 #define NETIF_NUMBER 8 @@ -346,6 +347,12 @@ typedef struct _rtl865x_AclRule_s #define RTL_DRV_LAN_NETIF_NAME "eth0" #endif +#ifdef CONFIG_RTK_VLAN_WAN_TAG_SUPPORT +#define RTL_BR1_NAME "br1" +#define RTL_PS_BR1_DEV_NAME RTL_BR1_NAME +#define RTL_PS_ETH_NAME_ETH2 "eth2" +#endif + #define RTL_DRV_WAN0_NETIF_NAME "eth1" #if defined(CONFIG_RTL_MULTIPLE_WAN) #define RTL_DRV_WAN1_NETIF_NAME "eth6" @@ -359,93 +366,133 @@ typedef struct _rtl865x_AclRule_s #define RTL_DRV_LAN_P4_NETIF_NAME RTL_DRV_WAN0_NETIF_NAME #define RTL_DRV_LAN_P5_NETIF_NAME "eth5" +#if defined(CONFIG_RTK_VLAN_NEW_FEATURE) +#define RTL_DRV_LAN_P7_NETIF_NAME "eth7" +#endif + + /************************************ * const variable defination *************************************/ #define RTL_WANVLANID 8 #define RTL_LANVLANID 9 + #if defined(CONFIG_RTL_MULTIPLE_WAN) #define RTL_WAN_1_VLANID 369 #endif + #if defined(CONFIG_RTL8196_RTL8366) - #define RTL_WANPORT_MASK 0x1C1 - #define RTL_LANPORT_MASK 0x1C1 - #define RTL8366RB_GMIIPORT 0x20 - #define RTL8366RB_LANPORT 0xCf - #define RTL8366RB_WANPORT 0x10 + #define RTL_WANPORT_MASK 0x1C1 + #define RTL_LANPORT_MASK 0x1C1 + #define RTL8366RB_GMIIPORT 0x20 + #define RTL8366RB_LANPORT 0xCf + #define RTL8366RB_WANPORT 0x10 + #elif defined(CONFIG_RTL_819X) && (defined(CONFIG_RTK_VLAN_SUPPORT) || defined (CONFIG_RTL_MULTI_LAN_DEV)) -#if defined (CONFIG_POCKET_ROUTER_SUPPORT) - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x10 -#elif defined(CONFIG_RTL_PUBLIC_SSID) - #define RTL_WANPORT_MASK 0x110 //port 4/port 8 - #define RTL_LANPORT_MASK 0x10f -#elif defined(CONFIG_8198_PORT5_RGMII) - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x12f -#else - #if defined (CONFIG_RTL_8196C_iNIC) - #define RTL_WANPORT_MASK 0x01 - #define RTL_LANPORT_MASK 0x110 //mark_inic , only port4 connect to MII - #elif defined (CONFIG_RTK_INBAND_HOST_HACK) - #if defined (CONFIG_8198_PORT5_GMII) - #define RTL_WANPORT_MASK 0x120 //port5 ,hack port,eth1 - #define RTL_LANPORT_MASK 0x11f // 0~4 port eth0 + #if defined (CONFIG_POCKET_ROUTER_SUPPORT) + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x10 + + #elif defined(CONFIG_RTL_PUBLIC_SSID) + #define RTL_WANPORT_MASK 0x110 //port 4/port 8 + #define RTL_LANPORT_MASK 0x10f + + #elif defined(CONFIG_8198_PORT5_RGMII) + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x12f + #else + #if defined (CONFIG_RTL_8196C_iNIC) + #define RTL_WANPORT_MASK 0x01 + #define RTL_LANPORT_MASK 0x110 //mark_inic, only port4 connect to MII + #elif defined (CONFIG_RTK_INBAND_HOST_HACK) + #if defined (CONFIG_8198_PORT5_GMII) + #define RTL_WANPORT_MASK 0x120 //port5, hack port,eth1 + #define RTL_LANPORT_MASK 0x11f //0~4 port eth0 + #else + #define RTL_WANPORT_MASK 0x110 //port4(port0 in some board) is eth1 + #define RTL_LANPORT_MASK 0x12f //0 1 2 3 5 port are eth0 + #endif + #elif defined (CONFIG_8198_PORT5_GMII) + #define RTL_WANPORT_MASK 0x10 //port0 + #define RTL_LANPORT_MASK 0x12f //all port eth0 + #elif defined (CONFIG_RTL_89xxD) + #define RTL_WANPORT_MASK 0x01 //port0 + #define RTL_LANPORT_MASK 0x11e //all port eth0 + #elif defined (CONFIG_RTL_8196EU) + #define RTL_WANPORT_MASK 0x01f + #define RTL_LANPORT_MASK 0x11f #else - #define RTL_WANPORT_MASK 0x110 //port4(port0 in some board) is eth1 - #define RTL_LANPORT_MASK 0x12f // 0 1 2 3 5 port are eth0 + // 8196e, 8196c are here? + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x10f #endif - #elif defined (CONFIG_8198_PORT5_GMII) - #define RTL_WANPORT_MASK 0x10 //port0 - #define RTL_LANPORT_MASK 0x12f //all port eth0 + #endif + + #if defined(CONFIG_RTL_89xxD) + #define RTL_LANPORT_MASK_1 0x2 //port 1 + #define RTL_LANPORT_MASK_2 0x4 //port 2 + #define RTL_LANPORT_MASK_3 0x8 //port 3 + #define RTL_LANPORT_MASK_4 0x10 //port 4 #else - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x10f - #endif -#endif - #define RTL_LANPORT_MASK_1 0x8 //port 0 - #define RTL_LANPORT_MASK_2 0x4 //port 1 - #define RTL_LANPORT_MASK_3 0x2 //port 2 - #define RTL_LANPORT_MASK_4 0x1 //port 3 + #define RTL_LANPORT_MASK_1 0x8 //port 0 + #define RTL_LANPORT_MASK_2 0x4 //port 1 + #define RTL_LANPORT_MASK_3 0x2 //port 2 + #define RTL_LANPORT_MASK_4 0x1 //port 3 + #endif + #ifdef CONFIG_8198_PORT5_GMII - #define RTL_LANPORT_MASK_5 0x20 //port 5 + #define RTL_LANPORT_MASK_5 0x20 //port 5 #endif + #elif defined(CONFIG_RTL_8198_NFBI_BOARD) - #define RTL_WANPORT_MASK 0x1e0 //port 5, port 6,port 7,port 8 - #define RTL_LANPORT_MASK 0x1df //port 0~4 , port 6~8 , need port4 ?? + #define RTL_WANPORT_MASK 0x1e0 //port 5, port 6,port 7,port 8 + #define RTL_LANPORT_MASK 0x1df //port 0~4 , port 6~8 , need port4 ?? + #elif defined(CONFIG_8198_PORT5_GMII) - #define RTL_WANPORT_MASK 0x110 - #define RTL_LANPORT_MASK 0x1ef + #define RTL_WANPORT_MASK 0x110 + #define RTL_LANPORT_MASK 0x1ef + #elif defined (CONFIG_POCKET_ROUTER_SUPPORT) - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x10 + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x10 + #elif defined(CONFIG_RTL_PUBLIC_SSID) - #define RTL_WANPORT_MASK 0x110 //port 4/port 8 -#elif defined(CONFIG_RTL8186_KB_N) || defined(CONFIG_RTL_819X) /* defined(CONFIG_RTL8196_RTL8366) */ + #define RTL_WANPORT_MASK 0x110 //port 4/port 8 + +#elif defined(CONFIG_RTL8186_KB_N) || defined(CONFIG_RTL_819X) /*defined(CONFIG_RTL8196_RTL8366)*/ #ifdef CONFIG_RTL_8196C_iNIC - #define RTL_WANPORT_MASK 0x01 - #define RTL_LANPORT_MASK 0x110 //mark_inic , only port4 connect to MII + #define RTL_WANPORT_MASK 0x01 + #define RTL_LANPORT_MASK 0x110 //mark_inic, only port4 connect to MII #else - #define RTL_WANPORT_MASK 0x10 - #define RTL_LANPORT_MASK 0x10f + #define RTL_WANPORT_MASK 0x10 + #define RTL_LANPORT_MASK 0x10f #endif + #else #define RTL_WANPORT_MASK 0x01 - #define RTL_LANPORT_MASK 0x11e /* port1/2/3/4/cpu port(port 8) */ + #define RTL_LANPORT_MASK 0x11e /* port1/2/3/4/cpu port(port 8) */ #if defined(CONFIG_RTK_VLAN_SUPPORT) || defined (CONFIG_RTL_MULTI_LAN_DEV) - #define RTL_LANPORT_MASK_1 0x2 //port 1 - #define RTL_LANPORT_MASK_2 0x4 //port 2 - #define RTL_LANPORT_MASK_3 0x8 //port 3 - #define RTL_LANPORT_MASK_4 0x10 //port 4 + #define RTL_LANPORT_MASK_1 0x2 //port 1 + #define RTL_LANPORT_MASK_2 0x4 //port 2 + #define RTL_LANPORT_MASK_3 0x8 //port 3 + #define RTL_LANPORT_MASK_4 0x10 //port 4 #endif -#endif /* defined(CONFIG_RTL8186_KB_N) || defined(CONFIG_RTL_819X) */ +#endif /* defined(CONFIG_RTL8186_KB_N) || defined(CONFIG_RTL_819X) */ -#if defined(CONFIG_RTK_VLAN_SUPPORT) || defined (CONFIG_RTL_MULTI_LAN_DEV) +#if defined(CONFIG_RTK_VLAN_SUPPORT) || defined (CONFIG_RTL_MULTI_LAN_DEV) #if defined(CONFIG_8198_PORT5_GMII) +#if defined(CONFIG_RTK_VLAN_NEW_FEATURE) + #define ETH_INTF_NUM 7 +#else + #define ETH_INTF_NUM 6 +#endif +#else +#if defined(CONFIG_RTK_VLAN_NEW_FEATURE) #define ETH_INTF_NUM 6 #else #define ETH_INTF_NUM 5 #endif +#endif #else #define ETH_INTF_NUM 2 #endif @@ -453,17 +500,17 @@ typedef struct _rtl865x_AclRule_s typedef struct rtl865x_netif_s { uint16 vid; /*netif->vid*/ - uint16 mtu; /*netif's MTU*/ - uint32 if_type:5; /*interface type, 0:ether,1:pppoe....*/ + uint16 mtu; /*netif's MTU*/ + uint32 if_type:5; /*interface type, 0:ether,1:pppoe....*/ ether_addr_t macAddr; uint32 is_wan:1, /*wan interface?*/ dmz:1, /*DMZ/routing lan*/ is_slave:1; /*is slave interface?*/ - uint8 name[MAX_IFNAMESIZE]; + uint8 name[MAX_IFNAMESIZE]; uint16 enableRoute; -#if defined (CONFIG_RTL_LOCAL_PUBLIC) +#if defined (CONFIG_RTL_LOCAL_PUBLIC) ||defined(CONFIG_RTL_MULTIPLE_WAN) uint16 forMacBasedMCast; -#endif +#endif }rtl865x_netif_t; /*internal...*/ @@ -493,6 +540,15 @@ int rtl865x_del_pattern_acl_for_contentFilter(rtl865x_AclRule_t *rule,char *net int32 rtl865x_acl_test(int32 testNo); #endif + +//#define CONFIG_RTL_IPTABLES2ACL_PATCH 1 +#if defined(CONFIG_RTL_IPTABLES2ACL_PATCH) +int32 rtl865x_add_sw_acl(rtl865x_AclRule_t *rule, char *netifName,int32 priority); +int32 _rtl865x_synAclwithAsicTbl(void); +int32 rtl865x_flush_allAcl_sw_fromChain(char *netifName, int32 priority, uint32 flag); +#endif + + int32 rtl865x_deReferNetif(char *ifName); int32 rtl865x_referNetif(char *ifName); int32 rtl865x_setNetifMtu(rtl865x_netif_t *netif); diff --git a/target/linux/realtek/files/include/net/rtl/rtl_nic.h b/target/linux/realtek/files/include/net/rtl/rtl_nic.h index c911b7de9..8f2b212b7 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl_nic.h +++ b/target/linux/realtek/files/include/net/rtl/rtl_nic.h @@ -15,8 +15,11 @@ #define RTL819X_PRIV_IOCTL_ENABLE 1 /* mark_add */ #define CONFIG_RTL_PHY_PATCH 1 #define RTK_QUE 1 -#if defined(CONFIG_NET_WIRELESS_AGN) || defined (CONFIG_RTL8192SE) || defined(CONFIG_RTL8192CD) || defined(CONFIG_RTL8192CD_MODULE) -#define BR_SHORTCUT 1 +#if defined(CONFIG_NET_WIRELESS_AGN) || defined (CONFIG_RTL8192SE) || defined(CONFIG_RTL8192CD) || defined(CONFIG_RTL8192CD_MODULE) || defined(CONFIG_RTL8192E) +#if !defined(CONFIG_RTL_FASTBRIDGE) +#define BR_SHORTCUT 1 +#define BR_SHORTCUT_C2 1 +#endif #endif /* *#define CONFIG_RTL_MULTI_LAN_DEV 1 @@ -106,7 +109,7 @@ struct dev_priv { u32 opened; u32 irq_owner; //record which dev request IRQ struct net_device_stats net_stats; -#if defined(DYNAMIC_ADJUST_TASKLET) || defined(CONFIG_RTL8186_TR) || defined(BR_SHORTCUT) || defined(CONFIG_RTL8196C_REVISION_B) || defined(CONFIG_RTL_8198) +#if defined(DYNAMIC_ADJUST_TASKLET) || defined(CONFIG_RTL8186_TR) || defined(BR_SHORTCUT) || defined(CONFIG_RTL8196C_REVISION_B) || defined(CONFIG_RTL_8198) || defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) struct timer_list expire_timer; #endif @@ -254,7 +257,7 @@ typedef struct _ps_drv_netif_mapping_s int32 rtl865x_changeOpMode(int mode); #if defined(CONFIG_RTL_ETH_PRIV_SKB) -__MIPS16 __IRAM_FWD int is_rtl865x_eth_priv_buf(unsigned char *head); +__MIPS16 __IRAM_FWD int is_rtl865x_eth_priv_buf(unsigned char *head); void free_rtl865x_eth_priv_buf(unsigned char *head); #endif @@ -265,10 +268,14 @@ int rtl_del_ps_drv_netif_mapping(struct net_device *dev); #if defined(CONFIG_RTK_VLAN_SUPPORT) && defined(CONFIG_RTK_VLAN_FOR_CABLE_MODEM) extern struct net_device* get_dev_by_vid(int vid); #endif -extern __MIPS16 struct net_device *get_shortcut_dev(unsigned char *da); +extern __MIPS16 struct net_device *get_shortcut_dev(unsigned char *da); #define CONFIG_RTL_NIC_HWSTATS int32 rtl865x_changeOpMode(int mode); int rtl865x_reChangeOpMode (void); +#if defined(CONFIG_RTL_HW_VLAN_SUPPORT) +extern int rtl_hw_vlan_ignore_tagged_mc; +#endif + #endif diff --git a/target/linux/realtek/files/include/net/rtl/rtl_types.h b/target/linux/realtek/files/include/net/rtl/rtl_types.h index cdd29436e..2b662c5bc 100644 --- a/target/linux/realtek/files/include/net/rtl/rtl_types.h +++ b/target/linux/realtek/files/include/net/rtl/rtl_types.h @@ -243,9 +243,10 @@ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) #include <linux/config.h> #endif -#include <linux/ctype.h> +//#include <linux/ctype.h> #include <linux/module.h> -#include <linux/string.h> +//#include <linux/string.h> + #endif /*__KERNEL__*/ #endif /*__linux__*/ @@ -361,8 +362,8 @@ print macro =============================================================================== */ #if defined(__linux__)&&defined(__KERNEL__) - - #define rtlglue_printf printk + + #define rtlglue_printf panic_printk #else /* defined(__linux__)&&defined(__KERNEL__) */ @@ -418,7 +419,11 @@ typedef struct ether_addr_s { uint8 octet[ETHER_ADDR_LEN]; } ether_addr_t; +#if defined(CONFIG_RTL_ULINKER_BRSC) +#define RX_OFFSET 4 +#else #define RX_OFFSET 2 +#endif #define MBUF_LEN 1700 #define CROSS_LAN_MBUF_LEN (MBUF_LEN+RX_OFFSET+10) @@ -547,12 +552,6 @@ typedef struct ether_addr_s { #define CACHED(addr) ((uint32)(addr) & ~(UNCACHE_MASK)) #endif -#if defined(CONFIG_RTL_PROC_DEBUG) -#define RTL865X_DRIVER_DEBUG_FLAG /*flag for debug*/ -#else -#undef RTL865X_DRIVER_DEBUG_FLAG /*flag for debug*/ -#endif - /* asic configuration */ #define RTL8651_OUTPUTQUEUE_SIZE 6 #define TOTAL_VLAN_PRIORITY_NUM 8 @@ -560,14 +559,102 @@ typedef struct ether_addr_s { #if defined(CONFIG_RTL_8196C) #define CONFIG_RTL8196C_ETH_IOT 1 -#ifdef CONFIG_RTL_WTDOG -#define CONFIG_RTL_8196C_ESD 1 +#ifdef CONFIG_MP_PSD_SUPPORT +#undef CONFIG_RTL8196C_GREEN_ETHERNET +#else +//#define CONFIG_RTL_8196C_ESD 1 #endif #endif -#if defined(CONFIG_RTL_8198) && defined(CONFIG_RTL_WTDOG) +#if defined(CONFIG_RTL_8198) && !defined(CONFIG_RTL_819XD) #define CONFIG_RTL_8198_ESD 1 #endif +#if defined(CONFIG_RTL_8198) +#define RTL8198_EEE_MAC 1 +#endif + +#if defined(CONFIG_RTL_819XD) || defined(CONFIG_RTL_8196E) +#define CONFIG_RTL_8197D_DYN_THR 1 +#endif + +#define DYN_THR_LINK_UP_PORTS 3 + +/* IC default value */ +#define DYN_THR_DEF_fcON 0xac +#define DYN_THR_DEF_fcOFF 0xa0 +#define DYN_THR_DEF_sharedON 0x62 +#define DYN_THR_DEF_sharedOFF 0x4a + +/* aggressive value */ +#define DYN_THR_AGG_fcON 0xd0 +#define DYN_THR_AGG_fcOFF 0xa0 // 0xc0 +#if defined(CONFIG_RTL_819XDT) +#define DYN_THR_AGG_sharedON 0xa0 +#define DYN_THR_AGG_sharedOFF 0x88 +#else +#define DYN_THR_AGG_sharedON 0x88 // 0xc0 +#define DYN_THR_AGG_sharedOFF 0x70 // 0xa8 +#endif + +#if defined(CONFIG_RTL_LOG_DEBUG) +extern int scrlog_printk(const char * fmt, ...); + +extern struct RTL_LOG_PRINT_MASK +{ + uint32 ERROR:1; + uint32 WARN:1; + uint32 INFO:1; +}RTL_LogTypeMask; + +extern struct RTL_LOG_ERROR_MASK +{ + uint32 MEM:1; + uint32 SKB:1; +}RTL_LogErrorMask; +extern uint32 RTL_LogRatelimit; + +extern struct RTL_LOG_MODULE_MASK +{ + uint8 NIC:1; + uint8 WIRELESS:1; + uint8 PROSTACK:1; +}RTL_LogModuleMask; + + +#define LOG_LIMIT (!RTL_LogRatelimit||net_ratelimit()) + + +#define LOG_ERROR(fmt, args...) do{ \ + if(RTL_LogTypeMask.ERROR&&LOG_LIMIT)scrlog_printk("ERROR:"fmt, ## args); \ + }while(0) + +#define LOG_MEM_ERROR(fmt, args...) do{ \ + if(RTL_LogTypeMask.ERROR&&RTL_LogErrorMask.MEM&&LOG_LIMIT)scrlog_printk("ERROR:"fmt, ## args); \ + }while(0) + +#define LOG_SKB_ERROR(fmt, args...) do{ \ + if(RTL_LogTypeMask.ERROR&&RTL_LogErrorMask.SKB&&LOG_LIMIT)scrlog_printk("ERROR:"fmt, ## args); \ + }while(0) + +#define LOG_WARN(fmt, args...) do{ \ + if(RTL_LogTypeMask.WARN&&LOG_LIMIT)scrlog_printk("WARN:"fmt, ## args); \ + }while(0) + +#define LOG_INFO(fmt, args...) do{ \ + if(RTL_LogTypeMask.INFO&&LOG_LIMIT)scrlog_printk("INFO:"fmt, ## args); \ + }while(0) + +#else + +#define LOG_ERROR(fmt, args...) +#define LOG_MEM_ERROR(fmt, args...) +#define LOG_SKB_ERROR(fmt, args...) +#define LOG_WARN(fmt, args...) +#define LOG_INFO(fmt, args...) + +#endif + #endif + |