ramips: mt7621: add kernel 5.10 support with mtk_hnat

This commit is contained in:
AmadeusGhost 2023-05-08 23:39:06 +08:00
parent 0db2337562
commit ef12a97354
17 changed files with 460 additions and 70 deletions

View File

@ -8,17 +8,9 @@ PKG_LICENSE_FILES:=
PKG_SOURCE_URL:=https://github.com/openwrt/mt76 PKG_SOURCE_URL:=https://github.com/openwrt/mt76
PKG_SOURCE_PROTO:=git PKG_SOURCE_PROTO:=git
ifdef CONFIG_LINUX_5_4
PKG_SOURCE_DATE:=2022-12-22
PKG_SOURCE_VERSION:=5b509e80384ab019ac11aa90c81ec0dbb5b0d7f2
PKG_MIRROR_HASH:=6fc25df4d28becd010ff4971b23731c08b53e69381a9e4c868091899712f78a9
PATCH_DIR:=./patches-5.4
else
PKG_SOURCE_DATE:=2023-04-18 PKG_SOURCE_DATE:=2023-04-18
PKG_SOURCE_VERSION:=cddbd796bbc649debe457f7b34b200bbda4fcc53 PKG_SOURCE_VERSION:=cddbd796bbc649debe457f7b34b200bbda4fcc53
PKG_MIRROR_HASH:=3c9e24863f3e045dbab1d05cf760ef0f4a21106766987558ce4df6c0964df11a PKG_MIRROR_HASH:=3c9e24863f3e045dbab1d05cf760ef0f4a21106766987558ce4df6c0964df11a
endif
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
PKG_USE_NINJA:=0 PKG_USE_NINJA:=0

View File

@ -10,8 +10,8 @@ BOARDNAME:=MediaTek Ralink MIPS
SUBTARGETS:=mt7620 mt7621 mt76x8 rt288x rt305x rt3883 SUBTARGETS:=mt7620 mt7621 mt76x8 rt288x rt305x rt3883
FEATURES:=squashfs gpio boot-part rootfs-part FEATURES:=squashfs gpio boot-part rootfs-part
KERNEL_PATCHVER:=5.4 KERNEL_PATCHVER:=5.10
KERNEL_TESTING_PATCHVER:=5.10 KERNEL_TESTING_PATCHVER:=5.15
define Target/Description define Target/Description
Build firmware images for Ralink RT288x/RT3xxx based boards. Build firmware images for Ralink RT288x/RT3xxx based boards.

View File

@ -2,7 +2,7 @@
config NET_VENDOR_RAW_MEDIATEK config NET_VENDOR_RAW_MEDIATEK
bool "MediaTek ethernet driver" bool "MediaTek ethernet driver"
depends on ARCH_MEDIATEK || SOC_MT7621 || SOC_MT7620 depends on ARCH_MEDIATEK || SOC_MT7621 || SOC_MT7620
---help--- help
If you have a Mediatek SoC with ethernet, say Y. If you have a Mediatek SoC with ethernet, say Y.
if NET_VENDOR_RAW_MEDIATEK if NET_VENDOR_RAW_MEDIATEK
@ -10,20 +10,20 @@ if NET_VENDOR_RAW_MEDIATEK
config NET_MEDIATEK_SOC_GE config NET_MEDIATEK_SOC_GE
tristate "MediaTek SoC Gigabit Ethernet support" tristate "MediaTek SoC Gigabit Ethernet support"
select PHYLINK select PHYLINK
---help--- help
This driver supports the gigabit ethernet MACs in the This driver supports the gigabit ethernet MACs in the
MediaTek SoC family. MediaTek SoC family.
config MEDIATEK_NETSYS_V2 config MEDIATEK_NETSYS_V2
tristate "MediaTek Ethernet NETSYS V2 support" tristate "MediaTek Ethernet NETSYS V2 support"
depends on ARCH_MEDIATEK && NET_MEDIATEK_SOC_GE depends on ARCH_MEDIATEK && NET_MEDIATEK_SOC_GE
---help--- help
This options enable MTK Ethernet NETSYS V2 support This options enable MTK Ethernet NETSYS V2 support
config NET_MEDIATEK_HNAT config NET_MEDIATEK_HNAT
tristate "MediaTek HW NAT support" tristate "MediaTek HW NAT support"
depends on NET_MEDIATEK_SOC_GE && NF_CONNTRACK && IP_NF_NAT depends on NET_MEDIATEK_SOC_GE && NF_CONNTRACK && IP_NF_NAT
---help--- help
This driver supports the hardward Network Address Translation This driver supports the hardward Network Address Translation
in the MediaTek MT2701/MT7622/MT7629/MT7621 chipset family. in the MediaTek MT2701/MT7622/MT7629/MT7621 chipset family.

View File

@ -24,6 +24,7 @@
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/version.h>
#include "mtk_eth_soc.h" #include "mtk_eth_soc.h"
#include "mtk_eth_dbg.h" #include "mtk_eth_dbg.h"
@ -610,6 +611,7 @@ static int switch_count_open(struct inode *inode, struct file *file)
return single_open(file, esw_cnt_read, 0); return single_open(file, esw_cnt_read, 0);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static const struct file_operations switch_count_fops = { static const struct file_operations switch_count_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = switch_count_open, .open = switch_count_open,
@ -617,6 +619,14 @@ static const struct file_operations switch_count_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release .release = single_release
}; };
#else
static const struct proc_ops switch_count_fops = {
.proc_open = switch_count_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release
};
#endif
static struct proc_dir_entry *proc_tx_ring, *proc_hwtx_ring, *proc_rx_ring; static struct proc_dir_entry *proc_tx_ring, *proc_hwtx_ring, *proc_rx_ring;
@ -662,6 +672,7 @@ static int tx_ring_open(struct inode *inode, struct file *file)
return single_open(file, tx_ring_read, NULL); return single_open(file, tx_ring_read, NULL);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static const struct file_operations tx_ring_fops = { static const struct file_operations tx_ring_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = tx_ring_open, .open = tx_ring_open,
@ -669,6 +680,14 @@ static const struct file_operations tx_ring_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release .release = single_release
}; };
#else
static const struct proc_ops tx_ring_fops = {
.proc_open = tx_ring_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release
};
#endif
int hwtx_ring_read(struct seq_file *seq, void *v) int hwtx_ring_read(struct seq_file *seq, void *v)
{ {
@ -709,6 +728,7 @@ static int hwtx_ring_open(struct inode *inode, struct file *file)
return single_open(file, hwtx_ring_read, NULL); return single_open(file, hwtx_ring_read, NULL);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static const struct file_operations hwtx_ring_fops = { static const struct file_operations hwtx_ring_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = hwtx_ring_open, .open = hwtx_ring_open,
@ -716,6 +736,14 @@ static const struct file_operations hwtx_ring_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release .release = single_release
}; };
#else
static const struct proc_ops hwtx_ring_fops = {
.proc_open = hwtx_ring_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release
};
#endif
int rx_ring_read(struct seq_file *seq, void *v) int rx_ring_read(struct seq_file *seq, void *v)
{ {
@ -757,6 +785,7 @@ static int rx_ring_open(struct inode *inode, struct file *file)
return single_open(file, rx_ring_read, NULL); return single_open(file, rx_ring_read, NULL);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static const struct file_operations rx_ring_fops = { static const struct file_operations rx_ring_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = rx_ring_open, .open = rx_ring_open,
@ -764,6 +793,14 @@ static const struct file_operations rx_ring_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release .release = single_release
}; };
#else
static const struct proc_ops rx_ring_fops = {
.proc_open = rx_ring_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release
};
#endif
static inline u32 mtk_dbg_r32(u32 reg) static inline u32 mtk_dbg_r32(u32 reg)
{ {
@ -885,6 +922,7 @@ static int dbg_regs_open(struct inode *inode, struct file *file)
return single_open(file, dbg_regs_read, 0); return single_open(file, dbg_regs_read, 0);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static const struct file_operations dbg_regs_fops = { static const struct file_operations dbg_regs_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = dbg_regs_open, .open = dbg_regs_open,
@ -892,6 +930,14 @@ static const struct file_operations dbg_regs_fops = {
.llseek = seq_lseek, .llseek = seq_lseek,
.release = single_release .release = single_release
}; };
#else
static const struct proc_ops dbg_regs_fops = {
.proc_open = dbg_regs_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_release = single_release
};
#endif
void hw_lro_stats_update(u32 ring_no, struct mtk_rx_dma *rxd) void hw_lro_stats_update(u32 ring_no, struct mtk_rx_dma *rxd)
{ {
@ -1177,6 +1223,7 @@ static int hw_lro_stats_open(struct inode *inode, struct file *file)
return single_open(file, hw_lro_stats_read_wrapper, NULL); return single_open(file, hw_lro_stats_read_wrapper, NULL);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static const struct file_operations hw_lro_stats_fops = { static const struct file_operations hw_lro_stats_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = hw_lro_stats_open, .open = hw_lro_stats_open,
@ -1185,6 +1232,15 @@ static const struct file_operations hw_lro_stats_fops = {
.write = hw_lro_stats_write, .write = hw_lro_stats_write,
.release = single_release .release = single_release
}; };
#else
static const struct proc_ops hw_lro_stats_fops = {
.proc_open = hw_lro_stats_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = hw_lro_stats_write,
.proc_release = single_release
};
#endif
int hwlro_agg_cnt_ctrl(int cnt) int hwlro_agg_cnt_ctrl(int cnt)
{ {
@ -1485,6 +1541,7 @@ static int hw_lro_auto_tlb_open(struct inode *inode, struct file *file)
return single_open(file, hw_lro_auto_tlb_read, NULL); return single_open(file, hw_lro_auto_tlb_read, NULL);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static const struct file_operations hw_lro_auto_tlb_fops = { static const struct file_operations hw_lro_auto_tlb_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = hw_lro_auto_tlb_open, .open = hw_lro_auto_tlb_open,
@ -1493,6 +1550,15 @@ static const struct file_operations hw_lro_auto_tlb_fops = {
.write = hw_lro_auto_tlb_write, .write = hw_lro_auto_tlb_write,
.release = single_release .release = single_release
}; };
#else
static const struct proc_ops hw_lro_auto_tlb_fops = {
.proc_open = hwtx_ring_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = hw_lro_auto_tlb_write,
.proc_release = single_release
};
#endif
int reset_event_read(struct seq_file *seq, void *v) int reset_event_read(struct seq_file *seq, void *v)
{ {
@ -1542,6 +1608,7 @@ ssize_t reset_event_write(struct file *file, const char __user *buffer,
return count; return count;
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static const struct file_operations reset_event_fops = { static const struct file_operations reset_event_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = reset_event_open, .open = reset_event_open,
@ -1550,6 +1617,15 @@ static const struct file_operations reset_event_fops = {
.write = reset_event_write, .write = reset_event_write,
.release = single_release .release = single_release
}; };
#else
static const struct proc_ops reset_event_fops = {
.proc_open = reset_event_open,
.proc_read = seq_read,
.proc_lseek = seq_lseek,
.proc_write = reset_event_write,
.proc_release = single_release
};
#endif
struct proc_dir_entry *proc_reg_dir; struct proc_dir_entry *proc_reg_dir;
static struct proc_dir_entry *proc_esw_cnt, *proc_dbg_regs, *proc_reset_event; static struct proc_dir_entry *proc_esw_cnt, *proc_dbg_regs, *proc_reset_event;

View File

@ -19,6 +19,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/pinctrl/devinfo.h> #include <linux/pinctrl/devinfo.h>
#include <linux/phylink.h> #include <linux/phylink.h>
#include <linux/version.h>
#include <net/dsa.h> #include <net/dsa.h>
#include "mtk_eth_soc.h" #include "mtk_eth_soc.h"
@ -437,7 +438,11 @@ init_err:
mac->id, phy_modes(state->interface), err); mac->id, phy_modes(state->interface), err);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
static int mtk_mac_link_state(struct phylink_config *config, static int mtk_mac_link_state(struct phylink_config *config,
#else
static void mtk_mac_pcs_get_state(struct phylink_config *config,
#endif
struct phylink_link_state *state) struct phylink_link_state *state)
{ {
struct mtk_mac *mac = container_of(config, struct mtk_mac, struct mtk_mac *mac = container_of(config, struct mtk_mac,
@ -468,7 +473,9 @@ static int mtk_mac_link_state(struct phylink_config *config,
if (pmsr & MAC_MSR_TX_FC) if (pmsr & MAC_MSR_TX_FC)
state->pause |= MLO_PAUSE_TX; state->pause |= MLO_PAUSE_TX;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
return 1; return 1;
#endif
} }
static void mtk_mac_an_restart(struct phylink_config *config) static void mtk_mac_an_restart(struct phylink_config *config)
@ -490,9 +497,16 @@ static void mtk_mac_link_down(struct phylink_config *config, unsigned int mode,
mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id));
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 7, 0)
static void mtk_mac_link_up(struct phylink_config *config, unsigned int mode, static void mtk_mac_link_up(struct phylink_config *config, unsigned int mode,
phy_interface_t interface, phy_interface_t interface,
struct phy_device *phy) struct phy_device *phy)
#else
static void mtk_mac_link_up(struct phylink_config *config,
struct phy_device *phy,
unsigned int mode, phy_interface_t interface,
int speed, int duplex, bool tx_pause, bool rx_pause)
#endif
{ {
struct mtk_mac *mac = container_of(config, struct mtk_mac, struct mtk_mac *mac = container_of(config, struct mtk_mac,
phylink_config); phylink_config);
@ -590,7 +604,11 @@ static void mtk_validate(struct phylink_config *config,
static const struct phylink_mac_ops mtk_phylink_ops = { static const struct phylink_mac_ops mtk_phylink_ops = {
.validate = mtk_validate, .validate = mtk_validate,
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
.mac_link_state = mtk_mac_link_state, .mac_link_state = mtk_mac_link_state,
#else
.mac_pcs_get_state = mtk_mac_pcs_get_state,
#endif
.mac_an_restart = mtk_mac_an_restart, .mac_an_restart = mtk_mac_an_restart,
.mac_config = mtk_mac_config, .mac_config = mtk_mac_config,
.mac_link_down = mtk_mac_link_down, .mac_link_down = mtk_mac_link_down,
@ -2490,7 +2508,11 @@ static void mtk_dma_free(struct mtk_eth *eth)
} }
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
static void mtk_tx_timeout(struct net_device *dev) static void mtk_tx_timeout(struct net_device *dev)
#else
static void mtk_tx_timeout(struct net_device *dev, unsigned int txqueue)
#endif
{ {
struct mtk_mac *mac = netdev_priv(dev); struct mtk_mac *mac = netdev_priv(dev);
struct mtk_eth *eth = mac->hw; struct mtk_eth *eth = mac->hw;
@ -3402,9 +3424,15 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
{ {
const __be32 *_id = of_get_property(np, "reg", NULL); const __be32 *_id = of_get_property(np, "reg", NULL);
struct phylink *phylink; struct phylink *phylink;
int phy_mode, id, err;
struct mtk_mac *mac; struct mtk_mac *mac;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
int phy_mode, id, err;
#else
int id, err;
phy_interface_t phy_mode = PHY_INTERFACE_MODE_NA;
#endif
if (!_id) { if (!_id) {
dev_err(eth->dev, "missing mac id\n"); dev_err(eth->dev, "missing mac id\n");
return -EINVAL; return -EINVAL;
@ -3448,8 +3476,13 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET; mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET;
/* phylink create */ /* phylink create */
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
phy_mode = of_get_phy_mode(np); phy_mode = of_get_phy_mode(np);
if (phy_mode < 0) { if (phy_mode < 0) {
#else
of_get_phy_mode(np, &phy_mode);
if (phy_mode == PHY_INTERFACE_MODE_NA) {
#endif
dev_err(eth->dev, "incorrect phy-mode\n"); dev_err(eth->dev, "incorrect phy-mode\n");
err = -EINVAL; err = -EINVAL;
goto free_netdev; goto free_netdev;

View File

@ -735,7 +735,11 @@ static int hnat_probe(struct platform_device *pdev)
if (!res) if (!res)
return -ENOENT; return -ENOENT;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
hnat_priv->fe_base = devm_ioremap_nocache(&pdev->dev, res->start, hnat_priv->fe_base = devm_ioremap_nocache(&pdev->dev, res->start,
#else
hnat_priv->fe_base = devm_ioremap(&pdev->dev, res->start,
#endif
res->end - res->start + 1); res->end - res->start + 1);
if (!hnat_priv->fe_base) if (!hnat_priv->fe_base)
return -EADDRNOTAVAIL; return -EADDRNOTAVAIL;

View File

@ -17,8 +17,13 @@
#include <linux/if_ether.h> #include <linux/if_ether.h>
#include <net/netevent.h> #include <net/netevent.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/version.h>
#include "hnat_mcast.h" #include "hnat_mcast.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 4, 0)
#include <net/netfilter/nf_hnat.h>
#endif
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
/* Register Offset*/ /* Register Offset*/
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/

View File

@ -2262,7 +2262,6 @@ int hnat_init_debugfs(struct mtk_hnat *h)
{ {
int ret = 0; int ret = 0;
struct dentry *root; struct dentry *root;
struct dentry *file;
long i; long i;
char name[16]; char name[16];
@ -2285,10 +2284,18 @@ int hnat_init_debugfs(struct mtk_hnat *h)
h->regset[i]->nregs = ARRAY_SIZE(hnat_regs); h->regset[i]->nregs = ARRAY_SIZE(hnat_regs);
h->regset[i]->base = h->ppe_base[i]; h->regset[i]->base = h->ppe_base[i];
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0)
struct dentry *file;
snprintf(name, sizeof(name), "regdump%ld", i); snprintf(name, sizeof(name), "regdump%ld", i);
file = debugfs_create_regset32(name, S_IRUGO, file = debugfs_create_regset32(name, S_IRUGO,
root, h->regset[i]); root, h->regset[i]);
if (!file) { if (!file) {
#else
debugfs_create_regset32(name, S_IRUGO,
root, h->regset[i]);
ret = snprintf(name, sizeof(name), "regdump%ld", i);
if (ret != strlen(name)) {
#endif
dev_notice(h->dev, "%s:err at %d\n", __func__, __LINE__); dev_notice(h->dev, "%s:err at %d\n", __func__, __LINE__);
ret = -ENOMEM; ret = -ENOMEM;
goto err1; goto err1;

View File

@ -13,6 +13,7 @@
#include <linux/of_mdio.h> #include <linux/of_mdio.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/version.h>
#ifdef CONFIG_SWCONFIG #ifdef CONFIG_SWCONFIG
#include <linux/switch.h> #include <linux/switch.h>
@ -35,7 +36,11 @@ enum mt753x_model {
struct mt753x_port_cfg { struct mt753x_port_cfg {
struct device_node *np; struct device_node *np;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
int phy_mode; int phy_mode;
#else
phy_interface_t phy_mode;
#endif
u32 enabled: 1; u32 enabled: 1;
u32 force_link: 1; u32 force_link: 1;
u32 speed: 2; u32 speed: 2;

View File

@ -6,6 +6,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/delay.h> #include <linux/delay.h>
@ -269,8 +270,13 @@ static void mt753x_load_port_cfg(struct gsw_mt753x *gsw)
port_cfg->np = port_np; port_cfg->np = port_np;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
port_cfg->phy_mode = of_get_phy_mode(port_np); port_cfg->phy_mode = of_get_phy_mode(port_np);
if (port_cfg->phy_mode < 0) { if (port_cfg->phy_mode < 0) {
#else
of_get_phy_mode(port_np, &port_cfg->phy_mode);
if (port_cfg->phy_mode == PHY_INTERFACE_MODE_NA) {
#endif
dev_info(gsw->dev, "incorrect phy-mode %d\n", port); dev_info(gsw->dev, "incorrect phy-mode %d\n", port);
continue; continue;
} }
@ -523,7 +529,7 @@ static int mt753x_hw_reset(struct gsw_mt753x *gsw)
return 0; return 0;
} }
#if 1 //XDXDXDXD
static int mt753x_mdio_read(struct mii_bus *bus, int addr, int reg) static int mt753x_mdio_read(struct mii_bus *bus, int addr, int reg)
{ {
struct gsw_mt753x *gsw = bus->priv; struct gsw_mt753x *gsw = bus->priv;
@ -566,7 +572,11 @@ static void mt753x_connect_internal_phys(struct gsw_mt753x *gsw,
{ {
struct device_node *phy_np; struct device_node *phy_np;
struct mt753x_phy *phy; struct mt753x_phy *phy;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
int phy_mode; int phy_mode;
#else
phy_interface_t phy_mode = PHY_INTERFACE_MODE_NA;
#endif
u32 phyad; u32 phyad;
if (!mii_np) if (!mii_np)
@ -579,8 +589,13 @@ static void mt753x_connect_internal_phys(struct gsw_mt753x *gsw,
if (phyad >= MT753X_NUM_PHYS) if (phyad >= MT753X_NUM_PHYS)
continue; continue;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
phy_mode = of_get_phy_mode(phy_np); phy_mode = of_get_phy_mode(phy_np);
if (phy_mode < 0) { if (phy_mode < 0) {
#else
of_get_phy_mode(phy_np, &phy_mode);
if (phy_mode == PHY_INTERFACE_MODE_NA) {
#endif
dev_info(gsw->dev, "incorrect phy-mode %d for PHY %d\n", dev_info(gsw->dev, "incorrect phy-mode %d for PHY %d\n",
phy_mode, phyad); phy_mode, phyad);
continue; continue;
@ -655,7 +670,9 @@ static int mt753x_mdio_register(struct gsw_mt753x *gsw)
ret = of_mdiobus_register(gsw->gphy_bus, mii_np); ret = of_mdiobus_register(gsw->gphy_bus, mii_np);
if (ret) { if (ret) {
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
devm_mdiobus_free(gsw->dev, gsw->gphy_bus); devm_mdiobus_free(gsw->dev, gsw->gphy_bus);
#endif
gsw->gphy_bus = NULL; gsw->gphy_bus = NULL;
} else { } else {
if (gsw->phy_status_poll) if (gsw->phy_status_poll)
@ -668,7 +685,6 @@ err_put_node:
return ret; return ret;
} }
#endif
static irqreturn_t mt753x_irq_handler(int irq, void *dev) static irqreturn_t mt753x_irq_handler(int irq, void *dev)
{ {
@ -772,10 +788,8 @@ static int mt753x_probe(struct platform_device *pdev)
"mediatek,phy-poll"); "mediatek,phy-poll");
mt753x_add_gsw(gsw); mt753x_add_gsw(gsw);
#if 1 //XDXD
mt753x_mdio_register(gsw);
#endif
mt753x_mdio_register(gsw);
mt753x_swconfig_init(gsw); mt753x_swconfig_init(gsw);
if (sw->post_init) if (sw->post_init)
@ -806,11 +820,9 @@ static int mt753x_remove(struct platform_device *pdev)
mt753x_swconfig_destroy(gsw); mt753x_swconfig_destroy(gsw);
#endif #endif
#if 1 //XDXD
mt753x_disconnect_internal_phys(gsw); mt753x_disconnect_internal_phys(gsw);
mdiobus_unregister(gsw->gphy_bus); mdiobus_unregister(gsw->gphy_bus);
#endif
mt753x_remove_gsw(gsw); mt753x_remove_gsw(gsw);

View File

@ -25,7 +25,6 @@ CONFIG_CPU_HAS_PREFETCH=y
CONFIG_CPU_HAS_RIXI=y CONFIG_CPU_HAS_RIXI=y
CONFIG_CPU_HAS_SYNC=y CONFIG_CPU_HAS_SYNC=y
CONFIG_CPU_IDLE=y CONFIG_CPU_IDLE=y
# CONFIG_CPU_IDLE_GOV_LADDER is not set
CONFIG_CPU_IDLE_GOV_TEO=y CONFIG_CPU_IDLE_GOV_TEO=y
CONFIG_CPU_MIPS32=y CONFIG_CPU_MIPS32=y
# CONFIG_CPU_MIPS32_R1 is not set # CONFIG_CPU_MIPS32_R1 is not set
@ -41,21 +40,18 @@ CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
CONFIG_CPU_SUPPORTS_HIGHMEM=y CONFIG_CPU_SUPPORTS_HIGHMEM=y
CONFIG_CPU_SUPPORTS_MSA=y CONFIG_CPU_SUPPORTS_MSA=y
CONFIG_CRC16=y CONFIG_CRC16=y
CONFIG_CRYPTO_ACOMP2=y CONFIG_CRYPTO_BLAKE2S=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_DEFLATE=y CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_HASH2=y CONFIG_CRYPTO_GF128MUL=y
CONFIG_CRYPTO_HASH_INFO=y CONFIG_CRYPTO_HASH_INFO=y
CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2 CONFIG_CRYPTO_LIB_POLY1305_RSIZE=2
CONFIG_CRYPTO_LZO=y CONFIG_CRYPTO_LZO=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
CONFIG_CRYPTO_NULL2=y CONFIG_CRYPTO_NULL2=y
CONFIG_CRYPTO_RNG2=y CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_ZSTD=y
CONFIG_CSRC_R4K=y CONFIG_CSRC_R4K=y
CONFIG_DEBUG_PINCTRL=y CONFIG_DEBUG_PINCTRL=y
CONFIG_DIMLIB=y
CONFIG_DMA_NONCOHERENT=y CONFIG_DMA_NONCOHERENT=y
# CONFIG_DTB_GNUBEE1 is not set # CONFIG_DTB_GNUBEE1 is not set
# CONFIG_DTB_GNUBEE2 is not set # CONFIG_DTB_GNUBEE2 is not set
@ -101,7 +97,9 @@ CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT_MAP=y CONFIG_HAS_IOPORT_MAP=y
CONFIG_HIGHMEM=y CONFIG_HIGHMEM=y
CONFIG_I2C=y CONFIG_I2C=y
CONFIG_I2C_ALGOBIT=y
CONFIG_I2C_BOARDINFO=y CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_GPIO=y CONFIG_I2C_GPIO=y
CONFIG_I2C_MT7621=y CONFIG_I2C_MT7621=y
CONFIG_ICPLUS_PHY=y CONFIG_ICPLUS_PHY=y
@ -112,15 +110,15 @@ CONFIG_IRQ_DOMAIN_HIERARCHY=y
CONFIG_IRQ_FORCED_THREADING=y CONFIG_IRQ_FORCED_THREADING=y
CONFIG_IRQ_MIPS_CPU=y CONFIG_IRQ_MIPS_CPU=y
CONFIG_IRQ_WORK=y CONFIG_IRQ_WORK=y
# CONFIG_KERNEL_ZSTD is not set
CONFIG_LED_TRIGGER_PHY=y CONFIG_LED_TRIGGER_PHY=y
CONFIG_LIBFDT=y CONFIG_LIBFDT=y
CONFIG_LLD_VERSION=0 CONFIG_LIB_MEMNEQ=y
CONFIG_LOCK_DEBUGGING_SUPPORT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y
CONFIG_LZO_COMPRESS=y CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y CONFIG_LZO_DECOMPRESS=y
CONFIG_MDIO_BUS=y CONFIG_MDIO_BUS=y
CONFIG_MDIO_DEVICE=y CONFIG_MDIO_DEVICE=y
CONFIG_MDIO_DEVRES=y
CONFIG_MEMFD_CREATE=y CONFIG_MEMFD_CREATE=y
CONFIG_MFD_SYSCON=y CONFIG_MFD_SYSCON=y
CONFIG_MIGRATION=y CONFIG_MIGRATION=y
@ -129,7 +127,6 @@ CONFIG_MIKROTIK_RB_SYSFS=y
CONFIG_MIPS=y CONFIG_MIPS=y
CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_BITS=8
CONFIG_MIPS_ASID_SHIFT=0 CONFIG_MIPS_ASID_SHIFT=0
CONFIG_MIPS_CBPF_JIT=y
CONFIG_MIPS_CLOCK_VSYSCALL=y CONFIG_MIPS_CLOCK_VSYSCALL=y
CONFIG_MIPS_CM=y CONFIG_MIPS_CM=y
# CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set # CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set
@ -142,6 +139,7 @@ CONFIG_MIPS_CPS_CPUIDLE=y
# CONFIG_MIPS_CPS_NS16550_BOOL is not set # CONFIG_MIPS_CPS_NS16550_BOOL is not set
CONFIG_MIPS_CPS_PM=y CONFIG_MIPS_CPS_PM=y
CONFIG_MIPS_CPU_SCACHE=y CONFIG_MIPS_CPU_SCACHE=y
CONFIG_MIPS_EBPF_JIT=y
# CONFIG_MIPS_ELF_APPENDED_DTB is not set # CONFIG_MIPS_ELF_APPENDED_DTB is not set
CONFIG_MIPS_GIC=y CONFIG_MIPS_GIC=y
CONFIG_MIPS_L1_CACHE_SHIFT=5 CONFIG_MIPS_L1_CACHE_SHIFT=5
@ -155,6 +153,7 @@ CONFIG_MIPS_PERF_SHARED_TC_COUNTERS=y
CONFIG_MIPS_RAW_APPENDED_DTB=y CONFIG_MIPS_RAW_APPENDED_DTB=y
CONFIG_MIPS_SPRAM=y CONFIG_MIPS_SPRAM=y
CONFIG_MODULES_USE_ELF_REL=y CONFIG_MODULES_USE_ELF_REL=y
CONFIG_MT753X_GSW=y
CONFIG_MT7621_WDT=y CONFIG_MT7621_WDT=y
# CONFIG_MTD_CFI_INTELEXT is not set # CONFIG_MTD_CFI_INTELEXT is not set
CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_CMDLINE_PARTS=y
@ -185,16 +184,11 @@ CONFIG_NET_DSA=y
CONFIG_NET_DSA_MT7530=y CONFIG_NET_DSA_MT7530=y
CONFIG_NET_DSA_TAG_MTK=y CONFIG_NET_DSA_TAG_MTK=y
CONFIG_NET_FLOW_LIMIT=y CONFIG_NET_FLOW_LIMIT=y
CONFIG_NET_MEDIATEK_SOC=y CONFIG_NET_MEDIATEK_SOC_GE=y
CONFIG_NET_RALINK_GSW_MT7621=y
CONFIG_NET_RALINK_MDIO=y
CONFIG_NET_RALINK_MDIO_MT7620=y
CONFIG_NET_RALINK_MT7621=y
# CONFIG_NET_RALINK_OFFLOAD is not set
CONFIG_NET_RALINK_SOC=y
CONFIG_NET_SWITCHDEV=y CONFIG_NET_SWITCHDEV=y
CONFIG_NET_VENDOR_MEDIATEK=y # CONFIG_NET_VENDOR_MEDIATEK is not set
# CONFIG_NET_VENDOR_RALINK is not set # CONFIG_NET_VENDOR_RALINK is not set
CONFIG_NET_VENDOR_RAW_MEDIATEK=y
CONFIG_NO_HZ_COMMON=y CONFIG_NO_HZ_COMMON=y
CONFIG_NO_HZ_IDLE=y CONFIG_NO_HZ_IDLE=y
CONFIG_NR_CPUS=4 CONFIG_NR_CPUS=4
@ -238,6 +232,7 @@ CONFIG_RCU_NEED_SEGCBLIST=y
CONFIG_RCU_STALL_COMMON=y CONFIG_RCU_STALL_COMMON=y
CONFIG_REALTEK_PHY=y CONFIG_REALTEK_PHY=y
CONFIG_REGMAP=y CONFIG_REGMAP=y
CONFIG_REGMAP_I2C=y
CONFIG_REGMAP_MMIO=y CONFIG_REGMAP_MMIO=y
CONFIG_REGULATOR=y CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_FIXED_VOLTAGE=y
@ -299,7 +294,9 @@ CONFIG_USB_SUPPORT=y
CONFIG_USE_OF=y CONFIG_USE_OF=y
CONFIG_WATCHDOG_CORE=y CONFIG_WATCHDOG_CORE=y
CONFIG_WEAK_ORDERING=y CONFIG_WEAK_ORDERING=y
CONFIG_WEAK_REORDERING_BEYOND_LLSC=y
CONFIG_XPS=y CONFIG_XPS=y
CONFIG_XXHASH=y
CONFIG_ZLIB_DEFLATE=y CONFIG_ZLIB_DEFLATE=y
CONFIG_ZLIB_INFLATE=y CONFIG_ZLIB_INFLATE=y
CONFIG_ZSTD_COMPRESS=y
CONFIG_ZSTD_DECOMPRESS=y

View File

@ -10,7 +10,7 @@ KERNELNAME:=vmlinux vmlinuz
# make Kernel/CopyImage use $LINUX_DIR/vmlinuz # make Kernel/CopyImage use $LINUX_DIR/vmlinuz
IMAGES_DIR:=../../.. IMAGES_DIR:=../../..
DEFAULT_PACKAGES += kmod-mtk-hnat wpad-openssl swconfig kmod-crypto-hw-eip93 DEFAULT_PACKAGES += kmod-mtk-hnat wpad-openssl swconfig
define Target/Description define Target/Description
Build firmware images for Ralink MT7621 based boards. Build firmware images for Ralink MT7621 based boards.

View File

@ -0,0 +1,41 @@
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -125,6 +125,7 @@ source "drivers/net/ethernet/micrel/Kcon
source "drivers/net/ethernet/microchip/Kconfig"
source "drivers/net/ethernet/moxa/Kconfig"
source "drivers/net/ethernet/mscc/Kconfig"
+source "drivers/net/ethernet/mtk/Kconfig"
source "drivers/net/ethernet/myricom/Kconfig"
config FEALNX
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -73,6 +73,7 @@ obj-$(CONFIG_NET_VENDOR_PASEMI) += pasem
obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/
obj-$(CONFIG_NET_VENDOR_QUALCOMM) += qualcomm/
obj-$(CONFIG_NET_VENDOR_RALINK) += ralink/
+obj-$(CONFIG_NET_VENDOR_RAW_MEDIATEK) += mtk/
obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/
obj-$(CONFIG_NET_VENDOR_RENESAS) += renesas/
obj-$(CONFIG_NET_VENDOR_RDC) += rdc/
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -577,6 +577,8 @@ config XILINX_GMII2RGMII
the Reduced Gigabit Media Independent Interface(RGMII) between
Ethernet physical media devices and the Gigabit Ethernet controller.
+source "drivers/net/phy/mtk/mt753x/Kconfig"
+
endif # PHYLIB
config MICREL_KS8995MA
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -99,6 +99,7 @@ obj-$(CONFIG_MICROCHIP_PHY) += microchip
obj-$(CONFIG_MICROCHIP_T1_PHY) += microchip_t1.o
obj-$(CONFIG_MICROSEMI_PHY) += mscc.o
obj-$(CONFIG_NATIONAL_PHY) += national.o
+obj-$(CONFIG_MT753X_GSW) += mtk/mt753x/
obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja11xx.o
obj-$(CONFIG_QSEMI_PHY) += qsemi.o
obj-$(CONFIG_REALTEK_PHY) += realtek.o

View File

@ -0,0 +1,20 @@
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -69,6 +69,7 @@
#include <net/xfrm.h>
#include <net/mpls.h>
#include <net/mptcp.h>
+#include <net/ra_nat.h>
#include <linux/uaccess.h>
#include <trace/events/skb.h>
@@ -1666,6 +1667,9 @@ int pskb_expand_head(struct sk_buff *skb
skb_shinfo(skb),
offsetof(struct skb_shared_info, frags[skb_shinfo(skb)->nr_frags]));
+ /*headroom copy*/
+ memcpy(data, skb->head, FOE_INFO_LEN);
+
/*
* if shinfo is shared we must drop the old head gracefully, but if it
* is not we can just drop the old head and let the existing refcount

View File

@ -0,0 +1,224 @@
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1027,6 +1027,8 @@
struct notifier_block *nb;
};
+struct flow_offload_hw_path;
+
/*
* This structure defines the management hooks for network devices.
* The following hooks can be defined; unless noted otherwise, they are
@@ -1568,6 +1570,7 @@
struct net_device * (*ndo_get_peer_dev)(struct net_device *dev);
int (*ndo_fill_forward_path)(struct net_device_path_ctx *ctx,
struct net_device_path *path);
+ int (*ndo_flow_offload_check)(struct flow_offload_hw_path *path);
};
/**
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -31,6 +31,7 @@
int (*fill_forward_path)(struct net_device_path_ctx *,
struct net_device_path *,
const struct ppp_channel *);
+ int (*flow_offload_check)(struct ppp_channel *, struct flow_offload_hw_path *);
};
struct ppp_channel {
--- a/include/net/netfilter/nf_hnat.h
+++ b/include/net/netfilter/nf_hnat.h
@@ -0,0 +1,17 @@
+#define FLOW_OFFLOAD_PATH_ETHERNET BIT(0)
+#define FLOW_OFFLOAD_PATH_VLAN BIT(1)
+#define FLOW_OFFLOAD_PATH_PPPOE BIT(2)
+#define FLOW_OFFLOAD_PATH_DSLITE BIT(4)
+#define FLOW_OFFLOAD_PATH_6RD BIT(5)
+
+struct flow_offload_hw_path {
+ struct net_device *dev;
+ struct net_device *virt_dev;
+ u32 flags;
+
+ u8 eth_src[ETH_ALEN];
+ u8 eth_dest[ETH_ALEN];
+ u16 vlan_proto;
+ u16 vlan_id;
+ u16 pppoe_sid;
+};
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -52,6 +52,7 @@
#include <linux/nsproxy.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
+#include <net/netfilter/nf_hnat.h>
#define PPP_VERSION "2.4.2"
@@ -1487,6 +1488,26 @@
return chan->ops->fill_forward_path(ctx, path, chan);
}
+static int ppp_flow_offload_check(struct flow_offload_hw_path *path)
+{
+ struct ppp *ppp = netdev_priv(path->dev);
+ struct ppp_channel *chan;
+ struct channel *pch;
+
+ if (ppp->flags & SC_MULTILINK)
+ return -EOPNOTSUPP;
+
+ if (list_empty(&ppp->channels))
+ return -ENODEV;
+
+ pch = list_first_entry(&ppp->channels, struct channel, clist);
+ chan = pch->chan;
+ if (!chan->ops->flow_offload_check)
+ return -EOPNOTSUPP;
+
+ return chan->ops->flow_offload_check(chan, path);
+}
+
static const struct net_device_ops ppp_netdev_ops = {
.ndo_init = ppp_dev_init,
.ndo_uninit = ppp_dev_uninit,
@@ -1494,6 +1515,7 @@
.ndo_do_ioctl = ppp_net_ioctl,
.ndo_get_stats64 = ppp_get_stats64,
.ndo_fill_forward_path = ppp_fill_forward_path,
+ .ndo_flow_offload_check = ppp_flow_offload_check,
};
static struct device_type ppp_type = {
--- a/drivers/net/ppp/pppoe.c
+++ b/drivers/net/ppp/pppoe.c
@@ -79,6 +79,7 @@
#include <net/sock.h>
#include <linux/uaccess.h>
+#include <net/netfilter/nf_hnat.h>
#define PPPOE_HASH_BITS 4
#define PPPOE_HASH_SIZE (1 << PPPOE_HASH_BITS)
@@ -994,9 +996,33 @@
return 0;
}
+static int pppoe_flow_offload_check(struct ppp_channel *chan,
+ struct flow_offload_hw_path *path)
+{
+ struct sock *sk = (struct sock *)chan->private;
+ struct pppox_sock *po = pppox_sk(sk);
+ struct net_device *dev = po->pppoe_dev;
+
+ if (sock_flag(sk, SOCK_DEAD) ||
+ !(sk->sk_state & PPPOX_CONNECTED) || !dev)
+ return -ENODEV;
+
+ path->dev = po->pppoe_dev;
+ path->flags |= FLOW_OFFLOAD_PATH_PPPOE;
+ memcpy(path->eth_src, po->pppoe_dev->dev_addr, ETH_ALEN);
+ memcpy(path->eth_dest, po->pppoe_pa.remote, ETH_ALEN);
+ path->pppoe_sid = be16_to_cpu(po->num);
+
+ if (path->dev->netdev_ops->ndo_flow_offload_check)
+ return path->dev->netdev_ops->ndo_flow_offload_check(path);
+
+ return 0;
+}
+
static const struct ppp_channel_ops pppoe_chan_ops = {
.start_xmit = pppoe_xmit,
.fill_forward_path = pppoe_fill_forward_path,
+ .flow_offload_check = pppoe_flow_offload_check,
};
static int pppoe_recvmsg(struct socket *sock, struct msghdr *m,
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -56,6 +56,7 @@
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include <net/dst_metadata.h>
+#include <net/netfilter/nf_hnat.h>
MODULE_AUTHOR("Ville Nuorvala");
MODULE_DESCRIPTION("IPv6 tunneling device");
@@ -1937,6 +1938,20 @@
}
EXPORT_SYMBOL(ip6_tnl_change_mtu);
+static int ipip6_dev_flow_offload_check(struct flow_offload_hw_path *path)
+{
+ struct net_device *dev = path->dev;
+ struct ip6_tnl *tnl = netdev_priv(dev);
+
+ if (path->flags & FLOW_OFFLOAD_PATH_DSLITE)
+ return -EEXIST;
+
+ path->flags |= FLOW_OFFLOAD_PATH_DSLITE;
+ path->dev = tnl->dev;
+
+ return 0;
+}
+
int ip6_tnl_get_iflink(const struct net_device *dev)
{
struct ip6_tnl *t = netdev_priv(dev);
@@ -2006,6 +2021,7 @@
.ndo_change_mtu = ip6_tnl_change_mtu,
.ndo_get_stats = ip6_get_stats,
.ndo_get_iflink = ip6_tnl_get_iflink,
+ .ndo_flow_offload_check = ipip6_dev_flow_offload_check,
};
#define IPXIPX_FEATURES (NETIF_F_SG | \
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -31,6 +31,8 @@
#include "vlanproc.h"
#include <linux/if_vlan.h>
#include <linux/netpoll.h>
+#include <linux/netfilter.h>
+#include <net/netfilter/nf_hnat.h>
/*
* Create the VLAN header for an arbitrary protocol layer
@@ -790,6 +792,25 @@
return 0;
}
+static int vlan_dev_flow_offload_check(struct flow_offload_hw_path *path)
+{
+ struct net_device *dev = path->dev;
+ struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
+
+ if (path->flags & FLOW_OFFLOAD_PATH_VLAN)
+ return -EEXIST;
+
+ path->flags |= FLOW_OFFLOAD_PATH_VLAN;
+ path->vlan_proto = vlan->vlan_proto;
+ path->vlan_id = vlan->vlan_id;
+ path->virt_dev = dev;
+ path->dev = vlan->real_dev;
+
+ if (vlan->real_dev->netdev_ops->ndo_flow_offload_check)
+ return vlan->real_dev->netdev_ops->ndo_flow_offload_check(path);
+ return 0;
+}
+
static const struct ethtool_ops vlan_ethtool_ops = {
.get_link_ksettings = vlan_ethtool_get_link_ksettings,
.get_drvinfo = vlan_ethtool_get_drvinfo,
@@ -829,6 +850,7 @@
.ndo_fix_features = vlan_dev_fix_features,
.ndo_get_iflink = vlan_dev_get_iflink,
.ndo_fill_forward_path = vlan_dev_fill_forward_path,
+ .ndo_flow_offload_check = vlan_dev_flow_offload_check,
};
static void vlan_dev_free(struct net_device *dev)

View File

@ -1,14 +0,0 @@
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -101,6 +101,11 @@
#define CRYPTO_NOLOAD 0x00008000
/*
+ * Transform masks and values (for crt_flags).
+ */
+#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000
+
+/*
* The algorithm may allocate memory during request processing, i.e. during
* encryption, decryption, or hashing. Users can request an algorithm with this
* flag unset if they can't handle memory allocation failures.

View File

@ -1,12 +0,0 @@
--- a/arch/mips/include/asm/mach-ralink/mt7621/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-ralink/mt7621/cpu-feature-overrides.h
@@ -43,6 +43,9 @@
#define cpu_has_dsp2 0
#define cpu_has_mipsmt 1
+#define cpu_has_vint 0
+#define cpu_has_veic 0
+
#define cpu_has_64bits 0
#define cpu_has_64bit_zero_reg 0
#define cpu_has_64bit_gp_regs 0