22 Jan, 2014

2 commits


01 Jan, 2014

1 commit

  • When the vlan code detects that the real device can do TX VLAN offloads
    in hardware, it tries to arrange for the real device's header_ops to
    be invoked directly.

    But it does so illegally, by simply hooking the real device's
    header_ops up to the VLAN device.

    This doesn't work because we will end up invoking a set of header_ops
    routines which expect a device type which matches the real device, but
    will see a VLAN device instead.

    Fix this by providing a pass-thru set of header_ops which will arrange
    to pass the proper real device instead.

    To facilitate this add a dev_rebuild_header(). There are
    implementations which provide a ->cache and ->create but not a
    ->rebuild (f.e. PLIP). So we need a helper function just like
    dev_hard_header() to avoid crashes.

    Use this helper in the one existing place where the
    header_ops->rebuild was being invoked, the neighbour code.

    With lots of help from Florian Westphal.

    Signed-off-by: David S. Miller

    David S. Miller
     

14 Nov, 2013

1 commit

  • Pull core locking changes from Ingo Molnar:
    "The biggest changes:

    - add lockdep support for seqcount/seqlocks structures, this
    unearthed both bugs and required extra annotation.

    - move the various kernel locking primitives to the new
    kernel/locking/ directory"

    * 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (21 commits)
    block: Use u64_stats_init() to initialize seqcounts
    locking/lockdep: Mark __lockdep_count_forward_deps() as static
    lockdep/proc: Fix lock-time avg computation
    locking/doc: Update references to kernel/mutex.c
    ipv6: Fix possible ipv6 seqlock deadlock
    cpuset: Fix potential deadlock w/ set_mems_allowed
    seqcount: Add lockdep functionality to seqcount/seqlock structures
    net: Explicitly initialize u64_stats_sync structures for lockdep
    locking: Move the percpu-rwsem code to kernel/locking/
    locking: Move the lglocks code to kernel/locking/
    locking: Move the rwsem code to kernel/locking/
    locking: Move the rtmutex code to kernel/locking/
    locking: Move the semaphore core to kernel/locking/
    locking: Move the spinlock code to kernel/locking/
    locking: Move the lockdep code to kernel/locking/
    locking: Move the mutex code to kernel/locking/
    hung_task debugging: Add tracepoint to report the hang
    x86/locking/kconfig: Update paravirt spinlock Kconfig description
    lockstat: Report avg wait and hold times
    lockdep, x86/alternatives: Drop ancient lockdep fixup message
    ...

    Linus Torvalds
     

11 Nov, 2013

1 commit


08 Nov, 2013

1 commit

  • Provide a method for read-only access to the vlan device egress mapping.

    Do this by refactoring vlan_dev_get_egress_qos_mask() such that now it
    receives as an argument the skb priority instead of pointer to the skb.

    Such an access is needed for the IBoE stack where the control plane
    goes through the network stack. This is an add-on step on top of commit
    d4a968658c "net/route: export symbol ip_tos2prio" which allowed the RDMA-CM
    to use ip_tos2prio.

    Signed-off-by: Eyal Perry
    Signed-off-by: Hadar Hen Zion
    Signed-off-by: David S. Miller

    Eyal Perry
     

06 Nov, 2013

1 commit

  • In order to enable lockdep on seqcount/seqlock structures, we
    must explicitly initialize any locks.

    The u64_stats_sync structure, uses a seqcount, and thus we need
    to introduce a u64_stats_init() function and use it to initialize
    the structure.

    This unfortunately adds a lot of fairly trivial initialization code
    to a number of drivers. But the benefit of ensuring correctness makes
    this worth while.

    Because these changes are required for lockdep to be enabled, and the
    changes are quite trivial, I've not yet split this patch out into 30-some
    separate patches, as I figured it would be better to get the various
    maintainers thoughts on how to best merge this change along with
    the seqcount lockdep enablement.

    Feedback would be appreciated!

    Signed-off-by: John Stultz
    Acked-by: Julian Anastasov
    Signed-off-by: Peter Zijlstra
    Cc: Alexey Kuznetsov
    Cc: "David S. Miller"
    Cc: Eric Dumazet
    Cc: Hideaki YOSHIFUJI
    Cc: James Morris
    Cc: Jesse Gross
    Cc: Mathieu Desnoyers
    Cc: "Michael S. Tsirkin"
    Cc: Mirko Lindner
    Cc: Patrick McHardy
    Cc: Roger Luethi
    Cc: Rusty Russell
    Cc: Simon Horman
    Cc: Stephen Hemminger
    Cc: Steven Rostedt
    Cc: Thomas Petazzoni
    Cc: Wensong Zhang
    Cc: netdev@vger.kernel.org
    Link: http://lkml.kernel.org/r/1381186321-4906-2-git-send-email-john.stultz@linaro.org
    Signed-off-by: Ingo Molnar

    John Stultz
     

20 Oct, 2013

1 commit


09 Oct, 2013

2 commits


27 Sep, 2013

2 commits

  • On netdev unregister we're removing also all of its sysfs-associated stuff,
    including the sysfs symlinks that are controlled by netdev neighbour code.
    Also, it's a subtle race condition - cause we can still access it after
    unregistering.

    Move the unlinking right before the unregistering to fix both.

    CC: Patrick McHardy
    CC: "David S. Miller"
    Signed-off-by: Veaceslav Falico
    Signed-off-by: David S. Miller

    Veaceslav Falico
     
  • Otherwise users might access it without being fully registered, as per
    sysfs - it only inits in register_netdevice(), so is unusable till it is
    called.

    CC: Patrick McHardy
    CC: "David S. Miller"
    Signed-off-by: Veaceslav Falico
    Signed-off-by: David S. Miller

    Veaceslav Falico
     

04 Sep, 2013

1 commit


17 Aug, 2013

1 commit


06 Aug, 2013

1 commit

  • Sometimes we might have stacked vlans on top of each other, and we're
    interested in the first non-vlan real device on the path, so transform
    vlan_dev_real_dev to go over the stacked vlans and extract the first
    non-vlan device.

    Signed-off-by: Nikolay Aleksandrov
    Signed-off-by: Veaceslav Falico
    Signed-off-by: David S. Miller

    nikolay@redhat.com
     

04 Aug, 2013

1 commit

  • This patch cleanup 2 points for the usage of vlan_dev_priv(dev):
    * In vlan_dev.c/vlan_dev_hard_header, we should use the var *vlan directly
    after grabing the pointer at the beginning with
    *vlan = vlan_dev_priv(dev);
    when we need to access the fields of *vlan.
    * In vlan.c/register_vlan_device, add the var *vlan pointer
    struct vlan_dev_priv *vlan;
    to cleanup the code to access the fields of vlan_dev_priv(new_dev).

    Signed-off-by: Wang Sheng-Hui
    Signed-off-by: David S. Miller

    Wang Sheng-Hui
     

24 Jul, 2013

1 commit

  • Until now, bond_resend_igmp_join_requests() looks for vlans attached to
    bonding device, bridge where bonding act as port manually. It does not
    care of other scenarios, like stacked bonds or team device above. Make
    this more generic and use netdev notifier to propagate the event to
    upper devices and to actually call ip_mc_rejoin_groups().

    Signed-off-by: Jiri Pirko
    Acked-by: Veaceslav Falico
    Signed-off-by: David S. Miller

    Jiri Pirko
     

19 Jul, 2013

2 commits

  • egress_priority_map[] hash table updates are protected by rtnl,
    and we never remove elements until device is dismantled.

    We have to make sure that before inserting an new element in hash table,
    all its fields are committed to memory or else another cpu could
    find corrupt values and crash.

    Signed-off-by: Eric Dumazet
    Cc: Patrick McHardy
    Signed-off-by: David S. Miller

    Eric Dumazet
     
  • In commit 48cc32d38a52d0b68f91a171a8d00531edc6a46e
    ("vlan: don't deliver frames for unknown vlans to protocols")
    Florian made sure we set pkt_type to PACKET_OTHERHOST
    if the vlan id is set and we could find a vlan device for this
    particular id.

    But we also have a problem if prio bits are set.

    Steinar reported an issue on a router receiving IPv6 frames with a
    vlan tag of 4000 (id 0, prio 2), and tunneled into a sit device,
    because skb->vlan_tci is set.

    Forwarded frame is completely corrupted : We can see (8100:4000)
    being inserted in the middle of IPv6 source address :

    16:48:00.780413 IP6 2001:16d8:8100:4000:ee1c:0:9d9:bc87 >
    9f94:4d95:2001:67c:29f4::: ICMP6, unknown icmp6 type (0), length 64
    0x0000: 0000 0029 8000 c7c3 7103 0001 a0ae e651
    0x0010: 0000 0000 ccce 0b00 0000 0000 1011 1213
    0x0020: 1415 1617 1819 1a1b 1c1d 1e1f 2021 2223
    0x0030: 2425 2627 2829 2a2b 2c2d 2e2f 3031 3233

    It seems we are not really ready to properly cope with this right now.

    We can probably do better in future kernels :
    vlan_get_ingress_priority() should be a netdev property instead of
    a per vlan_dev one.

    For stable kernels, lets clear vlan_tci to fix the bugs.

    Reported-by: Steinar H. Gunderson
    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

29 May, 2013

1 commit

  • So far, only net_device * could be passed along with netdevice notifier
    event. This patch provides a possibility to pass custom structure
    able to provide info that event listener needs to know.

    Signed-off-by: Jiri Pirko

    v2->v3: fix typo on simeth
    shortened dev_getter
    shortened notifier_info struct name
    v1->v2: fix notifier_call parameter in call_netdevice_notifier()
    Signed-off-by: David S. Miller

    Jiri Pirko
     

03 May, 2013

1 commit


02 May, 2013

2 commits

  • Pull VFS updates from Al Viro,

    Misc cleanups all over the place, mainly wrt /proc interfaces (switch
    create_proc_entry to proc_create(), get rid of the deprecated
    create_proc_read_entry() in favor of using proc_create_data() and
    seq_file etc).

    7kloc removed.

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (204 commits)
    don't bother with deferred freeing of fdtables
    proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h
    proc: Make the PROC_I() and PDE() macros internal to procfs
    proc: Supply a function to remove a proc entry by PDE
    take cgroup_open() and cpuset_open() to fs/proc/base.c
    ppc: Clean up scanlog
    ppc: Clean up rtas_flash driver somewhat
    hostap: proc: Use remove_proc_subtree()
    drm: proc: Use remove_proc_subtree()
    drm: proc: Use minor->index to label things, not PDE->name
    drm: Constify drm_proc_list[]
    zoran: Don't print proc_dir_entry data in debug
    reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show()
    proc: Supply an accessor for getting the data from a PDE's parent
    airo: Use remove_proc_subtree()
    rtl8192u: Don't need to save device proc dir PDE
    rtl8187se: Use a dir under /proc/net/r8180/
    proc: Add proc_mkdir_data()
    proc: Move some bits from linux/proc_fs.h to linux/{of.h,signal.h,tty.h}
    proc: Move PDE_NET() to fs/proc/proc_net.c
    ...

    Linus Torvalds
     
  • Supply a function (proc_remove()) to remove a proc entry (and any subtree
    rooted there) by proc_dir_entry pointer rather than by name and (optionally)
    root dir entry pointer. This allows us to eliminate all remaining pde->name
    accesses outside of procfs.

    Signed-off-by: David Howells
    Acked-by: Grant Likely
    cc: linux-acpi@vger.kernel.org
    cc: openipmi-developer@lists.sourceforge.net
    cc: devicetree-discuss@lists.ozlabs.org
    cc: linux-pci@vger.kernel.org
    cc: netdev@vger.kernel.org
    cc: netfilter-devel@vger.kernel.org
    cc: alsa-devel@alsa-project.org
    Signed-off-by: Al Viro

    David Howells
     

22 Apr, 2013

2 commits

  • Add missing return statement for CONFIG_BUG=n.

    Reported-by: kbuild test robot
    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • The following leak is reported by kmemleak:

    [ 86.812073] kmemleak: Found object by alias at 0xffff88006ecc76f0
    [ 86.816019] Pid: 739, comm: kworker/u:1 Not tainted 3.9.0-rc5+ #842
    [ 86.816019] Call Trace:
    [ 86.816019] [] find_and_get_object+0x8c/0xdf
    [ 86.816019] [] ? vlan_info_rcu_free+0x33/0x49
    [ 86.816019] [] delete_object_full+0x13/0x2f
    [ 86.816019] [] kmemleak_free+0x26/0x45
    [ 86.816019] [] slab_free_hook+0x1e/0x7b
    [ 86.816019] [] kfree+0xce/0x14b
    [ 86.816019] [] vlan_info_rcu_free+0x33/0x49
    [ 86.816019] [] rcu_do_batch+0x261/0x4e7

    The reason is that in vlan_info_rcu_free() we don't take the VLAN protocol
    into account when iterating over the vlan_devices_array.

    Reported-by: Cong Wang
    Signed-off-by: Patrick McHardy
    Tested-by: Cong Wang
    Signed-off-by: David S. Miller

    Patrick McHardy
     

20 Apr, 2013

5 commits

  • Add support for 802.1ad VLAN devices. This mainly consists of checking for
    ETH_P_8021AD in addition to ETH_P_8021Q in a couple of places and check
    offloading capabilities based on the used protocol.

    Configuration is done using "ip link":

    # ip link add link eth0 eth0.1000 \
    type vlan proto 802.1ad id 1000
    # ip link add link eth0.1000 eth0.1000.1000 \
    type vlan proto 802.1q id 1000

    52:54:00:12:34:56 > 92:b1:54:28:e4:8c, ethertype 802.1Q (0x8100), length 106: vlan 1000, p 0, ethertype 802.1Q, vlan 1000, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto ICMP (1), length 84)
    20.1.0.2 > 20.1.0.1: ICMP echo request, id 3003, seq 8, length 64
    92:b1:54:28:e4:8c > 52:54:00:12:34:56, ethertype 802.1Q-QinQ (0x88a8), length 106: vlan 1000, p 0, ethertype 802.1Q, vlan 1000, p 0, ethertype IPv4, (tos 0x0, ttl 64, id 47944, offset 0, flags [none], proto ICMP (1), length 84)
    20.1.0.1 > 20.1.0.2: ICMP echo reply, id 3003, seq 8, length 64

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • Add a protocol argument to the VLAN packet tagging functions. In case of HW
    tagging, we need that protocol available in the ndo_start_xmit functions,
    so it is stored in a new field in the skb. The new field fits into a hole
    (on 64 bit) and doesn't increase the sks's size.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • Make the encapsulation protocol value a property of VLAN devices and change
    the device lookup functions to take the protocol value into account.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • Change the rx_{add,kill}_vid callbacks to take a protocol argument in
    preparation of 802.1ad support. The protocol argument used so far is
    always htons(ETH_P_8021Q).

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     
  • Rename the hardware VLAN acceleration features to include "CTAG" to indicate
    that they only support CTAGs. Follow up patches will introduce 802.1ad
    server provider tagging (STAGs) and require the distinction for hardware not
    supporting acclerating both.

    Signed-off-by: Patrick McHardy
    Signed-off-by: David S. Miller

    Patrick McHardy
     

10 Apr, 2013

1 commit

  • The only part of proc_dir_entry the code outside of fs/proc
    really cares about is PDE(inode)->data. Provide a helper
    for that; static inline for now, eventually will be moved
    to fs/proc, along with the knowledge of struct proc_dir_entry
    layout.

    Signed-off-by: Al Viro

    Al Viro
     

25 Mar, 2013

1 commit

  • vlan_vid_del() could possibly free ->vlan_info after a RCU grace
    period, however, we may still refer to the freed memory area
    by 'grp' pointer. Found by code inspection.

    This patch moves vlan_vid_del() as behind as possible.

    Cc: Patrick McHardy
    Cc: "David S. Miller"
    Signed-off-by: Cong Wang
    Acked-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Cong Wang
     

19 Feb, 2013

1 commit

  • proc_net_remove is only used to remove proc entries
    that under /proc/net,it's not a general function for
    removing proc entries of netns. if we want to remove
    some proc entries which under /proc/net/stat/, we still
    need to call remove_proc_entry.

    this patch use remove_proc_entry to replace proc_net_remove.
    we can remove proc_net_remove after this patch.

    Signed-off-by: Gao feng
    Signed-off-by: David S. Miller

    Gao feng
     

14 Feb, 2013

1 commit


12 Feb, 2013

1 commit

  • __netpoll_rcu_free is used to free netpoll structures when the rtnl_lock is
    already held. The mechanism is used to asynchronously call __netpoll_cleanup
    outside of the holding of the rtnl_lock, so as to avoid deadlock.
    Unfortunately, __netpoll_cleanup modifies pointers (dev->np), which means the
    rtnl_lock must be held while calling it. Further, it cannot be held, because
    rcu callbacks may be issued in softirq contexts, which cannot sleep.

    Fix this by converting the rcu callback to a work queue that is guaranteed to
    get scheduled in process context, so that we can hold the rtnl properly while
    calling __netpoll_cleanup

    Tested successfully by myself.

    Signed-off-by: Neil Horman
    CC: "David S. Miller"
    CC: Cong Wang
    CC: Eric Dumazet
    Signed-off-by: David S. Miller

    Neil Horman
     

11 Feb, 2013

1 commit


30 Jan, 2013

1 commit

  • Instead of jumping aroung bugs that are easily fixed just don't let them in:
    affected drivers should be either fixed or have NETIF_F_HW_VLAN_FILTER
    removed from advertised features.

    Quick grep in drivers/net shows two drivers that have NETIF_F_HW_VLAN_FILTER
    but not ndo_vlan_rx_add/kill_vid(), but those are false-positives (features
    are commented out).

    OTOH two drivers have ndo_vlan_rx_add/kill_vid() implemented but don't
    advertise NETIF_F_HW_VLAN_FILTER. Those are:

    +ethernet/cisco/enic/enic_main.c
    +ethernet/qlogic/qlcnic/qlcnic_main.c

    Signed-off-by: Michał Mirosław
    Signed-off-by: David S. Miller

    Michał Mirosław
     

07 Jan, 2013

1 commit

  • Use strlcpy where possible to ensure the string is \0 terminated.
    Use always sizeof(string) instead of 32, ETHTOOL_BUSINFO_LEN
    and custom defines.
    Use snprintf instead of sprint.
    Remove unnecessary inits of ->fw_version
    Remove unnecessary inits of drvinfo struct.

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

    Jiri Pirko
     

05 Jan, 2013

2 commits