1 From e9c0434a55a0ddf28b1e7868890eb7557b2c28f9 Mon Sep 17 00:00:00 2001
2 From: Razvan Stefanescu <razvan.stefanescu@nxp.com>
3 Date: Thu, 17 Aug 2017 19:47:22 +0300
4 Subject: [PATCH] staging: dpaa2-evb: Update MTU update procedure
6 Set limits on the MTU to accommodate netdevice update. There is no need to
7 check the limits before setting the new value.
9 Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
11 drivers/staging/fsl-dpaa2/evb/evb.c | 18 ++++++++----------
12 1 file changed, 8 insertions(+), 10 deletions(-)
14 --- a/drivers/staging/fsl-dpaa2/evb/evb.c
15 +++ b/drivers/staging/fsl-dpaa2/evb/evb.c
16 @@ -53,9 +53,9 @@ static const char evb_drv_version[] = "0
17 #define DPDMUX_MAX_IRQ_NUM 2
19 /* MAX FRAME LENGTH (currently 10k) */
20 -#define EVB_MAX_FRAME_LENGTH (10 * 1024)
21 -/* MIN FRAME LENGTH (64 bytes + 4 bytes CRC) */
22 -#define EVB_MIN_FRAME_LENGTH 68
23 +#define EVB_MAX_FRAME_LENGTH (10 * 1024)
24 +#define EVB_MAX_MTU (EVB_MAX_FRAME_LENGTH - VLAN_ETH_HLEN)
25 +#define EVB_MIN_MTU 68
27 struct evb_port_priv {
28 struct net_device *netdev;
29 @@ -457,16 +457,10 @@ static int evb_change_mtu(struct net_dev
30 if (port_priv->port_index > 0)
33 - if (mtu < EVB_MIN_FRAME_LENGTH || mtu > EVB_MAX_FRAME_LENGTH) {
34 - netdev_err(netdev, "Invalid MTU %d. Valid range is: %d..%d\n",
35 - mtu, EVB_MIN_FRAME_LENGTH, EVB_MAX_FRAME_LENGTH);
39 err = dpdmux_set_max_frame_length(evb_priv->mc_io,
43 + (uint16_t)(mtu + VLAN_ETH_HLEN));
46 netdev_err(netdev, "dpdmux_ul_set_max_frame_length err %d\n",
47 @@ -1291,6 +1285,10 @@ static int evb_probe(struct fsl_mc_devic
49 list_add(&port_priv->list, &priv->port_list);
51 + /* Set MTU limits only on uplink */
52 + port_netdev->min_mtu = EVB_MIN_MTU;
53 + port_netdev->max_mtu = EVB_MAX_MTU;
55 err = register_netdev(netdev);