12 Apr, 2018

1 commit

  • [ Upstream commit ec1d8ccb07deaf30fd0508af6755364ac47dc08d ]

    Just like function ethtool_get_ts_info(), we should also consider the
    phy_driver ts_info call back. For example, driver dp83640.

    Fixes: 37dd9255b2f6 ("vlan: Pass ethtool get_ts_info queries to real device.")
    Acked-by: Richard Cochran
    Signed-off-by: Hangbin Liu
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Hangbin Liu
     

16 Jun, 2017

1 commit

  • It seems like a historic accident that these return unsigned char *,
    and in many places that means casts are required, more often than not.

    Make these functions return void * and remove all the casts across
    the tree, adding a (u8 *) cast only where the unsigned char pointer
    was used directly, all done with the following spatch:

    @@
    expression SKB, LEN;
    typedef u8;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    @@
    - *(fn(SKB, LEN))
    + *(u8 *)fn(SKB, LEN)

    @@
    expression E, SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    type T;
    @@
    - E = ((T *)(fn(SKB, LEN)))
    + E = fn(SKB, LEN)

    @@
    expression SKB, LEN;
    identifier fn = { skb_push, __skb_push, skb_push_rcsum };
    @@
    - fn(SKB, LEN)[0]
    + *(u8 *)fn(SKB, LEN)

    Note that the last part there converts from push(...)[0] to the
    more idiomatic *(u8 *)push(...).

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

15 Jun, 2017

1 commit


09 Jun, 2017

1 commit

  • Remove support for bridge bypass ndos from stacked devices. At this point
    no driver which supports stack device behavior offload supports operation
    with SELF flag. The case for upper device is already taken care of in both
    of the following cases:

    1. FDB add/del - driver should check at the notification cb if the
    stacked device contains his ports.

    2. Port attribute - calls switchdev code directly which checks
    for case of stack device.

    Signed-off-by: Arkadi Sharshevsky
    Reviewed-by: Ido Schimmel
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Arkadi Sharshevsky
     

08 Jun, 2017

1 commit

  • Network devices can allocate reasources and private memory using
    netdev_ops->ndo_init(). However, the release of these resources
    can occur in one of two different places.

    Either netdev_ops->ndo_uninit() or netdev->destructor().

    The decision of which operation frees the resources depends upon
    whether it is necessary for all netdev refs to be released before it
    is safe to perform the freeing.

    netdev_ops->ndo_uninit() presumably can occur right after the
    NETDEV_UNREGISTER notifier completes and the unicast and multicast
    address lists are flushed.

    netdev->destructor(), on the other hand, does not run until the
    netdev references all go away.

    Further complicating the situation is that netdev->destructor()
    almost universally does also a free_netdev().

    This creates a problem for the logic in register_netdevice().
    Because all callers of register_netdevice() manage the freeing
    of the netdev, and invoke free_netdev(dev) if register_netdevice()
    fails.

    If netdev_ops->ndo_init() succeeds, but something else fails inside
    of register_netdevice(), it does call ndo_ops->ndo_uninit(). But
    it is not able to invoke netdev->destructor().

    This is because netdev->destructor() will do a free_netdev() and
    then the caller of register_netdevice() will do the same.

    However, this means that the resources that would normally be released
    by netdev->destructor() will not be.

    Over the years drivers have added local hacks to deal with this, by
    invoking their destructor parts by hand when register_netdevice()
    fails.

    Many drivers do not try to deal with this, and instead we have leaks.

    Let's close this hole by formalizing the distinction between what
    private things need to be freed up by netdev->destructor() and whether
    the driver needs unregister_netdevice() to perform the free_netdev().

    netdev->priv_destructor() performs all actions to free up the private
    resources that used to be freed by netdev->destructor(), except for
    free_netdev().

    netdev->needs_free_netdev is a boolean that indicates whether
    free_netdev() should be done at the end of unregister_netdevice().

    Now, register_netdevice() can sanely release all resources after
    ndo_ops->ndo_init() succeeds, by invoking both ndo_ops->ndo_uninit()
    and netdev->priv_destructor().

    And at the end of unregister_netdevice(), we invoke
    netdev->priv_destructor() and optionally call free_netdev().

    Signed-off-by: David S. Miller

    David S. Miller
     

09 May, 2017

1 commit

  • Vlan devices, like all other software devices, enable
    NETIF_F_HW_CSUM feature. However, unlike all the othe other
    software devices, vlans will switch to using IP|IPV6_CSUM
    features, if the underlying devices uses them. In these situations,
    checksum offload features on the vlan device can't be controlled
    via ethtool.

    This patch makes vlans keep HW_CSUM feature if the underlying
    device supports checksum offloading. This makes vlan devices
    behave like other software devices, and restores control to the
    user.

    A side-effect is that some offload settings (typically UFO)
    may be enabled on the vlan device while being disabled on the HW.
    However, the GSO code will correctly process the packets. This
    actually results in slightly better raw throughput.

    Signed-off-by: Vladislav Yasevich
    Acked-by: Alexander Duyck
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

22 Mar, 2017

1 commit

  • wanted_features is a set of features which have to be enabled if a
    hardware allows that.

    Currently when a vlan device is created, its wanted_features is set to
    current features of its base device.

    The problem is that the base device can get new features and they are
    not propagated to vlan-s of this device.

    If we look at bonding devices, they doesn't have this problem and this
    patch suggests to fix this issue by the same way how it works for bonding
    devices.

    We meet this problem, when we try to create a vlan device over a bonding
    device. When a system are booting, real devices require time to be
    initialized, so bonding devices created without slaves, then vlan
    devices are created and only then ethernet devices are added to the
    bonding device. As a result we have vlan devices with disabled
    scatter-gather.

    * create a bonding device
    $ ip link add bond0 type bond
    $ ethtool -k bond0 | grep scatter
    scatter-gather: off
    tx-scatter-gather: off [requested on]
    tx-scatter-gather-fraglist: off [requested on]

    * create a vlan device
    $ ip link add link bond0 name bond0.10 type vlan id 10
    $ ethtool -k bond0.10 | grep scatter
    scatter-gather: off
    tx-scatter-gather: off
    tx-scatter-gather-fraglist: off

    * Add a slave device to bond0
    $ ip link set dev eth0 master bond0

    And now we can see that the bond0 device has got the scatter-gather
    feature, but the bond0.10 hasn't got it.
    [root@laptop linux-task-diag]# ethtool -k bond0 | grep scatter
    scatter-gather: on
    tx-scatter-gather: on
    tx-scatter-gather-fraglist: on
    [root@laptop linux-task-diag]# ethtool -k bond0.10 | grep scatter
    scatter-gather: off
    tx-scatter-gather: off
    tx-scatter-gather-fraglist: off

    With this patch the vlan device will get all new features from the
    bonding device.

    Here is a call trace how features which are set in this patch reach
    dev->wanted_features.

    register_netdevice
    vlan_dev_init
    ...
    dev->hw_features = NETIF_F_HW_CSUM | NETIF_F_SG |
    NETIF_F_FRAGLIST | NETIF_F_GSO_SOFTWARE |
    NETIF_F_HIGHDMA | NETIF_F_SCTP_CRC |
    NETIF_F_ALL_FCOE;

    dev->features |= dev->hw_features;
    ...
    dev->wanted_features = dev->features & dev->hw_features;
    __netdev_update_features(dev);
    vlan_dev_fix_features
    ...

    Cc: Alexey Kuznetsov
    Cc: Patrick McHardy
    Cc: "David S. Miller"
    Signed-off-by: Andrei Vagin
    Signed-off-by: David S. Miller

    Andrey Vagin
     

07 Feb, 2017

1 commit

  • In commit 18bfb924f000 ("net: introduce default neigh_construct/destroy
    ndo calls for L2 upper devices") we added these ndos to stacked devices
    such as team and bond, so that calls will be propagated to mlxsw.

    However, previous commit removed the reliance on these ndos and no new
    users of these ndos have appeared since above mentioned commit. We can
    therefore safely remove this dead code.

    Signed-off-by: Ido Schimmel
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Ido Schimmel
     

09 Jan, 2017

1 commit

  • The network device operation for reading statistics is only called
    in one place, and it ignores the return value. Having a structure
    return value is potentially confusing because some future driver could
    incorrectly assume that the return value was used.

    Fix all drivers with ndo_get_stats64 to have a void function.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    stephen hemminger
     

21 Oct, 2016

1 commit

  • geneve:
    - Merge __geneve_change_mtu back into geneve_change_mtu, set max_mtu
    - This one isn't quite as straight-forward as others, could use some
    closer inspection and testing

    macvlan:
    - set min/max_mtu

    tun:
    - set min/max_mtu, remove tun_net_change_mtu

    vxlan:
    - Merge __vxlan_change_mtu back into vxlan_change_mtu
    - Set max_mtu to IP_MAX_MTU and retain dynamic MTU range checks in
    change_mtu function
    - This one is also not as straight-forward and could use closer inspection
    and testing from vxlan folks

    bridge:
    - set max_mtu of IP_MAX_MTU and retain dynamic MTU range checks in
    change_mtu function

    openvswitch:
    - set min/max_mtu, remove internal_dev_change_mtu
    - note: max_mtu wasn't checked previously, it's been set to 65535, which
    is the largest possible size supported

    sch_teql:
    - set min/max_mtu (note: max_mtu previously unchecked, used max of 65535)

    macsec:
    - min_mtu = 0, max_mtu = 65535

    macvlan:
    - min_mtu = 0, max_mtu = 65535

    ntb_netdev:
    - min_mtu = 0, max_mtu = 65535

    veth:
    - min_mtu = 68, max_mtu = 65535

    8021q:
    - min_mtu = 0, max_mtu = 65535

    CC: netdev@vger.kernel.org
    CC: Nicolas Dichtel
    CC: Hannes Frederic Sowa
    CC: Tom Herbert
    CC: Daniel Borkmann
    CC: Alexander Duyck
    CC: Paolo Abeni
    CC: Jiri Benc
    CC: WANG Cong
    CC: Roopa Prabhu
    CC: Pravin B Shelar
    CC: Sabrina Dubroca
    CC: Patrick McHardy
    CC: Stephen Hemminger
    CC: Pravin Shelar
    CC: Maxim Krasnyansky
    Signed-off-by: Jarod Wilson
    Signed-off-by: David S. Miller

    Jarod Wilson
     

24 Jul, 2016

1 commit


17 Jul, 2016

1 commit

  • macsec can't cope with mtu frames which need vlan tag insertion, and
    vlan device set the default mtu equal to the underlying dev's one.
    By default vlan over macsec devices use invalid mtu, dropping
    all the large packets.
    This patch adds a netif helper to check if an upper vlan device
    needs mtu reduction. The helper is used during vlan devices
    initialization to set a valid default and during mtu updating to
    forbid invalid, too bit, mtu values.
    The helper currently only check if the lower dev is a macsec device,
    if we get more users, we need to update only the helper (possibly
    reserving an additional IFF bit).

    Signed-off-by: Paolo Abeni
    Signed-off-by: David S. Miller

    Paolo Abeni
     

06 Jul, 2016

1 commit


01 Jun, 2016

1 commit

  • The MAC address of the physical interface is only copied to the VLAN
    when it is first created, resulting in an inconsistency after MAC
    address changes of only newly created VLANs having an up-to-date MAC.

    The VLANs should continue inheriting the MAC address of the physical
    interface until the VLAN MAC address is explicitly set to any value.
    This allows IPv6 EUI64 addresses for the VLAN to reflect any changes
    to the MAC of the physical interface and thus for DAD to behave as
    expected.

    Signed-off-by: Mike Manning
    Signed-off-by: David S. Miller

    Mike Manning
     

18 Mar, 2016

1 commit


26 Feb, 2016

1 commit


22 Feb, 2016

1 commit

  • Currently vlan device inherits unicast filtering flag from underlying
    device. If underlying device doesn't support unicast filter, this will
    put vlan device into promiscuous mode when it's stacked.

    Tun on IFF_UNICAST_FLT on the vlan device in any case so that it does
    not go into promiscuous mode needlessly. If underlying device does not
    support unicast filtering, that device will enter promiscuous mode.

    Signed-off-by: Zhang Shengju
    Signed-off-by: David S. Miller

    Zhang Shengju
     

16 Dec, 2015

3 commits

  • The name NETIF_F_ALL_CSUM is a misnomer. This does not correspond to the
    set of features for offloading all checksums. This is a mask of the
    checksum offload related features bits. It is incorrect to set both
    NETIF_F_HW_CSUM and NETIF_F_IP_CSUM or NETIF_F_IPV6 at the same time for
    features of a device.

    This patch:
    - Changes instances of NETIF_F_ALL_CSUM to NETIF_F_CSUM_MASK (where
    NETIF_F_ALL_CSUM is being used as a mask).
    - Changes bonding, sfc/efx, ipvlan, macvlan, vlan, and team drivers to
    use NEITF_F_HW_CSUM in features list instead of NETIF_F_ALL_CSUM.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     
  • The SCTP checksum is really a CRC and is very different from the
    standards 1's complement checksum that serves as the checksum
    for IP protocols. This offload interface is also very different.
    Rename NETIF_F_SCTP_CSUM to NETIF_F_SCTP_CRC to highlight these
    differences. The term CSUM should be reserved in the stack to refer
    to the standard 1's complement IP checksum.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert
     
  • We need to be able to propagate static FDB entries and certain bridge
    port attributes (e.g. learning, flooding) down to the port netdev
    driver when bridge port is a VLAN interface.

    Achieve that by setting ndo_bridge* and ndo_fdb* in vlan_netdev_ops to
    the corresponding switchdev_port* functions. This is consistent with
    team and bond devices.

    Signed-off-by: Ido Schimmel
    Signed-off-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Ido Schimmel
     

19 Aug, 2015

1 commit


03 Apr, 2015

1 commit


30 Mar, 2015

1 commit

  • Stacked vlan devices curretly have few features (GRO, HIGHDMA, LLTX).
    Since we have software fallbacks in case the NIC can not handle some
    features for multiple vlans, we can add the same features as the lower
    vlan devices for stacked vlan devices.

    This allows stacked vlan devices to create large (GSO) packets and not to
    segment packets. Those packets will be segmented by software on the real
    device, or even can be segmented by the NIC once TSO for multiple vlans
    becomes enabled by the following patches.

    The exception is those related to FCoE, which does not have a software
    fallback.

    Signed-off-by: Toshiaki Makita
    Signed-off-by: David S. Miller

    Toshiaki Makita
     

04 Mar, 2015

1 commit


03 Mar, 2015

1 commit


12 Dec, 2014

1 commit


22 Nov, 2014

2 commits


08 Oct, 2014

1 commit

  • Testing xmit_more support with netperf and connected UDP sockets,
    I found strange dst refcount false sharing.

    Current handling of IFF_XMIT_DST_RELEASE is not optimal.

    Dropping dst in validate_xmit_skb() is certainly too late in case
    packet was queued by cpu X but dequeued by cpu Y

    The logical point to take care of drop/force is in __dev_queue_xmit()
    before even taking qdisc lock.

    As Julian Anastasov pointed out, need for skb_dst() might come from some
    packet schedulers or classifiers.

    This patch adds new helper to cleanly express needs of various drivers
    or qdiscs/classifiers.

    Drivers that need skb_dst() in their ndo_start_xmit() should call
    following helper in their setup instead of the prior :

    dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
    ->
    netif_keep_dst(dev);

    Instead of using a single bit, we use two bits, one being
    eventually rebuilt in bonding/team drivers.

    The other one, is permanent and blocks IFF_XMIT_DST_RELEASE being
    rebuilt in bonding/team. Eventually, we could add something
    smarter later.

    Signed-off-by: Eric Dumazet
    Cc: Julian Anastasov
    Signed-off-by: David S. Miller

    Eric Dumazet
     

17 Jul, 2014

1 commit


08 Jul, 2014

1 commit


03 Jul, 2014

1 commit

  • Madalin-Cristian reported crashs happening after a recent commit
    (5a4ae5f6e7d4 "vlan: unnecessary to check if vlan_pcpu_stats is NULL")

    -----------------------------------------------------------------------
    root@p5040ds:~# vconfig add eth8 1
    root@p5040ds:~# vconfig rem eth8.1
    Unable to handle kernel paging request for data at address 0x2bc88028
    Faulting instruction address: 0xc058e950
    Oops: Kernel access of bad area, sig: 11 [#1]
    SMP NR_CPUS=8 CoreNet Generic
    Modules linked in:
    CPU: 3 PID: 2167 Comm: vconfig Tainted: G W 3.16.0-rc3-00346-g65e85bf #2
    task: e7264d90 ti: e2c2c000 task.ti: e2c2c000
    NIP: c058e950 LR: c058ea30 CTR: c058e900
    REGS: e2c2db20 TRAP: 0300 Tainted: G W (3.16.0-rc3-00346-g65e85bf)
    MSR: 00029002 CR: 48000428 XER: 20000000
    DEAR: 2bc88028 ESR: 00000000
    GPR00: c047299c e2c2dbd0 e7264d90 00000000 2bc88000 00000000 ffffffff 00000000
    GPR08: 0000000f 00000000 000000ff 00000000 28000422 10121928 10100000 10100000
    GPR16: 10100000 00000000 c07c5968 00000000 00000000 00000000 e2c2dc48 e7838000
    GPR24: c07c5bac c07c58a8 e77290cc c07b0000 00000000 c05de6c0 e7838000 e2c2dc48
    NIP [c058e950] vlan_dev_get_stats64+0x50/0x170
    LR [c058ea30] vlan_dev_get_stats64+0x130/0x170
    Call Trace:
    [e2c2dbd0] [ffffffea] 0xffffffea (unreliable)
    [e2c2dc20] [c047299c] dev_get_stats+0x4c/0x140
    [e2c2dc40] [c0488ca8] rtnl_fill_ifinfo+0x3d8/0x960
    [e2c2dd70] [c0489f4c] rtmsg_ifinfo+0x6c/0x110
    [e2c2dd90] [c04731d4] rollback_registered_many+0x344/0x3b0
    [e2c2ddd0] [c047332c] rollback_registered+0x2c/0x50
    [e2c2ddf0] [c0476058] unregister_netdevice_queue+0x78/0xf0
    [e2c2de00] [c058d800] unregister_vlan_dev+0xc0/0x160
    [e2c2de20] [c058e360] vlan_ioctl_handler+0x1c0/0x550
    [e2c2de90] [c045d11c] sock_ioctl+0x28c/0x2f0
    [e2c2deb0] [c010d070] do_vfs_ioctl+0x90/0x7b0
    [e2c2df20] [c010d7d0] SyS_ioctl+0x40/0x80
    [e2c2df40] [c000f924] ret_from_syscall+0x0/0x3c

    Fix this problem by freeing percpu stats from dev->destructor() instead
    of ndo_uninit()

    Reported-by: Madalin-Cristian Bucur
    Signed-off-by: Eric Dumazet
    Tested-by: Madalin-Cristian Bucur
    Fixes: 5a4ae5f6e7d4 ("vlan: unnecessary to check if vlan_pcpu_stats is NULL")
    Cc: Li RongQing
    Signed-off-by: David S. Miller

    Eric Dumazet
     

24 May, 2014

1 commit

  • Conflicts:
    drivers/net/bonding/bond_alb.c
    drivers/net/ethernet/altera/altera_msgdma.c
    drivers/net/ethernet/altera/altera_sgdma.c
    net/ipv6/xfrm6_output.c

    Several cases of overlapping changes.

    The xfrm6_output.c has a bug fix which overlaps the renaming
    of skb->local_df to skb->ignore_df.

    In the Altera TSE driver cases, the register access cleanups
    in net-next overlapped with bug fixes done in net.

    Similarly a bug fix to send ALB packets in the bonding driver using
    the right source address overlaps with cleanups in net-next.

    Signed-off-by: David S. Miller

    David S. Miller
     

23 May, 2014

1 commit

  • When combining real_dev's features and vlan_features, simple
    bitwise AND is used. This doesn't work well for checksum
    offloading features as if one set has NETIF_F_HW_CSUM and the
    other NETIF_F_IP_CSUM and/or NETIF_F_IPV6_CSUM, we end up with
    no checksum offloading. However, from the logical point of view
    (how can_checksum_protocol() works), NETIF_F_HW_CSUM contains
    the functionality of NETIF_F_IP_CSUM and NETIF_F_IPV6_CSUM so
    that the result should be IP/IPV6.

    Add helper function netdev_intersect_features() implementing
    this logic and use it in vlan_dev_fix_features().

    Signed-off-by: Michal Kubecek
    Signed-off-by: David S. Miller

    Michal Kubeček
     

17 May, 2014

1 commit

  • This reverts commit dc8eaaa006350d24030502a4521542e74b5cb39f.
    vlan: Fix lockdep warning when vlan dev handle notification

    Instead we use the new new API to find the lock subclass of
    our vlan device. This way we can support configurations where
    vlans are interspersed with other devices:
    bond -> vlan -> macvlan -> vlan

    Signed-off-by: Vlad Yasevich
    Signed-off-by: David S. Miller

    Vlad Yasevich
     

23 Apr, 2014

1 commit


19 Apr, 2014

1 commit

  • When I open the LOCKDEP config and run these steps:

    modprobe 8021q
    vconfig add eth2 20
    vconfig add eth2.20 30
    ifconfig eth2 xx.xx.xx.xx

    then the Call Trace happened:

    [32524.386288] =============================================
    [32524.386293] [ INFO: possible recursive locking detected ]
    [32524.386298] 3.14.0-rc2-0.7-default+ #35 Tainted: G O
    [32524.386302] ---------------------------------------------
    [32524.386306] ifconfig/3103 is trying to acquire lock:
    [32524.386310] (&vlan_netdev_addr_lock_key/1){+.....}, at: [] dev_mc_sync+0x64/0xb0
    [32524.386326]
    [32524.386326] but task is already holding lock:
    [32524.386330] (&vlan_netdev_addr_lock_key/1){+.....}, at: [] dev_set_rx_mode+0x23/0x40
    [32524.386341]
    [32524.386341] other info that might help us debug this:
    [32524.386345] Possible unsafe locking scenario:
    [32524.386345]
    [32524.386350] CPU0
    [32524.386352] ----
    [32524.386354] lock(&vlan_netdev_addr_lock_key/1);
    [32524.386359] lock(&vlan_netdev_addr_lock_key/1);
    [32524.386364]
    [32524.386364] *** DEADLOCK ***
    [32524.386364]
    [32524.386368] May be due to missing lock nesting notation
    [32524.386368]
    [32524.386373] 2 locks held by ifconfig/3103:
    [32524.386376] #0: (rtnl_mutex){+.+.+.}, at: [] rtnl_lock+0x12/0x20
    [32524.386387] #1: (&vlan_netdev_addr_lock_key/1){+.....}, at: [] dev_set_rx_mode+0x23/0x40
    [32524.386398]
    [32524.386398] stack backtrace:
    [32524.386403] CPU: 1 PID: 3103 Comm: ifconfig Tainted: G O 3.14.0-rc2-0.7-default+ #35
    [32524.386409] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007
    [32524.386414] ffffffff81ffae40 ffff8800d9625ae8 ffffffff814f68a2 ffff8800d9625bc8
    [32524.386421] ffffffff810a35fb ffff8800d8a8d9d0 00000000d9625b28 ffff8800d8a8e5d0
    [32524.386428] 000003cc00000000 0000000000000002 ffff8800d8a8e5f8 0000000000000000
    [32524.386435] Call Trace:
    [32524.386441] [] dump_stack+0x6a/0x78
    [32524.386448] [] __lock_acquire+0x7ab/0x1940
    [32524.386454] [] ? __lock_acquire+0x3ea/0x1940
    [32524.386459] [] lock_acquire+0xe4/0x110
    [32524.386464] [] ? dev_mc_sync+0x64/0xb0
    [32524.386471] [] _raw_spin_lock_nested+0x2a/0x40
    [32524.386476] [] ? dev_mc_sync+0x64/0xb0
    [32524.386481] [] dev_mc_sync+0x64/0xb0
    [32524.386489] [] vlan_dev_set_rx_mode+0x2b/0x50 [8021q]
    [32524.386495] [] __dev_set_rx_mode+0x5f/0xb0
    [32524.386500] [] dev_set_rx_mode+0x2b/0x40
    [32524.386506] [] __dev_open+0xef/0x150
    [32524.386511] [] __dev_change_flags+0xa7/0x190
    [32524.386516] [] dev_change_flags+0x32/0x80
    [32524.386524] [] devinet_ioctl+0x7d6/0x830
    [32524.386532] [] ? dev_ioctl+0x34b/0x660
    [32524.386540] [] inet_ioctl+0x80/0xa0
    [32524.386550] [] sock_do_ioctl+0x2d/0x60
    [32524.386558] [] sock_ioctl+0x82/0x2a0
    [32524.386568] [] do_vfs_ioctl+0x93/0x590
    [32524.386578] [] ? rcu_read_lock_held+0x45/0x50
    [32524.386586] [] ? __fget_light+0x105/0x110
    [32524.386594] [] SyS_ioctl+0x91/0xb0
    [32524.386604] [] system_call_fastpath+0x16/0x1b

    ========================================================================

    The reason is that all of the addr_lock_key for vlan dev have the same class,
    so if we change the status for vlan dev, the vlan dev and its real dev will
    hold the same class of addr_lock_key together, so the warning happened.

    we should distinguish the lock depth for vlan dev and its real dev.

    v1->v2: Convert the vlan_netdev_addr_lock_key to an array of eight elements, which
    could support to add 8 vlan id on a same vlan dev, I think it is enough for current
    scene, because a netdev's name is limited to IFNAMSIZ which could not hold 8 vlan id,
    and the vlan dev would not meet the same class key with its real dev.

    The new function vlan_dev_get_lockdep_subkey() will return the subkey and make the vlan
    dev could get a suitable class key.

    v2->v3: According David's suggestion, I use the subclass to distinguish the lock key for vlan dev
    and its real dev, but it make no sense, because the difference for subclass in the
    lock_class_key doesn't mean that the difference class for lock_key, so I use lock_depth
    to distinguish the different depth for every vlan dev, the same depth of the vlan dev
    could have the same lock_class_key, I import the MAX_LOCK_DEPTH from the include/linux/sched.h,
    I think it is enough here, the lockdep should never exceed that value.

    v3->v4: Add a huge array of locking keys will waste static kernel memory and is not a appropriate method,
    we could use _nested() variants to fix the problem, calculate the depth for every vlan dev,
    and use the depth as the subclass for addr_lock_key.

    Signed-off-by: Ding Tianhong
    Signed-off-by: David S. Miller

    dingtianhong
     

30 Mar, 2014

2 commits

  • Conflicts:
    drivers/net/ethernet/marvell/mvneta.c

    The mvneta.c conflict is a case of overlapping changes,
    a conversion to devm_ioremap_resource() vs. a conversion
    to netdev_alloc_pcpu_stats.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • The gfp parameter was added in:
    commit 47be03a28cc6c80e3aa2b3e8ed6d960ff0c5c0af
    Author: Amerigo Wang
    Date: Fri Aug 10 01:24:37 2012 +0000

    netpoll: use GFP_ATOMIC in slave_enable_netpoll() and __netpoll_setup()

    slave_enable_netpoll() and __netpoll_setup() may be called
    with read_lock() held, so should use GFP_ATOMIC to allocate
    memory. Eric suggested to pass gfp flags to __netpoll_setup().

    Cc: Eric Dumazet
    Cc: "David S. Miller"
    Reported-by: Dan Carpenter
    Signed-off-by: Eric Dumazet
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    The reason for the gfp parameter was removed in:
    commit c4cdef9b7183159c23c7302aaf270d64c549f557
    Author: dingtianhong
    Date: Tue Jul 23 15:25:27 2013 +0800

    bonding: don't call slave_xxx_netpoll under spinlocks

    The slave_xxx_netpoll will call synchronize_rcu_bh(),
    so the function may schedule and sleep, it should't be
    called under spinlocks.

    bond_netpoll_setup() and bond_netpoll_cleanup() are always
    protected by rtnl lock, it is no need to take the read lock,
    as the slave list couldn't be changed outside rtnl lock.

    Signed-off-by: Ding Tianhong
    Cc: Jay Vosburgh
    Cc: Andy Gospodarek
    Signed-off-by: David S. Miller

    Nothing else that calls __netpoll_setup or ndo_netpoll_setup
    requires a gfp paramter, so remove the gfp parameter from both
    of these functions making the code clearer.

    Signed-off-by: "Eric W. Biederman"
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

29 Mar, 2014

1 commit