layerscape: add ls1088ardb device support
[openwrt/staging/lynxis/omap.git] / target / linux / layerscape / patches-4.4 / 7205-fsl-dpaa2-eth-sanitize-supported-private-flags.patch
1 From 51106cb1fd14dfbf62c2760921463376f56ac732 Mon Sep 17 00:00:00 2001
2 From: Bogdan Purcareata <bogdan.purcareata@nxp.com>
3 Date: Tue, 21 Jun 2016 18:40:47 +0000
4 Subject: [PATCH 205/226] fsl-dpaa2: eth: sanitize supported private flags
5
6 On linux-v4.6 with CONFIG_MACVLAN=y, when bringing up a ni interface, the
7 network stack crashes due to a segfault. This is related to the
8 macvlan_device_event notifier, which registers itself to all the network
9 interface in the system.
10
11 The notifier reads the netdev private flags and incorrectly qualifies
12 the interface as a macvlan port, since both the IFF_MACVLAN_PORT and
13 IFF_PROMISC flags have the same offset. Code spelunking reveals that
14 IFF_PROMISC is only used as an interface flag, not a private interface
15 flag.
16
17 A similar situation happens with IFF_ALLMULTI, which overlaps with
18 IFF_BRIDGE_PORT. No info on the consequences of this, since I haven't
19 tested bridge scenarios. The interface can still be set in allmulti
20 mode using userspace tools (e.g. ifconfig).
21
22 IFF_MULTICAST overlaps with IFF_UNICAST_FLT, therefore the current code
23 has no effect as it is. The closest multicast activation based on device
24 capabilities has been seen in the case of the Aeroflex Gaisler Ethernet
25 MAC (aeroflex/greth.c) - here, the runtime (not private) flag is set on
26 device probe. On a side node, ether_setup enables IFF_MULTICAST by default.
27
28 Remove IFF_PROMISC, IFF_ALLMULTI and IFF_MULTICAST from device capabilities
29 init.
30
31 Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
32 ---
33 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c | 7 +------
34 1 file changed, 1 insertion(+), 6 deletions(-)
35
36 --- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
37 +++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.c
38 @@ -1176,18 +1176,13 @@ static int dpaa2_eth_init(struct net_dev
39 u32 options = priv->dpni_attrs.options;
40
41 /* Capabilities listing */
42 - supported |= IFF_LIVE_ADDR_CHANGE | IFF_PROMISC | IFF_ALLMULTI;
43 + supported |= IFF_LIVE_ADDR_CHANGE;
44
45 if (options & DPNI_OPT_UNICAST_FILTER)
46 supported |= IFF_UNICAST_FLT;
47 else
48 not_supported |= IFF_UNICAST_FLT;
49
50 - if (options & DPNI_OPT_MULTICAST_FILTER)
51 - supported |= IFF_MULTICAST;
52 - else
53 - not_supported |= IFF_MULTICAST;
54 -
55 net_dev->priv_flags |= supported;
56 net_dev->priv_flags &= ~not_supported;
57