ramips: 5.10: add basic dsa offload for mt7621

This commit is contained in:
AmadeusGhost 2023-05-09 00:28:01 +08:00
parent ef12a97354
commit 0f270a2436
3 changed files with 67 additions and 22 deletions

View File

@ -1,6 +1,6 @@
--- a/drivers/net/ethernet/Kconfig
+++ b/drivers/net/ethernet/Kconfig
@@ -125,6 +125,7 @@ source "drivers/net/ethernet/micrel/Kcon
@@ -124,6 +124,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"
@ -10,7 +10,7 @@
config FEALNX
--- a/drivers/net/ethernet/Makefile
+++ b/drivers/net/ethernet/Makefile
@@ -73,6 +73,7 @@ obj-$(CONFIG_NET_VENDOR_PASEMI) += pasem
@@ -72,6 +72,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/
@ -20,7 +20,7 @@
obj-$(CONFIG_NET_VENDOR_RDC) += rdc/
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -577,6 +577,8 @@ config XILINX_GMII2RGMII
@@ -394,6 +394,8 @@ config XILINX_GMII2RGMII
the Reduced Gigabit Media Independent Interface(RGMII) between
Ethernet physical media devices and the Gigabit Ethernet controller.
@ -31,9 +31,9 @@
config MICREL_KS8995MA
--- a/drivers/net/phy/Makefile
+++ b/drivers/net/phy/Makefile
@@ -99,6 +99,7 @@ obj-$(CONFIG_MICROCHIP_PHY) += microchip
@@ -84,6 +84,7 @@ obj-$(CONFIG_MICROCHIP_PHY) += microchip
obj-$(CONFIG_MICROCHIP_T1_PHY) += microchip_t1.o
obj-$(CONFIG_MICROSEMI_PHY) += mscc.o
obj-$(CONFIG_MICROSEMI_PHY) += mscc/
obj-$(CONFIG_NATIONAL_PHY) += national.o
+obj-$(CONFIG_MT753X_GSW) += mtk/mt753x/
obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja11xx.o

View File

@ -1,6 +1,6 @@
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -69,6 +69,7 @@
@@ -70,6 +70,7 @@
#include <net/xfrm.h>
#include <net/mpls.h>
#include <net/mptcp.h>
@ -8,7 +8,7 @@
#include <linux/uaccess.h>
#include <trace/events/skb.h>
@@ -1666,6 +1667,9 @@ int pskb_expand_head(struct sk_buff *skb
@@ -1686,6 +1687,9 @@ int pskb_expand_head(struct sk_buff *skb
skb_shinfo(skb),
offsetof(struct skb_shared_info, frags[skb_shinfo(skb)->nr_frags]));

View File

@ -1,6 +1,6 @@
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1027,6 +1027,8 @@
@@ -1027,6 +1027,8 @@ struct netdev_net_notifier {
struct notifier_block *nb;
};
@ -9,7 +9,7 @@
/*
* This structure defines the management hooks for network devices.
* The following hooks can be defined; unless noted otherwise, they are
@@ -1568,6 +1570,7 @@
@@ -1568,6 +1570,7 @@ struct net_device_ops {
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);
@ -17,10 +17,9 @@
};
/**
--- a/include/linux/ppp_channel.h
+++ b/include/linux/ppp_channel.h
@@ -31,6 +31,7 @@
@@ -31,6 +31,7 @@ struct ppp_channel_ops {
int (*fill_forward_path)(struct net_device_path_ctx *,
struct net_device_path *,
const struct ppp_channel *);
@ -28,13 +27,13 @@
};
struct ppp_channel {
--- a/include/net/netfilter/nf_hnat.h
--- /dev/null
+++ b/include/net/netfilter/nf_hnat.h
@@ -0,0 +1,17 @@
@@ -0,0 +1,19 @@
+#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_DSA BIT(3)
+#define FLOW_OFFLOAD_PATH_DSLITE BIT(4)
+#define FLOW_OFFLOAD_PATH_6RD BIT(5)
+
@ -47,6 +46,7 @@
+ u8 eth_dest[ETH_ALEN];
+ u16 vlan_proto;
+ u16 vlan_id;
+ u16 dsa_port;
+ u16 pppoe_sid;
+};
--- a/drivers/net/ppp/ppp_generic.c
@ -59,7 +59,7 @@
#define PPP_VERSION "2.4.2"
@@ -1487,6 +1488,26 @@
@@ -1487,6 +1488,26 @@ static int ppp_fill_forward_path(struct
return chan->ops->fill_forward_path(ctx, path, chan);
}
@ -86,7 +86,7 @@
static const struct net_device_ops ppp_netdev_ops = {
.ndo_init = ppp_dev_init,
.ndo_uninit = ppp_dev_uninit,
@@ -1494,6 +1515,7 @@
@@ -1494,6 +1515,7 @@ static const struct net_device_ops ppp_n
.ndo_do_ioctl = ppp_net_ioctl,
.ndo_get_stats64 = ppp_get_stats64,
.ndo_fill_forward_path = ppp_fill_forward_path,
@ -104,7 +104,7 @@
#define PPPOE_HASH_BITS 4
#define PPPOE_HASH_SIZE (1 << PPPOE_HASH_BITS)
@@ -994,9 +996,33 @@
@@ -994,9 +995,33 @@ static int pppoe_fill_forward_path(struc
return 0;
}
@ -138,6 +138,51 @@
};
static int pppoe_recvmsg(struct socket *sock, struct msghdr *m,
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -19,6 +19,8 @@
#include <linux/if_bridge.h>
#include <linux/netpoll.h>
#include <linux/ptp_classify.h>
+#include <linux/netfilter.h>
+#include <net/netfilter/nf_hnat.h>
#include "dsa_priv.h"
@@ -1655,6 +1657,25 @@ static int dsa_slave_fill_forward_path(s
return 0;
}
+static int dsa_flow_offload_check(struct flow_offload_hw_path *path)
+{
+ struct net_device *dev = path->dev;
+ struct dsa_port *dp;
+
+ if (!(path->flags & FLOW_OFFLOAD_PATH_ETHERNET))
+ return -EINVAL;
+
+ dp = dsa_slave_to_port(dev);
+ path->dsa_port = dp->index;
+ path->dev = dsa_slave_to_master(dev);
+ path->flags |= FLOW_OFFLOAD_PATH_DSA;
+
+ if (path->dev->netdev_ops->ndo_flow_offload_check)
+ return path->dev->netdev_ops->ndo_flow_offload_check(path);
+
+ return 0;
+}
+
static const struct net_device_ops dsa_slave_netdev_ops = {
.ndo_open = dsa_slave_open,
.ndo_stop = dsa_slave_close,
@@ -1679,6 +1700,7 @@ static const struct net_device_ops dsa_s
.ndo_vlan_rx_add_vid = dsa_slave_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = dsa_slave_vlan_rx_kill_vid,
.ndo_get_devlink_port = dsa_slave_get_devlink_port,
+ .ndo_flow_offload_check = dsa_flow_offload_check,
.ndo_change_mtu = dsa_slave_change_mtu,
.ndo_fill_forward_path = dsa_slave_fill_forward_path,
};
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -56,6 +56,7 @@
@ -148,7 +193,7 @@
MODULE_AUTHOR("Ville Nuorvala");
MODULE_DESCRIPTION("IPv6 tunneling device");
@@ -1937,6 +1938,20 @@
@@ -1938,6 +1939,20 @@ int ip6_tnl_change_mtu(struct net_device
}
EXPORT_SYMBOL(ip6_tnl_change_mtu);
@ -169,7 +214,7 @@
int ip6_tnl_get_iflink(const struct net_device *dev)
{
struct ip6_tnl *t = netdev_priv(dev);
@@ -2006,6 +2021,7 @@
@@ -2007,6 +2022,7 @@ static const struct net_device_ops ip6_t
.ndo_change_mtu = ip6_tnl_change_mtu,
.ndo_get_stats = ip6_get_stats,
.ndo_get_iflink = ip6_tnl_get_iflink,
@ -188,7 +233,7 @@
/*
* Create the VLAN header for an arbitrary protocol layer
@@ -790,6 +792,25 @@
@@ -790,6 +792,25 @@ static int vlan_dev_fill_forward_path(st
return 0;
}
@ -213,8 +258,8 @@
+
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 @@
.get_drvinfo = vlan_ethtool_get_drvinfo,
@@ -829,6 +850,7 @@ static const struct net_device_ops vlan_
.ndo_fix_features = vlan_dev_fix_features,
.ndo_get_iflink = vlan_dev_get_iflink,
.ndo_fill_forward_path = vlan_dev_fill_forward_path,