kernel: replace <net/ra_nat.h> to "net/nat/hw_nat/ra_nat.h"
This commit is contained in:
324
trunk/linux-4.4.x/include/net/ra_nat.h
Normal file → Executable file
324
trunk/linux-4.4.x/include/net/ra_nat.h
Normal file → Executable file
@ -1,54 +1,17 @@
|
|||||||
/******************************************************************************
|
/* Copyright 2016 MediaTek Inc.
|
||||||
*
|
* Author: Nelson Chang <nelson.chang@mediatek.com>
|
||||||
* This file is provided under a dual license. When you use or
|
* Author: Carlos Huang <carlos.huang@mediatek.com>
|
||||||
* distribute this software, you may choose to be licensed under
|
* Author: Harry Huang <harry.huang@mediatek.com>
|
||||||
* version 2 of the GNU General Public License ("GPLv2 License")
|
|
||||||
* or BSD License.
|
|
||||||
*
|
|
||||||
* GPLv2 License
|
|
||||||
*
|
|
||||||
* Copyright(C) 2017 MediaTek Inc.
|
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of version 2 of the GNU General Public License as
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but
|
* This program is distributed in the hope that it will be useful,
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* See http://www.gnu.org/licenses/gpl-2.0.html for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*/
|
||||||
* BSD LICENSE
|
|
||||||
*
|
|
||||||
* Copyright(C) 2017 MediaTek Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* * Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in
|
|
||||||
* the documentation and/or other materials provided with the
|
|
||||||
* distribution.
|
|
||||||
* * Neither the name of the copyright holder nor the names of its
|
|
||||||
* contributors may be used to endorse or promote products derived
|
|
||||||
* from this software without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
*****************************************************************************/
|
|
||||||
#ifndef _RA_NAT_WANTED
|
#ifndef _RA_NAT_WANTED
|
||||||
#define _RA_NAT_WANTED
|
#define _RA_NAT_WANTED
|
||||||
|
|
||||||
@ -59,13 +22,13 @@
|
|||||||
#define hwnat_vlan_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
|
#define hwnat_vlan_tag_get(__skb) ((__skb)->vlan_tci & ~VLAN_TAG_PRESENT)
|
||||||
|
|
||||||
#if defined(CONFIG_RA_NAT_HW)
|
#if defined(CONFIG_RA_NAT_HW)
|
||||||
extern void hwnat_magic_tag_set_zero(struct sk_buff *skb);
|
void hwnat_magic_tag_set_zero(struct sk_buff *skb);
|
||||||
extern void hwnat_check_magic_tag(struct sk_buff *skb);
|
void hwnat_check_magic_tag(struct sk_buff *skb);
|
||||||
extern void hwnat_set_headroom_zero(struct sk_buff *skb);
|
void hwnat_set_headroom_zero(struct sk_buff *skb);
|
||||||
extern void hwnat_set_tailroom_zero(struct sk_buff *skb);
|
void hwnat_set_tailroom_zero(struct sk_buff *skb);
|
||||||
extern void hwnat_copy_headroom(u8 *data, struct sk_buff *skb);
|
void hwnat_copy_headroom(u8 *data, struct sk_buff *skb);
|
||||||
extern void hwnat_copy_tailroom(u8 *data, int size, struct sk_buff *skb);
|
void hwnat_copy_tailroom(u8 *data, int size, struct sk_buff *skb);
|
||||||
extern void hwnat_setup_dma_ops(struct device *dev, bool coherent);
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline void hwnat_magic_tag_set_zero(struct sk_buff *skb)
|
static inline void hwnat_magic_tag_set_zero(struct sk_buff *skb)
|
||||||
@ -141,23 +104,104 @@ enum foe_cpu_reason {
|
|||||||
HIT_PRE_BIND = 0x1A /* Pre-bind */
|
HIT_PRE_BIND = 0x1A /* Pre-bind */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MAX_IF_NUM 64
|
enum dst_port_num {
|
||||||
|
DP_RA0 = 11,
|
||||||
|
#if defined(CONFIG_RT2860V2_AP_MBSS) || \
|
||||||
|
defined(CONFIG_RTPCI_AP_MBSS) || defined(CONFIG_MBSS_SUPPORT)
|
||||||
|
DP_RA1 = 12,
|
||||||
|
DP_RA2 = 13,
|
||||||
|
DP_RA3 = 14,
|
||||||
|
DP_RA4 = 15,
|
||||||
|
DP_RA5 = 16,
|
||||||
|
DP_RA6 = 17,
|
||||||
|
DP_RA7 = 18,
|
||||||
|
DP_RA8 = 19,
|
||||||
|
DP_RA9 = 20,
|
||||||
|
DP_RA10 = 21,
|
||||||
|
DP_RA11 = 22,
|
||||||
|
DP_RA12 = 23,
|
||||||
|
DP_RA13 = 24,
|
||||||
|
DP_RA14 = 25,
|
||||||
|
DP_RA15 = 26,
|
||||||
|
#endif /* CONFIG_RT2860V2_AP_MBSS // */
|
||||||
|
#if defined(CONFIG_RT2860V2_AP_WDS) || \
|
||||||
|
defined(CONFIG_RTPCI_AP_WDS) || defined(CONFIG_WDS_SUPPORT)
|
||||||
|
DP_WDS0 = 27,
|
||||||
|
DP_WDS1 = 28,
|
||||||
|
DP_WDS2 = 29,
|
||||||
|
DP_WDS3 = 30,
|
||||||
|
#endif /* CONFIG_RT2860V2_AP_WDS // */
|
||||||
|
#if defined(CONFIG_RT2860V2_AP_APCLI) || \
|
||||||
|
defined(CONFIG_RTPCI_AP_APCLI) || defined(CONFIG_APCLI_SUPPORT)
|
||||||
|
DP_APCLI0 = 31,
|
||||||
|
#endif /* CONFIG_RT2860V2_AP_APCLI // */
|
||||||
|
#if defined(CONFIG_RT2860V2_AP_MESH)
|
||||||
|
DP_MESH0 = 32,
|
||||||
|
#endif /* CONFIG_RT2860V2_AP_MESH // */
|
||||||
|
DP_RAI0 = 33,
|
||||||
|
#if defined(CONFIG_RT3090_AP_MBSS) || defined(CONFIG_RT5392_AP_MBSS) || \
|
||||||
|
defined(CONFIG_RT3572_AP_MBSS) || defined(CONFIG_RT5572_AP_MBSS) || \
|
||||||
|
defined(CONFIG_RT5592_AP_MBSS) || defined(CONFIG_RT3593_AP_MBSS) || \
|
||||||
|
defined(CONFIG_MT7610_AP_MBSS) || defined(CONFIG_RTPCI_AP_MBSS) || \
|
||||||
|
defined(CONFIG_MBSS_SUPPORT)
|
||||||
|
DP_RAI1 = 34,
|
||||||
|
DP_RAI2 = 35,
|
||||||
|
DP_RAI3 = 36,
|
||||||
|
DP_RAI4 = 37,
|
||||||
|
DP_RAI5 = 38,
|
||||||
|
DP_RAI6 = 39,
|
||||||
|
DP_RAI7 = 40,
|
||||||
|
DP_RAI8 = 41,
|
||||||
|
DP_RAI9 = 42,
|
||||||
|
DP_RAI10 = 43,
|
||||||
|
DP_RAI11 = 44,
|
||||||
|
DP_RAI12 = 45,
|
||||||
|
DP_RAI13 = 46,
|
||||||
|
DP_RAI14 = 47,
|
||||||
|
DP_RAI15 = 48,
|
||||||
|
#endif /* CONFIG_RTDEV_AP_MBSS // */
|
||||||
|
#if defined(CONFIG_RT3090_AP_WDS) || defined(CONFIG_RT5392_AP_WDS) || \
|
||||||
|
defined(CONFIG_RT3572_AP_WDS) || defined(CONFIG_RT5572_AP_WDS) || \
|
||||||
|
defined(CONFIG_RT5592_AP_WDS) || defined(CONFIG_RT3593_AP_WDS) || \
|
||||||
|
defined(CONFIG_MT7610_AP_WDS) || defined(CONFIG_WDS_SUPPORT)
|
||||||
|
DP_WDSI0 = 49,
|
||||||
|
DP_WDSI1 = 50,
|
||||||
|
DP_WDSI2 = 51,
|
||||||
|
DP_WDSI3 = 52,
|
||||||
|
#endif /* CONFIG_RTDEV_AP_WDS // */
|
||||||
|
#if defined(CONFIG_RT3090_AP_APCLI) || defined(CONFIG_RT5392_AP_APCLI) || \
|
||||||
|
defined(CONFIG_RT3572_AP_APCLI) || defined(CONFIG_RT5572_AP_APCLI) || \
|
||||||
|
defined(CONFIG_RT5592_AP_APCLI) || defined(CONFIG_RT3593_AP_APCLI) || \
|
||||||
|
defined(CONFIG_MT7610_AP_APCLI) || defined(CONFIG_APCLI_SUPPORT)
|
||||||
|
DP_APCLII0 = 53,
|
||||||
|
#endif /* CONFIG_RTDEV_AP_APCLI // */
|
||||||
|
#if defined(CONFIG_RT3090_AP_MESH) || defined(CONFIG_RT5392_AP_MESH) || \
|
||||||
|
defined(CONFIG_RT3572_AP_MESH) || defined(CONFIG_RT5572_AP_MESH) || \
|
||||||
|
defined(CONFIG_RT5592_AP_MESH) || defined(CONFIG_RT3593_AP_MESH) || \
|
||||||
|
defined(CONFIG_MT7610_AP_MESH)
|
||||||
|
DP_MESHI0 = 54,
|
||||||
|
#endif /* CONFIG_RTDEV_AP_MESH // */
|
||||||
|
MAX_WIFI_IF_NUM = 59,
|
||||||
|
DP_GMAC = 60,
|
||||||
|
DP_GMAC2 = 61,
|
||||||
|
DP_PCI = 62,
|
||||||
|
DP_USB = 63,
|
||||||
|
MAX_IF_NUM
|
||||||
|
};
|
||||||
|
|
||||||
struct pdma_rx_desc_info4 {
|
struct pdma_rx_desc_info4 {
|
||||||
u16 MAGIC_TAG_PROTECT;
|
u16 MAGIC_TAG_PROTECT;
|
||||||
uint32_t foe_entry_num:14;
|
uint32_t foe_entry_num:14;
|
||||||
uint32_t CRSN:5;
|
uint32_t CRSN:5;
|
||||||
uint32_t SPORT:3;
|
uint32_t SPORT:4;
|
||||||
#if defined(CONFIG_MACH_LEOPARD)
|
|
||||||
uint32_t foe_entry_num_32:1;
|
|
||||||
#else
|
|
||||||
uint32_t rsv:1;
|
|
||||||
#endif
|
|
||||||
uint32_t ALG:1;
|
uint32_t ALG:1;
|
||||||
uint16_t IF:8;
|
uint16_t IF:8;
|
||||||
|
#if defined(CONFIG_ARCH_MT7622_WIFI_HW_NAT)
|
||||||
u8 WDMAID;
|
u8 WDMAID;
|
||||||
uint16_t RXID:2;
|
uint16_t RXID:2;
|
||||||
uint16_t WCID:8;
|
uint16_t WCID:8;
|
||||||
uint16_t BSSID:6;
|
uint16_t BSSID:6;
|
||||||
|
#endif
|
||||||
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
||||||
u16 SOURCE;
|
u16 SOURCE;
|
||||||
u16 DEST;
|
u16 DEST;
|
||||||
@ -167,20 +211,16 @@ struct pdma_rx_desc_info4 {
|
|||||||
struct head_rx_descinfo4 {
|
struct head_rx_descinfo4 {
|
||||||
uint32_t foe_entry_num:14;
|
uint32_t foe_entry_num:14;
|
||||||
uint32_t CRSN:5;
|
uint32_t CRSN:5;
|
||||||
uint32_t SPORT:3;
|
uint32_t SPORT:4;
|
||||||
#if defined(CONFIG_MACH_LEOPARD)
|
|
||||||
uint32_t foe_entry_num_32:1;
|
|
||||||
#else
|
|
||||||
uint32_t rsv:1;
|
|
||||||
#endif
|
|
||||||
uint32_t ALG:1;
|
uint32_t ALG:1;
|
||||||
uint32_t IF:8;
|
uint32_t IF:8;
|
||||||
u16 MAGIC_TAG_PROTECT;
|
u16 MAGIC_TAG_PROTECT;
|
||||||
|
#if defined(CONFIG_ARCH_MT7622_WIFI_HW_NAT)
|
||||||
u8 WDMAID;
|
u8 WDMAID;
|
||||||
uint16_t RXID:2;
|
uint16_t RXID:2;
|
||||||
uint16_t WCID:8;
|
uint16_t WCID:8;
|
||||||
uint16_t BSSID:6;
|
uint16_t BSSID:6;
|
||||||
|
#endif
|
||||||
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
||||||
u16 SOURCE;
|
u16 SOURCE;
|
||||||
u16 DEST;
|
u16 DEST;
|
||||||
@ -191,19 +231,16 @@ struct cb_rx_desc_info4 {
|
|||||||
u16 MAGIC_TAG_PROTECT0;
|
u16 MAGIC_TAG_PROTECT0;
|
||||||
uint32_t foe_entry_num:14;
|
uint32_t foe_entry_num:14;
|
||||||
uint32_t CRSN:5;
|
uint32_t CRSN:5;
|
||||||
uint32_t SPORT:3;
|
uint32_t SPORT:4;
|
||||||
#if defined(CONFIG_MACH_LEOPARD)
|
|
||||||
uint32_t foe_entry_num_32:1;
|
|
||||||
#else
|
|
||||||
uint32_t rsv:1;
|
|
||||||
#endif
|
|
||||||
uint32_t ALG:1;
|
uint32_t ALG:1;
|
||||||
uint32_t IF:8;
|
uint32_t IF:8;
|
||||||
u16 MAGIC_TAG_PROTECT1;
|
u16 MAGIC_TAG_PROTECT1;
|
||||||
|
#if defined(CONFIG_ARCH_MT7622_WIFI_HW_NAT)
|
||||||
u8 WDMAID;
|
u8 WDMAID;
|
||||||
uint16_t RXID:2;
|
uint16_t RXID:2;
|
||||||
uint16_t WCID:8;
|
uint16_t WCID:8;
|
||||||
uint16_t BSSID:6;
|
uint16_t BSSID:6;
|
||||||
|
#endif
|
||||||
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
||||||
u16 SOURCE;
|
u16 SOURCE;
|
||||||
u16 DEST;
|
u16 DEST;
|
||||||
@ -251,21 +288,8 @@ struct cb_rx_desc_info4 {
|
|||||||
|
|
||||||
#define FOE_TAG_PROTECT(skb) \
|
#define FOE_TAG_PROTECT(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->MAGIC_TAG_PROTECT)
|
(((struct head_rx_descinfo4 *)((skb)->head))->MAGIC_TAG_PROTECT)
|
||||||
|
|
||||||
#define FOE_ENTRY_NUM_LSB(skb) \
|
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->foe_entry_num)
|
|
||||||
|
|
||||||
#if defined(CONFIG_MACH_LEOPARD)
|
|
||||||
#define FOE_ENTRY_NUM_MSB(skb) \
|
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->foe_entry_num_32)
|
|
||||||
#define FOE_ENTRY_NUM(skb) \
|
|
||||||
(((FOE_ENTRY_NUM_MSB(skb) & 0x1) << 14) | FOE_ENTRY_NUM_LSB(skb))
|
|
||||||
#else
|
|
||||||
#define FOE_ENTRY_NUM_MSB(skb) \
|
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->rsv)
|
|
||||||
#define FOE_ENTRY_NUM(skb) \
|
#define FOE_ENTRY_NUM(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->foe_entry_num)
|
(((struct head_rx_descinfo4 *)((skb)->head))->foe_entry_num)
|
||||||
#endif
|
|
||||||
#define FOE_ALG(skb) \
|
#define FOE_ALG(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->ALG)
|
(((struct head_rx_descinfo4 *)((skb)->head))->ALG)
|
||||||
#define FOE_AI(skb) \
|
#define FOE_AI(skb) \
|
||||||
@ -274,19 +298,19 @@ struct cb_rx_desc_info4 {
|
|||||||
(((struct head_rx_descinfo4 *)((skb)->head))->SPORT)
|
(((struct head_rx_descinfo4 *)((skb)->head))->SPORT)
|
||||||
#define FOE_MAGIC_TAG(skb) \
|
#define FOE_MAGIC_TAG(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->IF)
|
(((struct head_rx_descinfo4 *)((skb)->head))->IF)
|
||||||
|
#if defined(CONFIG_ARCH_MT7622_WIFI_HW_NAT)
|
||||||
#define FOE_WDMA_ID(skb) \
|
#define FOE_WDMA_ID(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->WDMAID)
|
(((struct head_rx_descinfo4 *)((skb)->head))->WDMAID)
|
||||||
#define FOE_RX_ID(skb) (((struct head_rx_descinfo4 *)((skb)->head))->RXID)
|
#define FOE_RX_ID(skb) (((struct head_rx_descinfo4 *)((skb)->head))->RXID)
|
||||||
#define FOE_WC_ID(skb) (((struct head_rx_descinfo4 *)((skb)->head))->WCID)
|
#define FOE_WC_ID(skb) (((struct head_rx_descinfo4 *)((skb)->head))->WCID)
|
||||||
#define FOE_BSS_ID(skb) (((struct head_rx_descinfo4 *)((skb)->head))->BSSID)
|
#define FOE_BSS_ID(skb) (((struct head_rx_descinfo4 *)((skb)->head))->BSSID)
|
||||||
|
#endif
|
||||||
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
||||||
#define FOE_SOURCE(skb) (((struct head_rx_descinfo4 *)((skb)->head))->SOURCE)
|
#define FOE_SOURCE(skb) (((struct head_rx_descinfo4 *)((skb)->head))->SOURCE)
|
||||||
#define FOE_DEST(skb) (((struct head_rx_descinfo4 *)((skb)->head))->DEST)
|
#define FOE_DEST(skb) (((struct head_rx_descinfo4 *)((skb)->head))->DEST)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define IS_SPACE_AVAILABLE_HEAD(skb) \
|
#define IS_SPACE_AVAILABLED_HEAD(skb) \
|
||||||
((((skb_headroom(skb) >= FOE_INFO_LEN) ? 1 : 0)))
|
((((skb_headroom(skb) >= FOE_INFO_LEN) ? 1 : 0)))
|
||||||
#define IS_SPACE_AVAILABLE_HEAD(skb) \
|
#define IS_SPACE_AVAILABLE_HEAD(skb) \
|
||||||
((((skb_headroom(skb) >= FOE_INFO_LEN) ? 1 : 0)))
|
((((skb_headroom(skb) >= FOE_INFO_LEN) ? 1 : 0)))
|
||||||
@ -294,20 +318,8 @@ struct cb_rx_desc_info4 {
|
|||||||
|
|
||||||
#define FOE_TAG_PROTECT_HEAD(skb) \
|
#define FOE_TAG_PROTECT_HEAD(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->MAGIC_TAG_PROTECT)
|
(((struct head_rx_descinfo4 *)((skb)->head))->MAGIC_TAG_PROTECT)
|
||||||
#define FOE_ENTRY_NUM_LSB_HEAD(skb) \
|
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->foe_entry_num)
|
|
||||||
#if defined(CONFIG_MACH_LEOPARD)
|
|
||||||
#define FOE_ENTRY_NUM_MSB_HEAD(skb) \
|
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->foe_entry_num_32)
|
|
||||||
#define FOE_ENTRY_NUM_HEAD(skb) \
|
|
||||||
(((FOE_ENTRY_NUM_MSB_HEAD(skb) & 0x1) << 14) | FOE_ENTRY_NUM_LSB_HEAD(skb))
|
|
||||||
#else
|
|
||||||
#define FOE_ENTRY_NUM_MSB_HEAD(skb) \
|
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->rsv)
|
|
||||||
#define FOE_ENTRY_NUM_HEAD(skb) \
|
#define FOE_ENTRY_NUM_HEAD(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->foe_entry_num)
|
(((struct head_rx_descinfo4 *)((skb)->head))->foe_entry_num)
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FOE_ALG_HEAD(skb) \
|
#define FOE_ALG_HEAD(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->ALG)
|
(((struct head_rx_descinfo4 *)((skb)->head))->ALG)
|
||||||
#define FOE_AI_HEAD(skb) \
|
#define FOE_AI_HEAD(skb) \
|
||||||
@ -317,6 +329,7 @@ struct cb_rx_desc_info4 {
|
|||||||
#define FOE_MAGIC_TAG_HEAD(skb) \
|
#define FOE_MAGIC_TAG_HEAD(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->IF)
|
(((struct head_rx_descinfo4 *)((skb)->head))->IF)
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_MT7622_WIFI_HW_NAT)
|
||||||
#define FOE_WDMA_ID_HEAD(skb) \
|
#define FOE_WDMA_ID_HEAD(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->WDMAID)
|
(((struct head_rx_descinfo4 *)((skb)->head))->WDMAID)
|
||||||
#define FOE_RX_ID_HEAD(skb) \
|
#define FOE_RX_ID_HEAD(skb) \
|
||||||
@ -325,6 +338,7 @@ struct cb_rx_desc_info4 {
|
|||||||
(((struct head_rx_descinfo4 *)((skb)->head))->WCID)
|
(((struct head_rx_descinfo4 *)((skb)->head))->WCID)
|
||||||
#define FOE_BSS_ID_HEAD(skb) \
|
#define FOE_BSS_ID_HEAD(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->BSSID)
|
(((struct head_rx_descinfo4 *)((skb)->head))->BSSID)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
||||||
#define FOE_SOURCE_HEAD(skb) \
|
#define FOE_SOURCE_HEAD(skb) \
|
||||||
@ -333,6 +347,7 @@ struct cb_rx_desc_info4 {
|
|||||||
(((struct head_rx_descinfo4 *)((skb)->head))->DEST)
|
(((struct head_rx_descinfo4 *)((skb)->head))->DEST)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_MT7622_WIFI_HW_NAT)
|
||||||
#define FOE_WDMA_ID_HEAD(skb) \
|
#define FOE_WDMA_ID_HEAD(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->WDMAID)
|
(((struct head_rx_descinfo4 *)((skb)->head))->WDMAID)
|
||||||
#define FOE_RX_ID_HEAD(skb) \
|
#define FOE_RX_ID_HEAD(skb) \
|
||||||
@ -341,6 +356,7 @@ struct cb_rx_desc_info4 {
|
|||||||
(((struct head_rx_descinfo4 *)((skb)->head))->WCID)
|
(((struct head_rx_descinfo4 *)((skb)->head))->WCID)
|
||||||
#define FOE_BSS_ID_HEAD(skb) \
|
#define FOE_BSS_ID_HEAD(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->BSSID)
|
(((struct head_rx_descinfo4 *)((skb)->head))->BSSID)
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
||||||
#define FOE_SOURCE_HEAD(skb) \
|
#define FOE_SOURCE_HEAD(skb) \
|
||||||
@ -348,7 +364,7 @@ struct cb_rx_desc_info4 {
|
|||||||
#define FOE_DEST_HEAD(skb) \
|
#define FOE_DEST_HEAD(skb) \
|
||||||
(((struct head_rx_descinfo4 *)((skb)->head))->DEST)
|
(((struct head_rx_descinfo4 *)((skb)->head))->DEST)
|
||||||
#endif
|
#endif
|
||||||
#define IS_SPACE_AVAILABLE_TAIL(skb) \
|
#define IS_SPACE_AVAILABLED_TAIL(skb) \
|
||||||
(((skb_tailroom(skb) >= FOE_INFO_LEN) ? 1 : 0))
|
(((skb_tailroom(skb) >= FOE_INFO_LEN) ? 1 : 0))
|
||||||
#define IS_SPACE_AVAILABLE_TAIL(skb) \
|
#define IS_SPACE_AVAILABLE_TAIL(skb) \
|
||||||
(((skb_tailroom(skb) >= FOE_INFO_LEN) ? 1 : 0))
|
(((skb_tailroom(skb) >= FOE_INFO_LEN) ? 1 : 0))
|
||||||
@ -357,21 +373,8 @@ struct cb_rx_desc_info4 {
|
|||||||
|
|
||||||
#define FOE_TAG_PROTECT_TAIL(skb) \
|
#define FOE_TAG_PROTECT_TAIL(skb) \
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->MAGIC_TAG_PROTECT)
|
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->MAGIC_TAG_PROTECT)
|
||||||
#define FOE_ENTRY_NUM_LSB_TAIL(skb) \
|
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->foe_entry_num)
|
|
||||||
|
|
||||||
#if defined(CONFIG_MACH_LEOPARD)
|
|
||||||
#define FOE_ENTRY_NUM_MSB_TAIL(skb) \
|
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->foe_entry_num_32)
|
|
||||||
#define FOE_ENTRY_NUM_TAIL(skb) \
|
|
||||||
(((FOE_ENTRY_NUM_MSB_TAIL(skb) & 0x1) << 14) | FOE_ENTRY_NUM_LSB_TAIL(skb))
|
|
||||||
#else
|
|
||||||
#define FOE_ENTRY_NUM_MSB_TAIL(skb) \
|
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->rsv)
|
|
||||||
#define FOE_ENTRY_NUM_TAIL(skb) \
|
#define FOE_ENTRY_NUM_TAIL(skb) \
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->foe_entry_num)
|
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->foe_entry_num)
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FOE_ALG_TAIL(skb) \
|
#define FOE_ALG_TAIL(skb) \
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->ALG)
|
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->ALG)
|
||||||
#define FOE_AI_TAIL(skb) \
|
#define FOE_AI_TAIL(skb) \
|
||||||
@ -388,14 +391,16 @@ struct cb_rx_desc_info4 {
|
|||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->DEST)
|
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->DEST)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_MT7622_WIFI_HW_NAT)
|
||||||
#define FOE_WDMA_ID_TAIL(skb) \
|
#define FOE_WDMA_ID_TAIL(skb) \
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->WDMAID)
|
(((struct pdma_rx_desc_info4 *)((skb)->head))->WDMAID)
|
||||||
#define FOE_RX_ID_TAIL(skb) \
|
#define FOE_RX_ID_TAIL(skb) \
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->RXID)
|
(((struct pdma_rx_desc_info4 *)((skb)->head))->RXID)
|
||||||
#define FOE_WC_ID_TAIL(skb) \
|
#define FOE_WC_ID_TAIL(skb) \
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->WCID)
|
(((struct pdma_rx_desc_info4 *)((skb)->head))->WCID)
|
||||||
#define FOE_BSS_ID_TAIL(skb) \
|
#define FOE_BSS_ID_TAIL(skb) \
|
||||||
(((struct pdma_rx_desc_info4 *)((long)((skb_end_pointer(skb)) - FOE_INFO_LEN)))->BSSID)
|
(((struct pdma_rx_desc_info4 *)((skb)->head))->BSSID)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* change the position of skb_CB if necessary */
|
/* change the position of skb_CB if necessary */
|
||||||
#define CB_OFFSET 40
|
#define CB_OFFSET 40
|
||||||
@ -421,6 +426,8 @@ struct cb_rx_desc_info4 {
|
|||||||
#define FOE_DEST_CB(skb) (((struct cb_rx_desc_info4 *)((skb)->cb + CB_OFFSET))->DEST)
|
#define FOE_DEST_CB(skb) (((struct cb_rx_desc_info4 *)((skb)->cb + CB_OFFSET))->DEST)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(CONFIG_ARCH_MT7622_WIFI_HW_NAT)
|
||||||
#define FOE_WDMA_ID_CB(skb) \
|
#define FOE_WDMA_ID_CB(skb) \
|
||||||
(((struct cb_rx_desc_info4 *)((skb)->head))->WDMAID)
|
(((struct cb_rx_desc_info4 *)((skb)->head))->WDMAID)
|
||||||
#define FOE_RX_ID_CB(skb) \
|
#define FOE_RX_ID_CB(skb) \
|
||||||
@ -429,6 +436,7 @@ struct cb_rx_desc_info4 {
|
|||||||
(((struct cb_rx_desc_info4 *)((skb)->head))->WCID)
|
(((struct cb_rx_desc_info4 *)((skb)->head))->WCID)
|
||||||
#define FOE_BSS_ID_CB(skb) \
|
#define FOE_BSS_ID_CB(skb) \
|
||||||
(((struct cb_rx_desc_info4 *)((skb)->head))->BSSID)
|
(((struct cb_rx_desc_info4 *)((skb)->head))->BSSID)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define IS_MAGIC_TAG_PROTECT_VALID_HEAD(skb) \
|
#define IS_MAGIC_TAG_PROTECT_VALID_HEAD(skb) \
|
||||||
(FOE_TAG_PROTECT_HEAD(skb) == TAG_PROTECT)
|
(FOE_TAG_PROTECT_HEAD(skb) == TAG_PROTECT)
|
||||||
@ -473,7 +481,7 @@ static inline void hwnat_set_l2tp_unhit(struct iphdr *iph, struct sk_buff *skb)
|
|||||||
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
#if defined(CONFIG_RA_HW_NAT_PPTP_L2TP)
|
||||||
/* only clear headeroom for TCP OR not L2TP packets */
|
/* only clear headeroom for TCP OR not L2TP packets */
|
||||||
if ((iph->protocol == 0x6) || (ntohs(udp_hdr(skb)->dest) != 1701)) {
|
if ((iph->protocol == 0x6) || (ntohs(udp_hdr(skb)->dest) != 1701)) {
|
||||||
if (IS_SPACE_AVAILABLE_HEAD(skb)) {
|
if (IS_SPACE_AVAILABLED_HEAD(skb)) {
|
||||||
FOE_MAGIC_TAG(skb) = 0;
|
FOE_MAGIC_TAG(skb) = 0;
|
||||||
FOE_AI(skb) = UN_HIT;
|
FOE_AI(skb) = UN_HIT;
|
||||||
}
|
}
|
||||||
@ -496,60 +504,53 @@ static inline void hwnat_clear_l2tp_fast_path(u32 l2tp_fast_path)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* #define CONFIG_HW_NAT_IPI */
|
//#define CONFIG_HW_NAT_IPI
|
||||||
#if defined(CONFIG_HW_NAT_IPI)
|
#if defined (CONFIG_HW_NAT_IPI)
|
||||||
extern int debug_level;
|
//#define HNAT_IPI_RXQUEUE 1
|
||||||
int get_rps_cpu(struct net_device *dev, struct sk_buff *skb,
|
|
||||||
struct rps_dev_flow **rflowp);
|
|
||||||
uint32_t ppe_extif_rx_handler(struct sk_buff *skb);
|
|
||||||
int hitbind_force_to_cpu_handler(struct sk_buff *skb, struct foe_entry *entry);
|
|
||||||
extern unsigned int ipidbg[num_possible_cpus()][10];
|
|
||||||
extern unsigned int ipidbg2[num_possible_cpus()][10];
|
|
||||||
/* #define HNAT_IPI_RXQUEUE 1 */
|
|
||||||
#define HNAT_IPI_DQ 1
|
#define HNAT_IPI_DQ 1
|
||||||
#define HNAT_IPI_HASH_NORMAL 0
|
#define HNAT_IPI_HASH_NORMAL 0
|
||||||
#define HNAT_IPI_HASH_VTAG 1
|
#define HNAT_IPI_HASH_VTAG 1
|
||||||
#define HNAT_IPI_HASH_FROM_EXTIF 2
|
#define HNAT_IPI_HASH_FROM_EXTIF 2
|
||||||
#define HNAT_IPI_HASH_FROM_GMAC 4
|
#define HNAT_IPI_HASH_FROM_GMAC 4
|
||||||
|
|
||||||
struct hnat_ipi_s {
|
typedef struct {
|
||||||
#if defined(HNAT_IPI_DQ)
|
#if defined (HNAT_IPI_DQ)
|
||||||
struct sk_buff_head skb_input_queue;
|
struct sk_buff_head skbInputQueue;
|
||||||
struct sk_buff_head skb_process_queue;
|
struct sk_buff_head skbProcessQueue;
|
||||||
#elif defined(HNAT_IPI_RXQUEUE)
|
#elif defined (HNAT_IPI_RXQUEUE)
|
||||||
atomic_t rx_queue_num;
|
atomic_t RxQueueNum;
|
||||||
unsigned int rx_queue_ridx;
|
unsigned int RxQueueRIdx;
|
||||||
unsigned int rx_queue_widx;
|
unsigned int RxQueueWIdx;
|
||||||
struct sk_buff **rx_queue;
|
struct sk_buff** RxQueue;
|
||||||
#else
|
#else
|
||||||
/* unsigned int dummy0[0]; */
|
//unsigned int dummy0[0];
|
||||||
struct sk_buff_head skb_ipi_queue;
|
struct sk_buff_head skbIpiQueue;
|
||||||
/* unsigned int dummy1[8]; */
|
//unsigned int dummy1[8];
|
||||||
#endif
|
#endif
|
||||||
unsigned long time_rec, recv_time;
|
unsigned long time_rec, recv_time;
|
||||||
unsigned int ipi_accum;
|
unsigned int ipi_accum;
|
||||||
/*hwnat ipi use*/
|
spinlock_t ipilock;
|
||||||
spinlock_t ipilock;
|
|
||||||
struct tasklet_struct smp_func_call_tsk;
|
struct tasklet_struct smp_func_call_tsk;
|
||||||
} ____cacheline_aligned_in_smp;
|
} ____cacheline_aligned_in_smp hnat_ipi_s;
|
||||||
|
|
||||||
struct hnat_ipi_stat {
|
|
||||||
unsigned long drop_pkt_num_from_extif;
|
typedef struct {
|
||||||
unsigned long drop_pkt_num_from_ppehit;
|
unsigned long dropPktNum_from_extif;
|
||||||
|
unsigned long dropPktNum_from_ppehit;
|
||||||
unsigned int smp_call_cnt_from_extif;
|
unsigned int smp_call_cnt_from_extif;
|
||||||
unsigned int smp_call_cnt_from_ppehit;
|
unsigned int smp_call_cnt_from_ppehit;
|
||||||
atomic_t cpu_status;
|
atomic_t cpu_status;
|
||||||
/* atomic_t cpu_status_from_extif; */
|
//atomic_t cpu_status_from_extif;
|
||||||
/* atomic_t cpu_status_from_ppehit; */
|
//atomic_t cpu_status_from_ppehit;
|
||||||
|
|
||||||
|
//atomic_t hook_status_from_extif;
|
||||||
|
//atomic_t hook_status_from_ppehit;
|
||||||
|
} ____cacheline_aligned_in_smp hnat_ipi_stat;
|
||||||
|
|
||||||
/* atomic_t hook_status_from_extif; */
|
#define cpu_status_from_extif cpu_status
|
||||||
/* atomic_t hook_status_from_ppehit; */
|
#define cpu_status_from_ppehit cpu_status
|
||||||
} ____cacheline_aligned_in_smp;
|
|
||||||
|
|
||||||
#define cpu_status_from_extif cpu_status
|
typedef struct {
|
||||||
#define cpu_status_from_ppehit cpu_status
|
|
||||||
|
|
||||||
struct hnat_ipi_cfg {
|
|
||||||
unsigned int enable_from_extif;
|
unsigned int enable_from_extif;
|
||||||
unsigned int enable_from_ppehit;
|
unsigned int enable_from_ppehit;
|
||||||
unsigned int queue_thresh_from_extif;
|
unsigned int queue_thresh_from_extif;
|
||||||
@ -558,10 +559,9 @@ struct hnat_ipi_cfg {
|
|||||||
unsigned int drop_pkt_from_ppehit;
|
unsigned int drop_pkt_from_ppehit;
|
||||||
unsigned int ipi_cnt_mod_from_extif;
|
unsigned int ipi_cnt_mod_from_extif;
|
||||||
unsigned int ipi_cnt_mod_from_ppehit;
|
unsigned int ipi_cnt_mod_from_ppehit;
|
||||||
} ____cacheline_aligned_in_smp;
|
} ____cacheline_aligned_in_smp hnat_ipi_cfg;
|
||||||
|
int HnatIPIInit(void);
|
||||||
int hnat_ipi_init(void);
|
int HnatIPIDeInit(void);
|
||||||
int hnat_ipi_de_init(void);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user