Commit 502e84e2 authored by Felix Fietkau's avatar Felix Fietkau Committed by David S. Miller

net: ethernet: mtk_eth_soc: add flow offloading support

This adds support for offloading IPv4 routed flows, including SNAT/DNAT,
one VLAN, PPPoE and DSA.
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ba37b7ca
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
# #
obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk_eth.o obj-$(CONFIG_NET_MEDIATEK_SOC) += mtk_eth.o
mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_eth_path.o mtk_ppe.o mtk_ppe_debugfs.o mtk_eth-y := mtk_eth_soc.o mtk_sgmii.o mtk_eth_path.o mtk_ppe.o mtk_ppe_debugfs.o mtk_ppe_offload.o
obj-$(CONFIG_NET_MEDIATEK_STAR_EMAC) += mtk_star_emac.o obj-$(CONFIG_NET_MEDIATEK_STAR_EMAC) += mtk_star_emac.o
...@@ -2843,6 +2843,7 @@ static const struct net_device_ops mtk_netdev_ops = { ...@@ -2843,6 +2843,7 @@ static const struct net_device_ops mtk_netdev_ops = {
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = mtk_poll_controller, .ndo_poll_controller = mtk_poll_controller,
#endif #endif
.ndo_setup_tc = mtk_eth_setup_tc,
}; };
static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
...@@ -3104,6 +3105,10 @@ static int mtk_probe(struct platform_device *pdev) ...@@ -3104,6 +3105,10 @@ static int mtk_probe(struct platform_device *pdev)
eth->base + MTK_ETH_PPE_BASE, 2); eth->base + MTK_ETH_PPE_BASE, 2);
if (err) if (err)
goto err_free_dev; goto err_free_dev;
err = mtk_eth_offload_init(eth);
if (err)
goto err_free_dev;
} }
for (i = 0; i < MTK_MAX_DEVS; i++) { for (i = 0; i < MTK_MAX_DEVS; i++) {
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/u64_stats_sync.h> #include <linux/u64_stats_sync.h>
#include <linux/refcount.h> #include <linux/refcount.h>
#include <linux/phylink.h> #include <linux/phylink.h>
#include <linux/rhashtable.h>
#include "mtk_ppe.h" #include "mtk_ppe.h"
#define MTK_QDMA_PAGE_SIZE 2048 #define MTK_QDMA_PAGE_SIZE 2048
...@@ -41,7 +42,8 @@ ...@@ -41,7 +42,8 @@
NETIF_F_HW_VLAN_CTAG_RX | \ NETIF_F_HW_VLAN_CTAG_RX | \
NETIF_F_SG | NETIF_F_TSO | \ NETIF_F_SG | NETIF_F_TSO | \
NETIF_F_TSO6 | \ NETIF_F_TSO6 | \
NETIF_F_IPV6_CSUM) NETIF_F_IPV6_CSUM |\
NETIF_F_HW_TC)
#define MTK_HW_FEATURES_MT7628 (NETIF_F_SG | NETIF_F_RXCSUM) #define MTK_HW_FEATURES_MT7628 (NETIF_F_SG | NETIF_F_RXCSUM)
#define NEXT_DESP_IDX(X, Y) (((X) + 1) & ((Y) - 1)) #define NEXT_DESP_IDX(X, Y) (((X) + 1) & ((Y) - 1))
...@@ -914,6 +916,7 @@ struct mtk_eth { ...@@ -914,6 +916,7 @@ struct mtk_eth {
int ip_align; int ip_align;
struct mtk_ppe ppe; struct mtk_ppe ppe;
struct rhashtable flow_table;
}; };
/* struct mtk_mac - the structure that holds the info about the MACs of the /* struct mtk_mac - the structure that holds the info about the MACs of the
...@@ -958,4 +961,9 @@ int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id); ...@@ -958,4 +961,9 @@ int mtk_gmac_sgmii_path_setup(struct mtk_eth *eth, int mac_id);
int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id); int mtk_gmac_gephy_path_setup(struct mtk_eth *eth, int mac_id);
int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id); int mtk_gmac_rgmii_path_setup(struct mtk_eth *eth, int mac_id);
int mtk_eth_offload_init(struct mtk_eth *eth);
int mtk_eth_setup_tc(struct net_device *dev, enum tc_setup_type type,
void *type_data);
#endif /* MTK_ETH_H */ #endif /* MTK_ETH_H */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment