From 88e20ecdc6b8c4a4663a53fad99407d57845d64c Mon Sep 17 00:00:00 2001 From: hanwckf Date: Mon, 30 Sep 2019 15:24:08 +0800 Subject: [PATCH] mt7615: add hwnat support for 5.0.3.0 driver Need more testing. --- .../boards/DIR-882/kernel-3.4.x-5.0.config | 41 +++++++++++++++++-- .../boards/JCG-AC860M/kernel-3.4.x-5.0.config | 41 +++++++++++++++++-- .../boards/K2P/kernel-3.4.x-5.0.config | 41 +++++++++++++++++-- .../5.0.3.0/mt7615/embedded/common/cmm_cfg.c | 2 +- .../5.0.3.0/mt7615/include/os/rt_linux.h | 4 +- .../rtpci/5.0.3.0/mt7615/os/linux/rt_linux.c | 5 ++- .../5.0.3.0/mt7615/os/linux/rt_profile.c | 3 +- 7 files changed, 123 insertions(+), 14 deletions(-) diff --git a/trunk/configs/boards/DIR-882/kernel-3.4.x-5.0.config b/trunk/configs/boards/DIR-882/kernel-3.4.x-5.0.config index 3d0aeb93c5a..3e4d8503b8f 100644 --- a/trunk/configs/boards/DIR-882/kernel-3.4.x-5.0.config +++ b/trunk/configs/boards/DIR-882/kernel-3.4.x-5.0.config @@ -1971,6 +1971,8 @@ CONFIG_HDR_TRANS_RX_SUPPORT=y # CONFIG_WSC_V2_SUPPORT is not set CONFIG_DOT11W_PMF_SUPPORT=y CONFIG_TXBF_SUPPORT=y +CONFIG_FAST_NAT_SUPPORT=y +# CONFIG_WHNAT_SUPPORT is not set # CONFIG_FTM_SUPPORT is not set # CONFIG_MBO_SUPPORT is not set CONFIG_IGMP_SNOOP_SUPPORT=y @@ -2029,7 +2031,7 @@ CONFIG_MCAST_RATE_SPECIFIC=y CONFIG_VOW_SUPPORT=y CONFIG_BAND_STEERING=y CONFIG_LED_CONTROL_SUPPORT=y -# CONFIG_WLAN_HOOK is not set +CONFIG_WLAN_HOOK=y # CONFIG_RADIUS_ACCOUNTING_SUPPORT is not set # CONFIG_GREENAP_SUPPORT is not set # CONFIG_PCIE_ASPM_DYM_CTRL_SUPPORT is not set @@ -2045,8 +2047,41 @@ CONFIG_MT_MAC=y # # Ralink NAT Acceleration Mode # -CONFIG_RA_NAT_NONE=y -# CONFIG_RA_NAT_HW is not set +# CONFIG_RA_NAT_NONE is not set +CONFIG_RA_NAT_HW=y +CONFIG_RA_HW_NAT=m +CONFIG_HNAT_V2=y +CONFIG_RA_HW_NAT_LAN_VLANID=1 +CONFIG_RA_HW_NAT_WAN_VLANID=2 +CONFIG_RA_HW_NAT_BINDING_THRESHOLD=30 +CONFIG_RA_HW_NAT_QURT_LMT=16383 +CONFIG_RA_HW_NAT_HALF_LMT=16383 +CONFIG_RA_HW_NAT_FULL_LMT=16383 +# CONFIG_RA_HW_NAT_TBL_1K is not set +# CONFIG_RA_HW_NAT_TBL_2K is not set +# CONFIG_RA_HW_NAT_TBL_4K is not set +# CONFIG_RA_HW_NAT_TBL_8K is not set +CONFIG_RA_HW_NAT_TBL_16K=y +# CONFIG_RA_HW_NAT_HASH0 is not set +CONFIG_RA_HW_NAT_HASH1=y +# CONFIG_RA_HW_NAT_HASH2 is not set +# CONFIG_RA_HW_NAT_HASH3 is not set +CONFIG_RA_HW_NAT_TCP_KA=1 +CONFIG_RA_HW_NAT_UDP_KA=1 +CONFIG_RA_HW_NAT_NTU_KA=1 +CONFIG_RA_HW_NAT_UNB_DLTA=3 +CONFIG_RA_HW_NAT_UNB_MNP=1000 +CONFIG_RA_HW_NAT_UDP_DLTA=5 +CONFIG_RA_HW_NAT_TCP_DLTA=5 +CONFIG_RA_HW_NAT_FIN_DLTA=5 +CONFIG_RA_HW_NAT_NTU_DLTA=5 +# CONFIG_RA_HW_NAT_PREBIND is not set +# CONFIG_RA_HW_NAT_IPV6 is not set +# CONFIG_RA_HW_NAT_QDMA is not set +# CONFIG_RA_HW_NAT_MCAST is not set +# CONFIG_RA_HW_NAT_PCI is not set +CONFIG_RA_HW_NAT_WIFI=y +# CONFIG_RA_HW_NAT_DEBUG is not set # # Ralink HW Crypto diff --git a/trunk/configs/boards/JCG-AC860M/kernel-3.4.x-5.0.config b/trunk/configs/boards/JCG-AC860M/kernel-3.4.x-5.0.config index 9ea67f115af..8b39589ceb2 100644 --- a/trunk/configs/boards/JCG-AC860M/kernel-3.4.x-5.0.config +++ b/trunk/configs/boards/JCG-AC860M/kernel-3.4.x-5.0.config @@ -1971,6 +1971,8 @@ CONFIG_HDR_TRANS_RX_SUPPORT=y # CONFIG_WSC_V2_SUPPORT is not set CONFIG_DOT11W_PMF_SUPPORT=y CONFIG_TXBF_SUPPORT=y +CONFIG_FAST_NAT_SUPPORT=y +# CONFIG_WHNAT_SUPPORT is not set # CONFIG_FTM_SUPPORT is not set # CONFIG_MBO_SUPPORT is not set CONFIG_IGMP_SNOOP_SUPPORT=y @@ -2029,7 +2031,7 @@ CONFIG_MCAST_RATE_SPECIFIC=y CONFIG_VOW_SUPPORT=y CONFIG_BAND_STEERING=y CONFIG_LED_CONTROL_SUPPORT=y -# CONFIG_WLAN_HOOK is not set +CONFIG_WLAN_HOOK=y # CONFIG_RADIUS_ACCOUNTING_SUPPORT is not set # CONFIG_GREENAP_SUPPORT is not set # CONFIG_PCIE_ASPM_DYM_CTRL_SUPPORT is not set @@ -2045,8 +2047,41 @@ CONFIG_MT_MAC=y # # Ralink NAT Acceleration Mode # -CONFIG_RA_NAT_NONE=y -# CONFIG_RA_NAT_HW is not set +# CONFIG_RA_NAT_NONE is not set +CONFIG_RA_NAT_HW=y +CONFIG_RA_HW_NAT=m +CONFIG_HNAT_V2=y +CONFIG_RA_HW_NAT_LAN_VLANID=1 +CONFIG_RA_HW_NAT_WAN_VLANID=2 +CONFIG_RA_HW_NAT_BINDING_THRESHOLD=30 +CONFIG_RA_HW_NAT_QURT_LMT=16383 +CONFIG_RA_HW_NAT_HALF_LMT=16383 +CONFIG_RA_HW_NAT_FULL_LMT=16383 +# CONFIG_RA_HW_NAT_TBL_1K is not set +# CONFIG_RA_HW_NAT_TBL_2K is not set +# CONFIG_RA_HW_NAT_TBL_4K is not set +# CONFIG_RA_HW_NAT_TBL_8K is not set +CONFIG_RA_HW_NAT_TBL_16K=y +# CONFIG_RA_HW_NAT_HASH0 is not set +CONFIG_RA_HW_NAT_HASH1=y +# CONFIG_RA_HW_NAT_HASH2 is not set +# CONFIG_RA_HW_NAT_HASH3 is not set +CONFIG_RA_HW_NAT_TCP_KA=1 +CONFIG_RA_HW_NAT_UDP_KA=1 +CONFIG_RA_HW_NAT_NTU_KA=1 +CONFIG_RA_HW_NAT_UNB_DLTA=3 +CONFIG_RA_HW_NAT_UNB_MNP=1000 +CONFIG_RA_HW_NAT_UDP_DLTA=5 +CONFIG_RA_HW_NAT_TCP_DLTA=5 +CONFIG_RA_HW_NAT_FIN_DLTA=5 +CONFIG_RA_HW_NAT_NTU_DLTA=5 +# CONFIG_RA_HW_NAT_PREBIND is not set +# CONFIG_RA_HW_NAT_IPV6 is not set +# CONFIG_RA_HW_NAT_QDMA is not set +# CONFIG_RA_HW_NAT_MCAST is not set +# CONFIG_RA_HW_NAT_PCI is not set +CONFIG_RA_HW_NAT_WIFI=y +# CONFIG_RA_HW_NAT_DEBUG is not set # # Ralink HW Crypto diff --git a/trunk/configs/boards/K2P/kernel-3.4.x-5.0.config b/trunk/configs/boards/K2P/kernel-3.4.x-5.0.config index 549d6ea436e..e90da548f1b 100644 --- a/trunk/configs/boards/K2P/kernel-3.4.x-5.0.config +++ b/trunk/configs/boards/K2P/kernel-3.4.x-5.0.config @@ -1593,6 +1593,8 @@ CONFIG_DEFAULT_5G_PROFILE=y # CONFIG_WSC_V2_SUPPORT is not set CONFIG_DOT11W_PMF_SUPPORT=y CONFIG_TXBF_SUPPORT=y +CONFIG_FAST_NAT_SUPPORT=y +# CONFIG_WHNAT_SUPPORT is not set # CONFIG_FTM_SUPPORT is not set # CONFIG_MBO_SUPPORT is not set CONFIG_IGMP_SNOOP_SUPPORT=y @@ -1648,7 +1650,7 @@ CONFIG_MCAST_RATE_SPECIFIC=y CONFIG_VOW_SUPPORT=y CONFIG_BAND_STEERING=y # CONFIG_LED_CONTROL_SUPPORT is not set -# CONFIG_WLAN_HOOK is not set +CONFIG_WLAN_HOOK=y # CONFIG_RADIUS_ACCOUNTING_SUPPORT is not set # CONFIG_GREENAP_SUPPORT is not set # CONFIG_PCIE_ASPM_DYM_CTRL_SUPPORT is not set @@ -1664,8 +1666,41 @@ CONFIG_MT_MAC=y # # Ralink NAT Acceleration Mode # -CONFIG_RA_NAT_NONE=y -# CONFIG_RA_NAT_HW is not set +# CONFIG_RA_NAT_NONE is not set +CONFIG_RA_NAT_HW=y +CONFIG_RA_HW_NAT=m +CONFIG_HNAT_V2=y +CONFIG_RA_HW_NAT_LAN_VLANID=1 +CONFIG_RA_HW_NAT_WAN_VLANID=2 +CONFIG_RA_HW_NAT_BINDING_THRESHOLD=30 +CONFIG_RA_HW_NAT_QURT_LMT=16383 +CONFIG_RA_HW_NAT_HALF_LMT=16383 +CONFIG_RA_HW_NAT_FULL_LMT=16383 +# CONFIG_RA_HW_NAT_TBL_1K is not set +# CONFIG_RA_HW_NAT_TBL_2K is not set +# CONFIG_RA_HW_NAT_TBL_4K is not set +# CONFIG_RA_HW_NAT_TBL_8K is not set +CONFIG_RA_HW_NAT_TBL_16K=y +# CONFIG_RA_HW_NAT_HASH0 is not set +CONFIG_RA_HW_NAT_HASH1=y +# CONFIG_RA_HW_NAT_HASH2 is not set +# CONFIG_RA_HW_NAT_HASH3 is not set +CONFIG_RA_HW_NAT_TCP_KA=1 +CONFIG_RA_HW_NAT_UDP_KA=1 +CONFIG_RA_HW_NAT_NTU_KA=1 +CONFIG_RA_HW_NAT_UNB_DLTA=3 +CONFIG_RA_HW_NAT_UNB_MNP=1000 +CONFIG_RA_HW_NAT_UDP_DLTA=5 +CONFIG_RA_HW_NAT_TCP_DLTA=5 +CONFIG_RA_HW_NAT_FIN_DLTA=5 +CONFIG_RA_HW_NAT_NTU_DLTA=5 +# CONFIG_RA_HW_NAT_PREBIND is not set +# CONFIG_RA_HW_NAT_IPV6 is not set +# CONFIG_RA_HW_NAT_QDMA is not set +# CONFIG_RA_HW_NAT_MCAST is not set +# CONFIG_RA_HW_NAT_PCI is not set +CONFIG_RA_HW_NAT_WIFI=y +# CONFIG_RA_HW_NAT_DEBUG is not set # # Ralink HW Crypto diff --git a/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/embedded/common/cmm_cfg.c b/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/embedded/common/cmm_cfg.c index 892345b3aad..1a7d66b86f8 100644 --- a/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/embedded/common/cmm_cfg.c +++ b/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/embedded/common/cmm_cfg.c @@ -6023,7 +6023,7 @@ INT set_hnat_register(RTMP_ADAPTER *pAd, RTMP_STRING *arg) MTWF_LOG(DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_OFF, ("\tWDEV %02d:, Name:%s, Wdev(list) Idx:%d\n", idx, RTMP_OS_NETDEV_GET_DEVNAME(wdev->if_dev), wdev->wdev_idx)); MTWF_LOG(DBG_CAT_CFG, DBG_SUBCAT_ALL, DBG_LVL_OFF, ("\t\t Idx:%d\n", RtmpOsGetNetIfIndex(wdev->if_dev))); -#if defined(CONFIG_FAST_NAT_SUPPORT) +#if 0 if (ppe_dev_unregister_hook != NULL && ppe_dev_register_hook != NULL) { diff --git a/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/include/os/rt_linux.h b/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/include/os/rt_linux.h index 5c65393d9cb..8e52646e0ea 100644 --- a/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/include/os/rt_linux.h +++ b/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/include/os/rt_linux.h @@ -282,7 +282,7 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_ #define RTMP_DEC_REF(_A) 0 #define RTMP_GET_REF(_A) 0 -#if defined(CONFIG_FAST_NAT_SUPPORT) +#if 0 #define RT_MOD_HNAT_DEREG(_net_dev) \ do {\ if (ppe_dev_unregister_hook != NULL) \ @@ -1303,8 +1303,10 @@ do{ \ #ifdef CONFIG_FAST_NAT_SUPPORT extern int (*ra_sw_nat_hook_tx)(struct sk_buff *skb, int gmac_no); extern int (*ra_sw_nat_hook_rx)(struct sk_buff *skb); +#if 0 extern void (*ppe_dev_register_hook) (VOID *dev); extern void (*ppe_dev_unregister_hook) (VOID *dev); +#endif #if defined(CONFIG_WIFI_PKT_FWD) || defined(CONFIG_WIFI_PKT_FWD_MODULE) extern int (*wf_ra_sw_nat_hook_tx_bkup)(struct sk_buff *skb, int gmac_no); diff --git a/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/os/linux/rt_linux.c b/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/os/linux/rt_linux.c index 37c5760074e..28322fb46a1 100644 --- a/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/os/linux/rt_linux.c +++ b/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/os/linux/rt_linux.c @@ -48,7 +48,8 @@ #endif /* MEM_ALLOC_INFO_SUPPORT */ #ifdef CONFIG_FAST_NAT_SUPPORT -#include +#include "../../../../../../net/nat/hw_nat/ra_nat.h" +#include "../../../../../../net/nat/hw_nat/frame_engine.h" #endif /*CONFIG_FAST_NAT_SUPPORT*/ /* TODO */ @@ -2398,7 +2399,7 @@ VOID RtmpOsPktNatMagicTag(IN PNDIS_PACKET pNetPkt) { struct sk_buff *pRxPkt = RTPKT_TO_OSPKT(pNetPkt); - FOE_MAGIC_TAG(pRxPkt) = FOE_MAGIC_WLAN; + FOE_MAGIC_TAG(pRxPkt) = FOE_MAGIC_EXTIF; } #endif /*CONFIG_FAST_NAT_SUPPORT*/ diff --git a/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/os/linux/rt_profile.c b/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/os/linux/rt_profile.c index 3ef02e13418..8d52de55e2a 100644 --- a/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/os/linux/rt_profile.c +++ b/trunk/proprietary/rt_wifi/rtpci/5.0.3.0/mt7615/os/linux/rt_profile.c @@ -40,7 +40,8 @@ #ifdef CONFIG_FAST_NAT_SUPPORT -#include +#include "../../../../../../net/nat/hw_nat/ra_nat.h" +#include "../../../../../../net/nat/hw_nat/frame_engine.h" #endif /*CONFIG_FAST_NAT_SUPPORT*/ #define BSSID_WCID_TO_REMOVE 1