mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/staging/chunkeey.git] / target / linux / layerscape / patches-5.4 / 701-net-0033-sdk_dpaa-adapt-to-the-new-API-for-MTU-changes.patch
1 From 828ec34f1fade88f1e751b7000959aaddfe44e5c Mon Sep 17 00:00:00 2001
2 From: Camelia Groza <camelia.groza@nxp.com>
3 Date: Thu, 21 Sep 2017 10:50:57 +0300
4 Subject: [PATCH] sdk_dpaa: adapt to the new API for MTU changes
5
6 Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
7 ---
8 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c | 14 +++++++++++-
9 .../ethernet/freescale/sdk_dpaa/dpaa_eth_common.c | 25 ----------------------
10 .../ethernet/freescale/sdk_dpaa/dpaa_eth_common.h | 1 -
11 3 files changed, 13 insertions(+), 27 deletions(-)
12
13 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
14 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
15 @@ -681,7 +681,6 @@ static const struct net_device_ops dpa_p
16 #ifdef CONFIG_FSL_DPAA_ETH_USE_NDO_SELECT_QUEUE
17 .ndo_select_queue = dpa_select_queue,
18 #endif
19 - .ndo_change_mtu = dpa_change_mtu,
20 .ndo_set_rx_mode = dpa_set_rx_mode,
21 .ndo_init = dpa_ndo_init,
22 .ndo_set_features = dpa_set_features,
23 @@ -758,6 +757,19 @@ static int dpa_private_netdev_init(struc
24 net_dev->mem_start = priv->mac_dev->res->start;
25 net_dev->mem_end = priv->mac_dev->res->end;
26
27 + /* Configure the maximum MTU according to the FMan's MAXFRM */
28 + net_dev->min_mtu = ETH_MIN_MTU;
29 + net_dev->max_mtu = dpa_get_max_mtu();
30 +
31 +#ifndef CONFIG_PPC
32 + /* Due to the A010022 FMan errata, we can not use contig frames larger
33 + * than 4K, nor S/G frames. We need to prevent the user from setting a
34 + * large MTU.
35 + */
36 + if (unlikely(dpaa_errata_a010022))
37 + net_dev->max_mtu = DPA_BP_RAW_SIZE;
38 +#endif
39 +
40 net_dev->hw_features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
41 NETIF_F_LLTX);
42
43 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c
44 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.c
45 @@ -261,31 +261,6 @@ dpa_get_stats64(struct net_device *net_d
46 }
47 EXPORT_SYMBOL(dpa_get_stats64);
48
49 -int dpa_change_mtu(struct net_device *net_dev, int new_mtu)
50 -{
51 - int max_mtu = dpa_get_max_mtu();
52 -
53 -#ifndef CONFIG_PPC
54 - /* Due to the A010022 FMan errata, we can not use contig frames larger
55 - * than 4K, nor S/G frames. We need to prevent the user from setting a
56 - * large MTU.
57 - */
58 - if (unlikely(dpaa_errata_a010022))
59 - max_mtu = DPA_BP_RAW_SIZE;
60 -#endif
61 -
62 - /* Make sure we don't exceed the Ethernet controller's MAXFRM */
63 - if (new_mtu < 68 || new_mtu > max_mtu) {
64 - netdev_err(net_dev, "Invalid L3 mtu %d (must be between %d and %d).\n",
65 - new_mtu, 68, max_mtu);
66 - return -EINVAL;
67 - }
68 - net_dev->mtu = new_mtu;
69 -
70 - return 0;
71 -}
72 -EXPORT_SYMBOL(dpa_change_mtu);
73 -
74 /* .ndo_init callback */
75 int dpa_ndo_init(struct net_device *net_dev)
76 {
77 --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
78 +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_common.h
79 @@ -143,7 +143,6 @@ void __cold dpa_timeout(struct net_devic
80 void __cold
81 dpa_get_stats64(struct net_device *net_dev,
82 struct rtnl_link_stats64 *stats);
83 -int dpa_change_mtu(struct net_device *net_dev, int new_mtu);
84 int dpa_ndo_init(struct net_device *net_dev);
85 int dpa_set_features(struct net_device *dev, netdev_features_t features);
86 netdev_features_t dpa_fix_features(struct net_device *dev,