31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 of the license or at
    your option any later version

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 3029 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

29 May, 2018

1 commit

  • Fixup the checksum for CHECKSUM_COMPLETE when pulling skbs on RX path.
    Otherwise we get splats when tc mirred is used to redirect packets to ifb.

    Before fix:

    nic: hw csum failure

    Signed-off-by: Jon Maxwell
    Signed-off-by: David S. Miller

    Jon Maxwell
     

01 Apr, 2018

1 commit

  • This function calls call_netdevice_notifier(), which also
    may take net_rwsem. So, we can't use net_rwsem here.

    This patch makes callers of this functions take pernet_ops_rwsem,
    like register_netdevice_notifier() does. This will protect
    the modifications of net_namespace_list, and allows notifiers
    to take it (they won't have to care about context).

    Since __rtnl_link_unregister() is used on module load
    and unload (which are not frequent operations), this looks
    for me better, than make all call_netdevice_notifier()
    always executing in "protected net_namespace_list" context.

    Also, this fixes the problem we had a deal in 328fbe747ad4
    "Close race between {un, }register_netdevice_notifier and ...",
    and guarantees __rtnl_link_unregister() does not skip
    exitting net.

    Signed-off-by: Kirill Tkhai
    Signed-off-by: David S. Miller

    Kirill Tkhai
     

26 Sep, 2017

1 commit

  • These two drivers (dummy and ifb) call ether_setup(), after commit
    61e84623ace3 ("net: centralize net_device min/max MTU checking"), the
    range of mtu is [min_mtu, max_mtu], which is [68, 1500] by default.

    These two devices should not have limits on MTU. This patch set their
    min_mtu/max_mtu to 0. So that dev_set_mtu() will not check the mtu range,
    and can be set with any value.

    CC: Eric Dumazet
    CC: Sabrina Dubroca
    Signed-off-by: Zhang Shengju
    Signed-off-by: David S. Miller

    Zhang Shengju
     

27 Jun, 2017

1 commit


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 Jan, 2017

4 commits

  • The tc_from field fulfills two roles. It encodes whether a packet was
    redirected by an act_mirred device and, if so, whether act_mirred was
    called on ingress or egress. Split it into separate fields.

    The information is needed by the special IFB loop, where packets are
    taken out of the normal path by act_mirred, forwarded to IFB, then
    reinjected at their original location (ingress or egress) by IFB.

    The IFB device cannot use skb->tc_at_ingress, because that may have
    been overwritten as the packet travels from act_mirred to ifb_xmit,
    when it passes through tc_classify on the IFB egress path. Cache this
    value in skb->tc_from_ingress.

    That field is valid only if a packet arriving at ifb_xmit came from
    act_mirred. Other packets can be crafted to reach ifb_xmit. These
    must be dropped. Set tc_redirected on redirection and drop all packets
    that do not have this bit set.

    Both fields are set only on cloned skbs in tc actions, so original
    packet sources do not have to clear the bit when reusing packets
    (notably, pktgen and octeon).

    Signed-off-by: Willem de Bruijn
    Signed-off-by: David S. Miller

    Willem de Bruijn
     
  • Extract the remaining two fields from tc_verd and remove the __u16
    completely. TC_AT and TC_FROM are converted to equivalent two-bit
    integer fields tc_at and tc_from. Where possible, use existing
    helper skb_at_tc_ingress when reading tc_at. Introduce helper
    skb_reset_tc to clear fields.

    Not documenting tc_from and tc_at, because they will be replaced
    with single bit fields in follow-on patches.

    Signed-off-by: Willem de Bruijn
    Signed-off-by: David S. Miller

    Willem de Bruijn
     
  • Packets sent by the IFB device skip subsequent tc classification.
    A single bit governs this state. Move it out of tc_verd in
    anticipation of removing that __u16 completely.

    The new bitfield tc_skip_classify temporarily uses one bit of a
    hole, until tc_verd is removed completely in a follow-up patch.

    Remove the bit hole comment. It could be 2, 3, 4 or 5 bits long.
    With that many options, little value in documenting it.

    Introduce a helper function to deduplicate the logic in the two
    sites that check this bit.

    The field tc_skip_classify is set only in IFB on skbs cloned in
    act_mirred, so original packet sources do not have to clear the
    bit when reusing packets (notably, pktgen and octeon).

    Signed-off-by: Willem de Bruijn
    Signed-off-by: David S. Miller

    Willem de Bruijn
     
  • 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
     

09 May, 2016

1 commit

  • When using ifb+netem on ingress on SIT/IPIP/GRE traffic,
    GRO packets are not properly processed.

    Segmentation should not be forced, since ifb is already adding
    quite a performance hit.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

09 Jul, 2015

1 commit

  • Add multiqueue capabilities to ifb netdevice.

    This removes last bottleneck for ingress when mq qdisc can be used
    to shard load from multiple RX queues on physical device.

    Tested:

    # netem based setup, installed at receiver side
    ETH=eth0
    IFB=ifb10
    EST="est 1sec 4sec" # Optional rate estimator
    RTT_HALF=2ms
    #REORDER=20us
    #LOSS="loss 1"
    TXQ=8

    ip link add ifb10 numtxqueues $TXQ type ifb
    ip link set dev $IFB up

    tc qdisc add dev $ETH ingress 2>/dev/null

    tc filter add dev $ETH parent ffff: \
    protocol ip u32 match u32 0 0 flowid 1:1 \
    action mirred egress redirect dev $IFB

    tc qdisc del dev $IFB root 2>/dev/null

    tc qdisc add dev $IFB root handle 1: mq
    for i in `seq 1 $TXQ`
    do
    slot=$( printf %x $(( i )) )
    tc qd add dev $IFB parent 1:$slot $EST netem \
    limit 100000 delay $RTT_HALF $REORDER $LOSS
    done

    lpaa24:~# tc -s -d qd sh dev ifb10
    qdisc mq 1: root
    Sent 316544766 bytes 5265927 pkt (dropped 0, overlimits 0 requeues 0)
    backlog 98880b 1648p requeues 0
    qdisc netem 8002: parent 1:1 limit 100000 delay 2.0ms
    Sent 39601416 bytes 658721 pkt (dropped 0, overlimits 0 requeues 0)
    rate 38235Kbit 79657pps backlog 12240b 204p requeues 0
    qdisc netem 8003: parent 1:2 limit 100000 delay 2.0ms
    Sent 39472866 bytes 657227 pkt (dropped 0, overlimits 0 requeues 0)
    rate 38234Kbit 79655pps backlog 10620b 176p requeues 0
    qdisc netem 8004: parent 1:3 limit 100000 delay 2.0ms
    Sent 39703417 bytes 659699 pkt (dropped 0, overlimits 0 requeues 0)
    rate 38320Kbit 79831pps backlog 12780b 213p requeues 0
    qdisc netem 8005: parent 1:4 limit 100000 delay 2.0ms
    Sent 39565149 bytes 658011 pkt (dropped 0, overlimits 0 requeues 0)
    rate 38174Kbit 79530pps backlog 11880b 198p requeues 0
    qdisc netem 8006: parent 1:5 limit 100000 delay 2.0ms
    Sent 39506078 bytes 657354 pkt (dropped 0, overlimits 0 requeues 0)
    rate 38195Kbit 79571pps backlog 12480b 208p requeues 0
    qdisc netem 8007: parent 1:6 limit 100000 delay 2.0ms
    Sent 39675994 bytes 658849 pkt (dropped 0, overlimits 0 requeues 0)
    rate 38323Kbit 79838pps backlog 12600b 210p requeues 0
    qdisc netem 8008: parent 1:7 limit 100000 delay 2.0ms
    Sent 39532042 bytes 658367 pkt (dropped 0, overlimits 0 requeues 0)
    rate 38177Kbit 79536pps backlog 13140b 219p requeues 0
    qdisc netem 8009: parent 1:8 limit 100000 delay 2.0ms
    Sent 39488164 bytes 657705 pkt (dropped 0, overlimits 0 requeues 0)
    rate 38192Kbit 79568pps backlog 13Kb 222p requeues 0

    Signed-off-by: Eric Dumazet
    Cc: Alexei Starovoitov
    Cc: Jamal Hadi Salim
    Cc: John Fastabend
    Acked-by: Alexei Starovoitov
    Acked-by: Jamal Hadi Salim
    Signed-off-by: David S. Miller

    Eric Dumazet
     

18 Apr, 2015

1 commit

  • When you redirect a VLAN device to any device, you end up with
    crap in af_packet on the xmit path because hard_header_len is
    not equal to skb->mac_len. So the redirected packet contains
    four extra bytes at the start which then gets interpreted as
    part of the MAC address.

    This patch fixes this by only pushing skb->mac_len. We also
    need to fix ifb because it tries to undo the pushing done by
    act_mirred.

    Signed-off-by: Herbert Xu
    Acked-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Herbert Xu
     

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
     

16 Jul, 2014

1 commit

  • Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert
    all users to pass NET_NAME_UNKNOWN.

    Coccinelle patch:

    @@
    expression sizeof_priv, name, setup, txqs, rxqs, count;
    @@

    (
    -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs)
    +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs)
    |
    -alloc_netdev_mq(sizeof_priv, name, setup, count)
    +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count)
    |
    -alloc_netdev(sizeof_priv, name, setup)
    +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup)
    )

    v9: move comments here from the wrong commit

    Signed-off-by: Tom Gundersen
    Reviewed-by: David Herrmann
    Signed-off-by: David S. Miller

    Tom Gundersen
     

30 Mar, 2014

1 commit


29 Mar, 2014

1 commit


15 Mar, 2014

1 commit

  • Replace the bh safe variant with the hard irq safe variant.

    We need a hard irq safe variant to deal with netpoll transmitting
    packets from hard irq context, and we need it in most if not all of
    the places using the bh safe variant.

    Except on 32bit uni-processor the code is exactly the same so don't
    bother with a bh variant, just have a hard irq safe variant that
    everyone can use.

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

    Eric W. Biederman
     

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
     

12 Jul, 2013

1 commit


11 Jul, 2013

1 commit

  • According to the commit 16b0dc29c1af9df341428f4c49ada4f626258082
    (dummy: fix rcu_sched self-detected stalls)

    Eric Dumazet fix the problem in dummy, but the ifb will occur the
    same problem like the dummy modules.

    Trying to "modprobe ifb numifbs=30000" triggers :

    INFO: rcu_sched self-detected stall on CPU

    After this splat, RTNL is locked and reboot is needed.

    We must call cond_resched() to avoid this, even holding RTNL.

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

    dingtianhong
     

20 Apr, 2013

2 commits


15 Jan, 2013

1 commit


16 Feb, 2012

1 commit