#include #include #include #include #include "ethctl_implement.h" #include #ifdef CONFIG_RTL8672 #if defined(CONFIG_DEFAULTS_KERNEL_3_18) #include #else #include #endif #endif #ifdef CONFIG_RTK_HOST_SPEEDUP #include "../../net/ipv4/ip_speedup.h" #endif #ifdef CONFIG_EXT_SWITCH #include "./rtl8306/Rtl8306_types.h" #ifdef CONFIG_RE8306_API #ifdef CONFIG_ETHWAN #include "./rtl8306/rtl8306e_asicdrv.h" #include "./rtl8306/rtk_api.h" #endif //CONFIG_ETHWAN #endif // of CONFIG_RE8306_API #endif // of CONFIG_EXT_SWITCH #ifdef CONFIG_RTL8676_Dynamic_ACL extern int rtl8676_clean_L34Unicast_hwacc(void); #endif #ifdef CONFIG_RTL8672NIC #include "re830x.h" #include "re867x.h" #include "re_smi.h" #include "re_igmp.h" #define test_len 500 extern int re8670_start_xmit (struct sk_buff *skb, struct net_device *dev); extern unsigned int eth_rx_count; extern unsigned int iocmd_reg; extern struct net_device *eth_net_dev; struct timer_list rxtest_timer; unsigned char rxtest_running=0; struct sk_buff testskb; unsigned char testskbdata[test_len]; void show_rx(void){ //printk("ethernet rx count:%d\n",eth_rx_count); //rxtest_running=0; if(rxtest_running==0) return; printk("time out!\n"); rxtest_timer.expires=jiffies+HZ; rxtest_timer.function=(void (*)(unsigned long))show_rx; eth_rx_count=0; add_timer(&rxtest_timer); } #ifdef CONFIG_EXT_SWITCH void dump_vlan_info(void) // Kaohj --- dump VLAN info (rtl8305_info) { int i; printk("phy num=%d; vlan num=%d, enabled=%d\n\n", MAX_SWITCH_PORT+4, VLAN_NUM, rtl8305_info.vlan_en); printk("phy info:\n"); printk("phy vlanIndex\n"); for (i=0; i #include "rtl819x/AsicDriver/rtl865x_asicCom.h" #include "rtl819x/AsicDriver/rtl865x_asicL2.h" #include "rtl8367b/port.h" extern int global_probe_extPhy; #endif #ifdef CONFIG_NF_CONNTRACK extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report); #endif void eth_ctl(struct eth_arg * arg){ unsigned char cmd1; unsigned int cmd2,cmd3; unsigned short cmd4; unsigned int cmd5; struct net_device *dev; #ifdef CONFIG_RTL8672NIC unsigned int i; struct skb_shared_info skbshare; #endif #if defined(CONFIG_RTL_819X_SWCORE) && defined(CONFIG_RTL_8367B) unsigned int data; #endif cmd1=arg->cmd; cmd2=arg->cmd2; cmd3=arg->cmd3; cmd4=(unsigned short)arg->cmd4; cmd5 = arg->cmd5; switch(cmd1){ #ifdef CONFIG_RTL8672NIC case 1: //tx for(i=0;icmd3=update_watchdog_timer();//for kick cycle time update in watchdog task break; case 2: //enable hw watchdog start_watchdog(cmd3); break; case 3: //disable hw watchdog stop_watchdog(); break; case 4: //set watchdog kick time set_watchdog_kick_time(cmd3); break; case 5: //get watchdog status get_watchdog_status(); break; case 6: //set watchdog timeout time set_watchdog_timeout_time(cmd3); break; } #endif break; }; #ifdef CONFIG_GPIO_LED_CHT_E8B case 15: g_internet_up = 1; break; case 16: g_internet_up = 0; break; #endif case 21: // conntrack killall //drop_all_conntrack(); /*linux-2.6.19*/ //ip_conntrack_flush(); #ifdef CONFIG_NF_CONNTRACK nf_conntrack_flush_report(&init_net,0,0); #endif /*CONFIG_NETFILTER*/ #ifdef CONFIG_RTL8676_Dynamic_ACL rtl8676_clean_L34Unicast_hwacc(); #endif break; // Kaohj #ifdef CONFIG_EXT_SWITCH #ifdef CONFIG_RE8306_API case 26: // dump 8306 qos dump_8306_qos(); break; case 27: // reset 8306 mib counters reset_8306_counter(); break; case 28: // dump 8306 mib counters dump_8306_counter(); break; #endif case 29: // dump vlan info dump_vlan_info(); break; case 30: // dump igmp info dump_igmp_info(); break; #endif // of CONFIG_EXT_SWITCH #ifdef CONFIG_RTL8672NIC case 31: //polling switch's port link status at user space for e8b case. miiar_read(arg->cmd2, 1, &cmd4); if(cmd4&4) arg->cmd=1; else arg->cmd=0; break; case 40: if (cmd2 == 1) { // igmp if (cmd3 > 0) debug_igmp = 1; else debug_igmp = 0; } break; #endif case 41: // nic phy power up //printk("Enable NIC phy\n"); if(!IS_RTL8676) { cmd2 = *(volatile u32*)(BSP_IP_SEL); cmd2 &= 0xfbffffff; // bit-26: Power down IntPhy PCS *(volatile u32*)(BSP_IP_SEL) = cmd2; } break; case 42: // nic phy power down //printk("Disable NIC phy\n"); if(!IS_RTL8676) { cmd2 = *(volatile u32*)(BSP_IP_SEL); cmd2 |= 0x04000000; // bit-26: Power down IntPhy PCS *(volatile u32*)(BSP_IP_SEL) = cmd2; } break; #if defined(CONFIG_EXT_SWITCH) && defined(CONFIG_RE8306_API) && defined(CONFIG_ETHWAN) case 43: printk("--- switch8306info ---\n"); switch8306info(); break; case 44: printk("--- switch8306alive ---\n"); switch8306alive(); break; case 45: //0:disable, 1:all, 2:tx, 3:rx debug_enable = cmd2; printk("set debug_enable to %d\n", debug_enable); break; case 46: if(cmd2 == 0){//reset reset_rtk8306_igrAcl_rule_by_user(); printk("reset sip port\n"); } else if(cmd2 == 1){//set port add_rtk8306_igrAcl_rule_by_user(arg->cmd3); printk("set sip/rtp port %d \n",arg->cmd3); } break; #endif case 50: if(cmd2==1){ printk("enable ipqos!!!\n"); enable_ipqos=1; } else{ printk("disable ipqos!!!\n"); enable_ipqos=0; } break; #if defined(CONFIG_RTL_819X_SWCORE) && defined(CONFIG_RTL_8367B) case 51: //read mac if (RTL8676_TBLASIC_EXTPHYPROPERTY_PORT0_RTL8367B == global_probe_extPhy) { RL6000_read(cmd2, &data); printk("rtl8367b read REG0x%x: 0x%04X\n", cmd2, data); } else printk("rtl8367b is not detected!\n"); break; case 52: //write mac if (RTL8676_TBLASIC_EXTPHYPROPERTY_PORT0_RTL8367B == global_probe_extPhy) { data = (cmd3&0xffff); RL6000_write(cmd2, data); printk("rtl8367b write REG0x%x: 0x%04X\n", cmd2, data); RL6000_read(cmd2, &data); printk("rtl8367b read REG0x%x: 0x%04X\n", cmd2, data); } else printk("rtl8367b is not detected!\n"); break; #endif case 53: //enable_usb0_wan dev = dev_get_by_name(&init_net,"usb0"); if(dev==NULL) { printk("Error ! can't find usb0 device\n"); return; } if(cmd2==1){ printk("Enable Wan flag for usb0\n"); dev->priv_flags |= IFF_DOMAIN_WAN; } else{ printk("Disable Wan flag for usb0\n"); dev->priv_flags &= ~IFF_DOMAIN_WAN; } dev_put(dev); break; case 54://change nas0 carrier dev = dev_get_by_name(&init_net,"nas0"); if (dev == NULL) { printk("Error ! can't find usb0 device\n"); return; } if (cmd2 == 1)//carrier on { if (!netif_carrier_ok(dev)) { netif_carrier_on(dev); } } else if (cmd2 == 0)//carrier off { if (netif_carrier_ok(dev)) { netif_carrier_off(dev); } } else { if (netif_carrier_ok(dev)) printk("nas0 carrier on\n"); else printk("nas0 carrier off\n"); } dev_put(dev); break; #ifdef CONFIG_RTK_HOST_SPEEDUP case 55://get hostspeedup stream stats { unsigned int sip, dip; unsigned short sport, dport; sip = cmd2; dip = cmd3; sport = cmd4; dport = cmd5; arg->cmd2 = HostSpeedUP_Stat_get(dip, sip, dport, sport); } break; #endif default: printk("error cmd\n"); } }