Open i3roly opened 3 years ago
i can't say whether it works yet or not because i haven't hooked up router to WAN yet. it should work though, because it's reporting things correctly.
the changes you need to make are the ones i told you earlier (https://github.com/hanwckf/rt-n56u/issues/562#issuecomment-758807334) :
first use DIR882 GPL and find macro for RA_HW_NAT
GagansMacPro:tools Gagan$ grep -rn CONFIG_RA_HW_NAT DIR882_GPL_Release/source/linux-3.10.14.x/net/ --exclude-dir=nat
DIR882_GPL_Release/source/linux-3.10.14.x/net//Makefile:78:obj-$(CONFIG_RA_HW_NAT) += nat/hw_nat/
DIR882_GPL_Release/source/linux-3.10.14.x/net//core/skbuff.c:73:#if defined (CONFIG_RA_HW_NAT) || defined (CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//core/skbuff.c:729:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//core/skbuff.c:1225:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv4/ip_output.c:86:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv4/ip_output.c:431:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv4/ip_output.c:432:#if defined (CONFIG_RA_HW_NAT_PPTP_L2TP)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv4/netfilter/nf_conntrack_l3proto_ipv4.c:33:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv4/netfilter/nf_conntrack_l3proto_ipv4.c:118:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv4/tcp_input.c:78:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv4/tcp_input.c:5085:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv4/udp.c:114:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv4/udp.c:1782:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv6/netfilter/nf_conntrack_l3proto_ipv6.c:36:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//ipv6/netfilter/nf_conntrack_l3proto_ipv6.c:251:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//l2tp/l2tp_core.c:92:#if defined (CONFIG_RA_HW_NAT_PPTP_L2TP)
DIR882_GPL_Release/source/linux-3.10.14.x/net//l2tp/l2tp_core.c:1602:#if defined (CONFIG_RA_HW_NAT_PPTP_L2TP)
DIR882_GPL_Release/source/linux-3.10.14.x/net//l2tp/l2tp_core.c:1725:#if defined (CONFIG_RA_HW_NAT_PPTP_L2TP)
DIR882_GPL_Release/source/linux-3.10.14.x/net//netfilter/nf_conntrack_core.c:54:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//netfilter/nf_conntrack_core.c:1110:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//netfilter/nf_conntrack_core.c:1198:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//xfrm/xfrm_output.c:21:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
DIR882_GPL_Release/source/linux-3.10.14.x/net//xfrm/xfrm_output.c:94:#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)
then use DIRX1865 GPL and replace old RA_HW_NAT macros with new functions:
GagansMacPro:linux-4.4.198 Gagan$ grep -rin hwnat net/ --exclude-dir=nat
net//core/skbuff.c:681: hwnat_set_headroom_zero(skb);
net//core/skbuff.c:682: hwnat_set_tailroom_zero(skb);
net//core/skbuff.c:1161: /*hwnat copy headroom*/
net//core/skbuff.c:1162: hwnat_copy_headroom(data, skb);
net//core/skbuff.c:1163: /*hwnat copy tailroom*/
net//core/skbuff.c:1164: hwnat_copy_tailroom(data, size, skb);
net//core/skbuff.c:1165: /*remove hwnat information to avoid skb reuse causing error binding*/
net//core/skbuff.c:1166: hwnat_set_headroom_zero(skb);
net//core/skbuff.c:1167: hwnat_set_tailroom_zero(skb);
net//ipv4/ip_output.c:464: hwnat_set_l2tp_unhit(iph, skb);
net//ipv4/ip_output.c:465: hwnat_check_magic_tag(skb);
net//ipv4/netfilter/nf_conntrack_l3proto_ipv4.c:115: hwnat_magic_tag_set_zero(skb);
net//ipv4/tcp_input.c:5379: hwnat_magic_tag_set_zero(skb);
net//ipv4/udp.c:2045: hwnat_magic_tag_set_zero(skb);
net//ipv6/netfilter/nf_conntrack_l3proto_ipv6.c:132: /*ipv6 ALG hwnat not binding*/
net//ipv6/netfilter/nf_conntrack_l3proto_ipv6.c:133: hwnat_magic_tag_set_zero(skb);
net//l2tp/l2tp_core.c:1521: hwnat_set_l2tp_fast_path(l2tp_fast_path, pptp_fast_path);
net//l2tp/l2tp_core.c:1661: hwnat_clear_l2tp_fast_path(l2tp_fast_path);
net//xfrm/xfrm_output.c:105: hwnat_magic_tag_set_zero(skb);
it is not very difficult. the bigger thing is now figuring out how to get switch detected so that gphy internal switch is fully functional. right now i have both gmacs working, but the switch isn't going into WAN mode. it assigns itself local ip (192.168.1.1xxx not 192.168.1.1). this is an issue with the driver, not the hw_nat, which seems to work.
@neheb got any tips for why
gsw->ethsys = syscon_regmap_lookup_by_phandle(np, "mediatek,ethsys");
would fail?
dtsi bits are here:
ethernet: ethernet@1e100000 {
compatible = "mediatek,mt7621-eth";
reg = <0x1e100000 0xE000>;
#address-cells = <1>;
#size-cells = <0>;
resets = <&rstctrl 6 &rstctrl 23>;
reset-names = "fe", "eth";
interrupt-parent = <&gic>;
interrupts = <GIC_SHARED 3 IRQ_TYPE_LEVEL_HIGH>;
mediatek,switch = <&gsw>;
mediatek,ethsys = <ðsys>;
mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy1f: ethernet-phy@1f {
reg = <0x1f>;
phy-mode = "rgmii";
};
};
};
gsw: gsw@1e110000 {
compatible = "mediatek,mt7621-gsw";
reg = <0x1e110000 0x8000>;
interrupt-parent = <&gic>;
interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
};
here is the probe function
static int mtk_gsw_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct device_node *pctl;
struct mtk_gsw *gsw;
int err;
const char *pm;
..
gsw->ethsys = syscon_regmap_lookup_by_phandle(np, "mediatek,ethsys");
if (IS_ERR(gsw->ethsys)) {
pr_err("fail at %s %d\n", __func__, __LINE__);
return PTR_ERR(gsw->ethsys);
}
I used these files to replace relevant ones in lede 17.01. Xiaomi router has finished the test but no switch and vlan support.You could test it by using 7615+7615 driver and select K2P board. . Something important is in 02_network and set-irq-affinity.As wireless driver,I only select fast_nat_support because i think whnat is for mt7622 from what I have learned.
[ 21.342765] Ralink HW NAT Module Enabled [ 21.353133] init PpeVirtFoeBase_tmp = a0e00000 [ 21.357585] init ppe_foe_base = a0e00000 [ 21.364705] ppe_dev_reg_handler : ineterface eth0 register (0) [ 21.370622] ppe_set_dst_port :dst_port[0] =eth0 [ 21.375181] ppe_dev_reg_handler : ineterface eth1 register (1) [ 21.381132] ppe_set_dst_port :dst_port[1] =eth1 [ 33.991296] ppe_dev_reg_handler : ineterface rax0 register (2)
eth0 Link encap:Ethernet HWaddr 04:5F:A7:66:70:23 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:964 errors:0 dropped:0 overruns:0 frame:0 TX packets:1630 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:216204 (211.1 KiB) TX bytes:362179 (353.6 KiB)
eth1 Link encap:Ethernet HWaddr 04:5F:A7:66:70:22 inet addr:192.168.5.218 Bcast:192.168.5.255 Mask:255.255.255.0 inet6 addr: fdbc:6636:7575::bfc/128 Scope:Global inet6 addr: fdbc:6636:7575::bfc/128 Scope:Global inet6 addr: fe80::65f:a7ff:fe66:7022/64 Scope:Link inet6 addr: fdbc:6636:7575::65f:a7ff:fe66:7022/64 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1340 errors:0 dropped:54 overruns:0 frame:0 TX packets:1084 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:429887 (419.8 KiB) TX bytes:223857 (218.6 KiB)
https://drive.google.com/file/d/1q0iQHNT4qjr73Oa6GZRPsd3Iu3mtIF5v/view?usp=sharing
I'm relatively out of the loop regarding mediatek's driver. My understanding is that the latest version of their SDK has the latest driver. I could be wrong.
I was asking more about how the syscon regmap phandle function works haha
From: Rosen Penev Sent: Tuesday, 12 January 2021 10:47 PM To: hanwckf/rt-n56u Reply To: hanwckf/rt-n56u Cc: gagan sidhu; Author Subject: Re: [hanwckf/rt-n56u] unlocked ramcodes (#562)
I'm relatively out of the loop regarding mediatek's driver. My understanding is that the latest version of their SDK has the latest driver. I could be wrong.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/hanwckf/rt-n56u/issues/562#issuecomment-759221132, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AITLEGYJM222Z3I63WL3Z33SZUXYTANCNFSM4V35NZEA.
Fast_nat is required, but so is hook_support and whnat_support.
Wifi should not be called by ethernet hw nat. Wifi has its own module mt_hnat that will hook into raeth hw_nat
From: MeIsReallyBa Sent: Tuesday, 12 January 2021 10:11 PM To: hanwckf/rt-n56u Reply To: hanwckf/rt-n56u Cc: gagan sidhu; Author Subject: Re: [hanwckf/rt-n56u] unlocked ramcodes (#562)
I used these files to replace relevant ones in lede 17.01. Xiaomi router have finished the test but no switch and vlan support.You could test it by using 7615+7615 driver and select K2P board. . Something important is in 02_network and set-irq-affinity.As wireless driver,I only select fast_nat_support because i think whnat is for mt7622 from what I have learned.
[ 21.342765] Ralink HW NAT Module Enabled [ 21.353133] init PpeVirtFoeBase_tmp = a0e00000 [ 21.357585] init ppe_foe_base = a0e00000 [ 21.364705] ppe_dev_reg_handler : ineterface eth0 register (0) [ 21.370622] ppe_set_dst_port :dst_port[0] =eth0 [ 21.375181] ppe_dev_reg_handler : ineterface eth1 register (1) [ 21.381132] ppe_set_dst_port :dst_port[1] =eth1 [ 33.991296] ppe_dev_reg_handler : ineterface rax0 register (2)
eth0 Link encap:Ethernet HWaddr 04:5F:A7:66:70:23 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:964 errors:0 dropped:0 overruns:0 frame:0 TX packets:1630 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:216204 (211.1 KiB) TX bytes:362179 (353.6 KiB)
eth1 Link encap:Ethernet HWaddr 04:5F:A7:66:70:22 inet addr:192.168.5.218 Bcast:192.168.5.255 Mask:255.255.255.0 inet6 addr: fdbc:6636:7575::bfc/128 Scope:Global inet6 addr: fdbc:6636:7575::bfc/128 Scope:Global inet6 addr: fe80::65f:a7ff:fe66:7022/64 Scope:Link inet6 addr: fdbc:6636:7575::65f:a7ff:fe66:7022/64 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1340 errors:0 dropped:54 overruns:0 frame:0 TX packets:1084 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:429887 (419.8 KiB) TX bytes:223857 (218.6 KiB)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/hanwckf/rt-n56u/issues/562#issuecomment-759209497, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AITLEG7OFVYBB7DKMD4HGJDSZUTQHANCNFSM4V35NZEA.
Fast_nat is required, but so is hook_support and whnat_support. Wifi should not be called by ethernet hw nat. Wifi has its own module mt_hnat that will hook into raeth hw_nat From: MeIsReallyBa Sent: Tuesday, 12 January 2021 10:11 PM To: hanwckf/rt-n56u Reply To: hanwckf/rt-n56u Cc: gagan sidhu; Author Subject: Re: [hanwckf/rt-n56u] unlocked ramcodes (#562) I used these files to replace relevant ones in lede 17.01. Xiaomi router have finished the test but no switch and vlan support.You could test it by using 7615+7615 driver and select K2P board. . Something important is in 02_network and set-irq-affinity.As wireless driver,I only select fast_nat_support because i think whnat is for mt7622 from what I have learned. [ 21.342765] Ralink HW NAT Module Enabled [ 21.353133] init PpeVirtFoeBase_tmp = a0e00000 [ 21.357585] init ppe_foe_base = a0e00000 [ 21.364705] ppe_dev_reg_handler : ineterface eth0 register (0) [ 21.370622] ppe_set_dst_port :dst_port[0] =eth0 [ 21.375181] ppe_dev_reg_handler : ineterface eth1 register (1) [ 21.381132] ppe_set_dst_port :dst_port[1] =eth1 [ 33.991296] ppe_dev_reg_handler : ineterface rax0 register (2) eth0 Link encap:Ethernet HWaddr 04:5F:A7:66:70:23 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:964 errors:0 dropped:0 overruns:0 frame:0 TX packets:1630 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:216204 (211.1 KiB) TX bytes:362179 (353.6 KiB) eth1 Link encap:Ethernet HWaddr 04:5F:A7:66:70:22 inet addr:192.168.5.218 Bcast:192.168.5.255 Mask:255.255.255.0 inet6 addr: fdbc:6636:7575::bfc/128 Scope:Global inet6 addr: fdbc:6636:7575::bfc/128 Scope:Global inet6 addr: fe80::65f:a7ff:fe66:7022/64 Scope:Link inet6 addr: fdbc:6636:7575::65f:a7ff:fe66:7022/64 Scope:Global UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:1340 errors:0 dropped:54 overruns:0 frame:0 TX packets:1084 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:429887 (419.8 KiB) TX bytes:223857 (218.6 KiB) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<#562 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AITLEG7OFVYBB7DKMD4HGJDSZUTQHANCNFSM4V35NZEA.
Wifi hardware nat wouldn't work if I i didn't excute"iwpriv rax0 set hw_nat_register=1" during my test.
confirmed, wifi hardware nat is working!:
root@DD-WRT:~# iwpriv rai0 set hw_nat_register=1
root@DD-WRT:~# tail /var/log/messages -n25
Dec 27 11:29:11 DD-WRT user.warn kernel: Device Instance
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 00:, Name:rai0, Wdev(list) Idx:0
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:5
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 01:, Name:wdsi0, Wdev(list) Idx:1
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:20
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 02:, Name:wdsi1, Wdev(list) Idx:2
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:21
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 03:, Name:wdsi2, Wdev(list) Idx:3
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:22
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 04:, Name:wdsi3, Wdev(list) Idx:4
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:23
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 05:, Name:wdsi4, Wdev(list) Idx:5
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:24
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 06:, Name:wdsi5, Wdev(list) Idx:6
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:25
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 07:, Name:wdsi6, Wdev(list) Idx:7
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:26
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 08:, Name:wdsi7, Wdev(list) Idx:8
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:27
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 09:, Name:wdsi8, Wdev(list) Idx:9
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:28
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 10:, Name:wdsi9, Wdev(list) Idx:10
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:29
Dec 27 11:29:11 DD-WRT user.warn kernel: WDEV 11:, Name:apclii0, Wdev(list) Idx:11
Dec 27 11:29:11 DD-WRT user.warn kernel: Idx:30
but i still need to get eth2 into wan mode.
i noticed i screwed up one dts entry (it should be wan_at, not wan-at). now there is no faulty dhcp being assigned, but eth2 cannot be added to bridge since it is not in switch mode.
maybe mt_whnat module isn't needed with hw_nat. i think you're right. lsmod says it is not in use. not sure what is point of mt_wifi/embedded/plug_in/whnat, then
@MeIsReallyBa are you also using wifi_pkt_forward or just fast_nat support for mt_wifi? i thought config_hnat_support (wifi hnat module) was required but it seems not
just fast_nat support.And why do you use dd-wrt instead of openwrt?
k. are you using CONFIG_RA_HW_NAT_WIFI_NEW_ARCH ?
k. are you using CONFIG_RA_HW_NAT_WIFI_NEW_ARCH ?
all the setting could be seen in the "raeth.zip" that I uploaded.
i like the nvram/httpd interface of dd-wrt more than openwrt. i find the dd-wrt httpd gui to visually pleasing, and i like that i can change all things from there. it's also system-v init and not systemd. i don't like system d. all in all i find it to be closer to unix than openwrt.
i think openwrt no longer uses nvram-based settings either? i could be wrong. i am not familiar with how it does things. they split from eachother a while back
where is the zip?
i like the nvram/httpd interface of dd-wrt more than openwrt. i find the dd-wrt httpd gui to visually pleasing, and i like that i can change all things from there. it's also system-v init and not systemd. i don't like system d. all in all i find it to be closer to unix than openwrt.
i think openwrt no longer uses nvram-based settings either? i could be wrong. i am not familiar with how it does things. they split from eachother a while back
where is the zip?
https://github.com/hanwckf/rt-n56u/issues/562#issuecomment-759209497
gotcha. thanks. it seems i have to figure out how to get the switch detected and then we should be good to go.
is there any way to extract dts from firmware image? i want to see DLINK DIRX1860's dts for raeth configuration
is there any way to extract dts from firmware image? i want to see DLINK DIRX1860's dts for raeth configuration
All the 7621+7915 routers are using MTK ethernet driver instead of raeth.
i recommend using raeth driver... it doesn't require any modification and works relatively easily with hw_nat from linux dir. i am surprisedyou got hw_nat.ko to work with mtk ethernet driver. it's up to you though. i have to add some code to raeth to fix ethernet mac addresses but not too big of a deal.
raeth driver has worked correctly and I tested it's performance that is close to padavan.But there seems no switch vlan support from the information that ra_switch.c shows.
that's what i am having issue with. it is not picking up switch right now. so you're using mtk driver because it detects switch etc? performance is close to padavan?
is dirx1860 stock fw also using mtk driver? maybe raeth is still work in progress for mt7621
that's what i am having issue with. it is not picking up switch right now. so you're using mtk driver because it detects switch etc? performance is close to padavan?
is dirx1860 stock fw also using mtk driver? maybe raeth is still work in progress for mt7621
please look at dts that i have uploaded.I dont't use any mtk ethernet or switch driver.
The first time I tried raeth,the system works even though ragsw don't probe correctly .So I guess ur eth2 issue may be caused by other things.
oh so you are using raeth? i thought from post https://github.com/hanwckf/rt-n56u/issues/562#issuecomment-759606818 you meant you were using the mtk driver, but i think you're saying the stock fw uses it? how come you didn't use it?
right now i'm not setting both gmac to force-1000. i am trying to copy old-style raeth configuration. gmac2 (ge2) should be internal_an, and gmac1 should be force_1200 (or 1000).
i didn't think to put both on 1000.
I am using raeth and everything works right now except for switch and vlan.
gsw should be probed. it's bugging me haha.
yes i think if you set both to force1000 then just all eth ports are combined into one for lan and then other eth port is wan. but in proper setup eth2 should be wan and eth3 should be switch with ability to add vlan etc
I'm not familiar with gsw.I just used the reath dts from dlink x1860 GPL code directly.
i will look into it today.
btw: which device uses 7621 and 4:4 AX radios?! i didn't know it existed! i should work on that router too!
None.7621 is too weak to afford 4x4 wifi.
also,I think wan should be eth3 instead of eth2?eth1 works as wan in openwrt.
init_pseudo is using dev2_name so you're right
my 882 is 4x4 and on 7621, but i get what you're saying. more cores or or more mhz are required
we made dlink x1860 work with OpenWrt HEAD today using mt76. will be in trunk in a couple of days the MTK SDK uses a hack to make use of 2 pci/e ports, that feature should be ready shortly. the hnat inside mt7621/3 cannot do wireless offload. mt7622 is trhe first SoC where whnat is possible. I saw in the x1860 GPL, that they seem to have made it work. my current guess is that they take raw frames coming from wifi and pump them into the switch via the 2nd cpu port and then use the wired hnat to do the offload.
@blogic it seems they're reworking raeth for 4.x and above. and yeah that's exactly what it seems to be doing. i'm surprised he's getting full performance with both in FORCE_1000 mode though. it seems strange since there is an entire GSW being ignored.
i just want full performance. i have all code paths and i get low throughput. it's embarrassing. the missing switch should be an easy fix. from what i can see it's a failed call to syscon_regmap_lookup_by_phandle:
static int mtk_gsw_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct device_node *pctl;
struct mtk_gsw *gsw;
int err;
const char *pm;
gsw = devm_kzalloc(&pdev->dev, sizeof(struct mtk_gsw), GFP_KERNEL);
if (!gsw)
return -ENOMEM;
gsw->dev = &pdev->dev;
gsw->trgmii_force = 2000;
gsw->irq = irq_of_parse_and_map(np, 0);
if (gsw->irq < 0)
return -EINVAL;
err = of_property_read_string(pdev->dev.of_node, "mcm", &pm);
if (!err && !strcasecmp(pm, "enable")) {
gsw->mcm = true;
pr_info("== MT7530 MCM ==\n");
}
gsw->ethsys = syscon_regmap_lookup_by_phandle(np, "mediatek,ethsys");
if (IS_ERR(gsw->ethsys)) {
pr_err("fail at %s %d\n", __func__, __LINE__);
return PTR_ERR(gsw->ethsys);
}
where this is the dtsi:
ethsys: syscon@1e000000 {
compatible = "mediatek,mt7621-ethsys",
"mediatek,ethsys",
"syscon";
reg = <0x1e000000 0x1000>;
#clock-cells = <1>;
};
pcie_mirror: pcie_mirror@10000400 {
compatible = "mediatek,pcie-mirror";
reg = <0 0x10000400 0 0x10>;
};
wed: wed@1020b000 {
compatible = "mediatek,wed";
mediatek,ethsys = <ðsys>;
status = "disabled";
};
ethernet: ethernet@1e100000 {
compatible = "mediatek,mt7621-eth";
reg = <0x1e100000 0xE000>;
#address-cells = <1>;
#size-cells = <0>;
resets = <&rstctrl 6 &rstctrl 23>;
reset-names = "fe", "eth";
interrupt-parent = <&gic>;
interrupts = <GIC_SHARED 3 IRQ_TYPE_LEVEL_HIGH>;
mediatek,switch = <&gsw>;
mediatek,ethsys = <ðsys>;
mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
phy1f: ethernet-phy@1f {
reg = <0x1f>;
phy-mode = "rgmii";
};
};
};
gsw: gsw@1e110000 {
compatible = "mediatek,mt7621-gsw";
reg = <0x1e110000 0x8000>;
mediatek,mcm;
resets = <ðsys>;
reset-names = "mcm";
interrupt-parent = <&gic>;
interrupts = <GIC_SHARED 23 IRQ_TYPE_LEVEL_HIGH>;
};
any idea why this would fail? i looked at qcom-ipq8064.dtsi and it seems to be similar. it's very strange. i just want 1gbit plus performacne lol
we made dlink x1860 work with OpenWrt HEAD today using mt76. will be in trunk in a couple of days the MTK SDK uses a hack to make use of 2 pci/e ports, that feature should be ready shortly. the hnat inside mt7621/3 cannot do wireless offload. mt7622 is trhe first SoC where whnat is possible. I saw in the x1860 GPL, that they seem to have made it work. my current guess is that they take raw frames coming from wifi and pump them into the switch via the 2nd cpu port and then use the wired hnat to do the offload.
7621 wifi offload seems to be achieved as what you said since MTK linux 3.10 SDK. So is there any plan to support 7621 wifi offload in openwrt? https://github.com/hanwckf/rt-n56u/blob/master/trunk/proprietary/rt_ppe/hw_nat/ra_nat.c
why are you using gsw and not mt7530/1 dsa ? I'd opt for figuring out why upstream dont work, rather than using hacky vendor code. I have gone that road too often 😁.
What HW are you on ?
BTW mtk hnat support for the wired part went upstream in v5.10.
why are you using gsw and not mt7530/1 dsa ? I'd opt for figuring out why upstream dont work, rather than using hacky vendor code. I have gone that road too often 😁.
What HW are you on ?
BTW mtk hnat support for the wired part went upstream in v5.10.
@blogic i am still using the flow_offload version of the mtk_eth_soc.c driver that gives me hardware nat, but this won't give me full performance from the wifi-side. so wired hnat isn't a concern. i have that and it works good.
i'm on a DIR882 A1.
from what i've gathered in this discussion, there's no way i'm gonna hit 1gbit over wifi on this platform without having the wifi packets pumped through the nat.
i do use the dsa/7530 for my "working build". right now i'm trying to see if this raeth driver will give me full performance, and so i'm trying to solve the riddle for why the switch isn't getting picked up via syscon_regmap_lookup_by_phandle
oncern. i have that and it works good.
i'm on a DIR882 A1.
from what i've gathered in this discussion, there's no way i'm gonna hit 1gbit over wifi on this platform without having the wifi packets pumped through the nat.
i do use the dsa/7530 for my "working build". right now i'm trying to s
7621+7615 could only hit 850Mbps in padavan .And I only hit 800Mbps in lede17.01 with raeth hwnat. So I think hitting 1gbit over wifi is impossible.
well, i'll take that as a start. but it should be higher. it's rated ac2300 or something like that
i'm beginning to wonder if wifi_pkt_fwd is part of this equation. i asked about this almost one year ago: https://github.com/hanwckf/rt-n56u/issues/275
@i3roly currently have x1860 on my desk and we are working on maxing it out using latest upstream...
@blogic that's great, and i'm excited. but it's not as fast as an 882, but yes i understand if you can max it out then it's hopeful for my case.
right now i have 4x4 radios that haven't yet hit their potential and it's frustrating. all the while brainslayer is laughing and patting his beloved atheros radios gently
@blogic that's great, and i'm excited. but it's not as fast as an 882, but yes i understand if you can max it out then it's hopeful for my case.
right now i have 4x4 radios that haven't yet hit their potential and it's frustrating. all the while brainslayer is laughing and patting his beloved atheros radios gently
Forwarding data from the cpu to the switch to achieve wifi nat acceleration is the most important issue now. But currently only the SDK driver achieves this
@i3roly brainsalyer is my favorite goth ;) its a love/hate relation :-D
@blogic he loves robert smith so he's pretty alright. a bit curmudgeonly, but alright nonetheless.
@i3roly LoL
@meisreallyba i think i figured it out. you just need to comment out:
static int mtk_gsw_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
//struct device_node *pctl;
struct mtk_gsw *gsw;
...
/*
if (!gsw->mcm) {
...
if (gsw->mcm) {
gsw->b3v = devm_regulator_get(&pdev->dev, "b3v");
if (IS_ERR(gsw->b3v))
return PTR_ERR(gsw->b3v);
}
*/
} now i can add vlans to eth3:
root@DD-WRT:~# vconfig add eth3 2
root@DD-WRT:~# cat /proc/net/vlan/config
VLAN Dev name | VLAN ID
Name-Type: VLAN_NAME_TYPE_PLUS_VID_NO_PAD
vlan1 | 1 | eth3
vlan2 | 2 | eth3
and add
mediatek,switch = <&gsw>;
mediatek,ethsys = <ðsys>;
to the gsw node in the dtsi. it should detect fine. i am going to test it in a second here.
and i see no error about failing to detect gsw... this looks promising.
root@DD-WRT:~# vconfig add eth2 1
root@DD-WRT:~# brctl addif br0 eth2
root@DD-WRT:~# ifco^C
root@DD-WRT:~# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.74dadacb59b0 no eth2
eth3
ra0
rai0
vlan1
root@DD-WRT:~# ./switch dump
hash port(0:6) fid vid age mac-address filter my_mac
298: ---- -1-- 0 2 102 74dadacb59af - -
2e0: ---- --1- 0 1 147 74dadacb59b2 - -
2e4: ---- -1-- 0 2 30 74dadacb59b0 - -
2e8: ---- --1- 0 1 149 74dadacb59b0 - -
730: ---1 ---- 0 1 148 406c8fb8c9d2 - -
73c: ---- -1-- 0 2 131 406c8fb8c9d2 - -
found the last entry 6 (not ready)
probably hard for my bros across the pond not to get a little emotional, seeing their 20 year old programs still kickin in the new era. HOW FUCKING DOPE RA'S SWITCH PROGRAM WORKS ON THE NEW RA ETH @MeIsReallyBa
aighttt fam @Meisreallyba, bout to plug this sucker into the wan, homie.
root@DD-WRT:~# switch vlan dump
vid fid portmap s-tag
1 0 1-----1- 0
2 0 -1----1- 0
3 0 --1---1- 0
4 0 ---1--1- 0
5 0 ----1-1- 0
6 0 ----111- 0
7 0 1111-11- 0
8 0 ----1-1- 0
9 0 invalid
10 0 invalid
11 0 invalid
12 0 invalid
13 0 invalid
14 0 invalid
15 0 invalid
16 0 invalid
switch dumroot@DD-WRT:~# switch dump
hash port(0:6) fid vid age mac-address filter my_mac
728: ---1 ---- 0 7 148 406c8fb8c9d2 - -
found the last entry 1 (not ready)
IT'S LOOKING GOOD!
I didn't edit ra_switch.c and just add something in dtsi.
raeth: raeth@1e100000 { compatible = "mediatek,mt7621-eth"; reg = <0x1e100000 0xE000>;
interrupt-parent = <&gic>;
interrupts = <GIC_SHARED 3 IRQ_TYPE_LEVEL_HIGH>;
mediatek,ethsys = <ðsys>;
mediatek,switch = <&raethgsw>;
status = "disabled";
};
raethgsw: raethgsw {
compatible = "mediatek,mt7621-gsw";
mediatek,ethsys = <ðsys>;
mcm= "enable";
};
so you have the switch getting detected now?
i think i'm using the wrong switch settings but maybe my hack for raeth isn't a good one
ok @hanwckf
i know you guys are holding out on us ok. there is no way you aren't.
both the mt76 driver (when i did get vht160 stable enough to run speedtest a few times) AND the proprietary driver seem to never pass 400 Mbps down, or 500 Mbps upload.
literally right when it hits about ~400 Mbps, it starts to throttle down and seems to top out around 371Mbps.
it is highly unusual both drivers yield very similar performance that is far below the specification and capabilities of the driver. this would explain why the factory firmware from dlink is encrypted (if i recall correctly) and also you cannot access terminal via serial.
i understand why these unlocked ramcodes aren't public, but please be considerate. i have been supporting this platform for a few years and now all that's missing is the full performance. there is no way that two drivers can yield the same performance cap if it is not being done artificially at the driver (or ram code, is my guess) level.