12 Jun, 2018

1 commit

  • [ Upstream commit 664088f8d68178809b848ca450f2797efb34e8e7 ]

    This patch reorders the error cases in showing the XPS configuration so
    that we hold off on memory allocation until after we have verified that we
    can support XPS on a given ring.

    Fixes: 184c449f91fe ("net: Add support for XPS with QoS via traffic classes")
    Signed-off-by: Alexander Duyck
    Signed-off-by: David S. Miller
    Signed-off-by: Greg Kroah-Hartman

    Alexander Duyck
     

19 Aug, 2017

10 commits


01 Jul, 2017

1 commit

  • refcount_t type and corresponding API should be
    used instead of atomic_t when the variable is used as
    a reference counter. This allows to avoid accidental
    refcounter overflows that might lead to use-after-free
    situations.

    Signed-off-by: Elena Reshetova
    Signed-off-by: Hans Liljestrand
    Signed-off-by: Kees Cook
    Signed-off-by: David Windsor
    Signed-off-by: David S. Miller

    Reshetova, Elena
     

30 Jun, 2017

1 commit

  • attribute_groups are not supposed to change at runtime. All functions
    working with attribute_groups provided by work with const
    attribute_group. So mark the non-const structs as const.

    File size before:
    text data bss dec hex filename
    9968 3168 16 13152 3360 net/core/net-sysfs.o

    File size After adding 'const':
    text data bss dec hex filename
    10160 2976 16 13152 3360 net/core/net-sysfs.o

    Signed-off-by: Arvind Yadav
    Signed-off-by: David S. Miller

    Arvind Yadav
     

18 May, 2017

1 commit

  • 4 billion packet queue is something unthinkable so use 32-bit value
    for now.

    Space savings on x86_64:

    add/remove: 0/0 grow/shrink: 3/70 up/down: 16/-131 (-115)
    function old new delta
    change_tx_queue_len 94 108 +14
    qdisc_create 1176 1177 +1
    alloc_netdev_mqs 1124 1125 +1
    xenvif_alloc 533 532 -1
    x25_asy_setup 167 166 -1
    ...
    tun_queue_resize 945 940 -5
    pfifo_fast_enqueue 167 162 -5
    qfq_init_qdisc 168 158 -10
    tap_queue_resize 810 799 -11
    transmit 719 698 -21

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: David S. Miller

    Alexey Dobriyan
     

14 Mar, 2017

1 commit

  • The previous idea was to check whether a net namespace is in
    net_exit_list or not. It doesn't work, because net->exit_list is used in
    __register_pernet_operations and __unregister_pernet_operations where
    all namespaces are added to a temporary list to make cleanup in a error
    case, so list_empty(&net->exit_list) always returns false.

    Reported-by: Mantas Mikulėnas
    Fixes: 002d8a1a6c11 ("net: skip genenerating uevents for network namespaces that are exiting")
    Signed-off-by: Andrei Vagin
    Signed-off-by: David S. Miller

    Andrey Vagin
     

02 Mar, 2017

1 commit


01 Nov, 2016

2 commits

  • This patch adds support for setting and using XPS when QoS via traffic
    classes is enabled. With this change we will factor in the priority and
    traffic class mapping of the packet and use that information to correctly
    select the queue.

    This allows us to define a set of queues for a given traffic class via
    mqprio and then configure the XPS mapping for those queues so that the
    traffic flows can avoid head-of-line blocking between the individual CPUs
    if so desired.

    Signed-off-by: Alexander Duyck
    Signed-off-by: David S. Miller

    Alexander Duyck
     
  • Add a sysfs attribute for a Tx queue that allows us to determine the
    traffic class for a given queue. This will allow us to more easily
    determine this in the future. It is needed as XPS will take the traffic
    class for a group of queues into account in order to avoid pulling traffic
    from one traffic class into another.

    Signed-off-by: Alexander Duyck
    Signed-off-by: David S. Miller

    Alexander Duyck
     

28 Oct, 2016

1 commit

  • No one can see these events, because a network namespace can not be
    destroyed, if it has sockets.

    Unlike other devices, uevent-s for network devices are generated
    only inside their network namespaces. They are filtered in
    kobj_bcast_filter()

    My experiments shows that net namespaces are destroyed more 30% faster
    with this optimization.

    Here is a perf output for destroying network namespaces without this
    patch.

    - 94.76% 0.02% kworker/u48:1 [kernel.kallsyms] [k] cleanup_net
    - 94.74% cleanup_net
    - 94.64% ops_exit_list.isra.4
    - 41.61% default_device_exit_batch
    - 41.47% unregister_netdevice_many
    - rollback_registered_many
    - 40.36% netdev_unregister_kobject
    - 14.55% device_del
    + 13.71% kobject_uevent
    - 13.04% netdev_queue_update_kobjects
    + 12.96% kobject_put
    - 12.72% net_rx_queue_update_kobjects
    kobject_put
    - kobject_release
    + 12.69% kobject_uevent
    + 0.80% call_netdevice_notifiers_info
    + 19.57% nfsd_exit_net
    + 11.15% tcp_net_metrics_exit
    + 8.25% rpcsec_gss_exit_net

    It's very critical to optimize the exit path for network namespaces,
    because they are destroyed under net_mutex and many namespaces can be
    destroyed for one iteration.

    v2: use dev_set_uevent_suppress()

    Cc: Cong Wang
    Cc: "David S. Miller"
    Cc: Eric W. Biederman
    Signed-off-by: Andrei Vagin
    Signed-off-by: David S. Miller

    Andrey Vagin
     

01 Jul, 2016

1 commit

  • This patch introduces a new event - NETDEV_CHANGE_TX_QUEUE_LEN, this
    will be triggered when tx_queue_len. It could be used by net device
    who want to do some processing at that time. An example is tun who may
    want to resize tx array when tx_queue_len is changed.

    Cc: John Fastabend
    Signed-off-by: Jason Wang
    Acked-by: John Fastabend
    Signed-off-by: David S. Miller

    Jason Wang
     

08 Jun, 2016

1 commit

  • The of_find_net_device_by_node() function is defined in
    but not included in the .c file that
    implements it. Fix the following warning by including the
    header:

    net/core/net-sysfs.c:1494:19: warning: symbol 'of_find_net_device_by_node' was not declared. Should it be static?

    Signed-off-by: Ben Dooks
    Signed-off-by: David S. Miller

    Ben Dooks
     

26 Feb, 2016

1 commit


18 Feb, 2016

1 commit


06 Feb, 2016

1 commit

  • This adds an rx_nohandler stat counter, along with a sysfs statistics
    node, and copies the counter out via netlink as well.

    CC: "David S. Miller"
    CC: Eric Dumazet
    CC: Jiri Pirko
    CC: Daniel Borkmann
    CC: Tom Herbert
    CC: Jay Vosburgh
    CC: Veaceslav Falico
    CC: Andy Gospodarek
    CC: netdev@vger.kernel.org
    Signed-off-by: Jarod Wilson
    Signed-off-by: David S. Miller

    Jarod Wilson
     

23 Dec, 2015

1 commit


16 Dec, 2015

1 commit

  • switchdev drivers need to know the netdev on which the switchdev op was
    invoked. For example, the STP state of a VLAN interface configured on top
    of a port can change while being member in a bridge. In this case, the
    underlying driver should only change the STP state of that particular
    VLAN and not of all the VLANs configured on the port.

    However, current switchdev infrastructure only passes the port netdev down
    to the driver. Solve that by passing the original device down to the
    driver as part of the required switchdev object / attribute.

    This doesn't entail any change in current switchdev drivers. It simply
    enables those supporting stacked devices to know the originating device
    and act accordingly.

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

    Ido Schimmel
     

03 Oct, 2015

1 commit


02 Oct, 2015

1 commit


30 Sep, 2015

1 commit

  • Otherwise 4294967295 (MBit/s) (-1) will be printed when there is no link.
    Documentation/ABI/testing/sysfs-class-net does not state if this shall be
    signed or unsigned.
    Also remove the now unused variable fmt_udec.

    Signed-off-by: Alexander Stein
    Signed-off-by: David S. Miller

    Alexander Stein
     

27 Sep, 2015

1 commit


25 Sep, 2015

1 commit

  • of_find_net_device_by_node() uses class_find_device() internally to
    lookup the corresponding network device. class_find_device() returns
    a reference to the embedded struct device, with its refcount
    incremented.

    Add a comment to the definition in net/core/net-sysfs.c indicating the
    need to drop this refcount, and fix the DSA code to drop this refcount
    when the OF-generated platform data is cleaned up and freed. Also
    arrange for the ref to be dropped when handling errors.

    Signed-off-by: Russell King
    Signed-off-by: David S. Miller

    Russell King
     

18 Sep, 2015

1 commit

  • Redo commit ed1acc8cd8c22efa919da8d300bab646e01c2dce.

    Commit 822b3b2ebfff8e9b3d006086c527738a7ca00cd0 ("net: Add max rate tx queue
    attribute") moved get_netdev_queue_index around, but kept the old version.
    Probably because of a reuse of the original patch from before Eric's change to
    that function.

    Remove one inline keyword, and no need for a loop to find
    an index into a table.

    Signed-off-by: Thadeu Lima de Souza Cascardo
    Fixes: 822b3b2ebfff ("net: Add max rate tx queue attribute")
    Acked-by: Or Gerlitz
    Acked-by: John Fastabend
    Cc: Eric Dumazet
    Signed-off-by: David S. Miller

    Thadeu Lima de Souza Cascardo
     

14 Aug, 2015

1 commit

  • Commit 10e4ea751 ("net: Fix race condition in store_rps_map") has moved the
    manipulation of the rps_needed jump label under a spinlock. Since changing
    the state of a jump label may sleep this is incorrect and causes warnings
    during runtime.

    Make rps_map_lock a mutex to allow sleeping under it.

    Fixes: 10e4ea751 ("net: Fix race condition in store_rps_map")
    Signed-off-by: Sasha Levin
    Acked-by: Tom Herbert
    Signed-off-by: David S. Miller

    Sasha Levin
     

08 Aug, 2015

1 commit

  • There is a race condition in store_rps_map that allows jump label
    count in rps_needed to go below zero. This can happen when
    concurrently attempting to set and a clear map.

    Scenario:

    1. rps_needed count is zero
    2. New map is assigned by setting thread, but rps_needed count _not_ yet
    incremented (rps_needed count still zero)
    2. Map is cleared by second thread, old_map set to that just assigned
    3. Second thread performs static_key_slow_dec, rps_needed count now goes
    negative

    Fix is to increment or decrement rps_needed under the spinlock.

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

    Tom Herbert
     

16 Jul, 2015

1 commit

  • This patch introduces the proto_down flag that can be used by user space
    applications to notify switch drivers that errors have been detected on the
    device.

    The switch driver can react to protodown notification by doing a phys down
    on the associated switch port.

    Signed-off-by: Anuradha Karuppiah
    Signed-off-by: Andy Gospodarek
    Signed-off-by: Roopa Prabhu
    Signed-off-by: Wilson Kok
    Signed-off-by: David S. Miller

    Anuradha Karuppiah
     

14 May, 2015

1 commit


13 May, 2015

2 commits

  • Switch ID is just a gettable port attribute. Convert switchdev op
    switchdev_parent_id_get to a switchdev attr.

    Note: for sysfs and netlink interfaces, SWITCHDEV_ATTR_PORT_PARENT_ID is
    called with SWITCHDEV_F_NO_RECUSE to limit switch ID user-visiblity to only
    port netdevs. So when a port is stacked under bond/bridge, the user can
    only query switch id via the switch ports, but not via the upper devices

    Signed-off-by: Scott Feldman
    Acked-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Scott Feldman
     
  • Turned out that "switchdev" sticks. So just unify all related terms to use
    this prefix.

    Signed-off-by: Jiri Pirko
    Signed-off-by: Scott Feldman
    Acked-by: Roopa Prabhu
    Acked-by: Andy Gospodarek
    Signed-off-by: David S. Miller

    Jiri Pirko
     

03 Apr, 2015

1 commit

  • The goal of this patch is to prepare the removal of the iflink field. It
    introduces a new ndo function, which will be implemented by virtual interfaces.

    There is no functional change into this patch. All readers of iflink field
    now call dev_get_iflink().

    Signed-off-by: Nicolas Dichtel
    Signed-off-by: David S. Miller

    Nicolas Dichtel
     

19 Mar, 2015

1 commit

  • Similar to port id allow netdevices to specify port names and export
    the name via sysfs. Drivers can implement the netdevice operation to
    assist udev in having sane default names for the devices using the
    rule:

    $ cat /etc/udev/rules.d/80-net-setup-link.rules
    SUBSYSTEM=="net", ACTION=="add", ATTR{phys_port_name}!="",
    NAME="$attr{phys_port_name}"

    Use of phys_name versus phys_id was suggested-by Jiri Pirko.

    Signed-off-by: David Ahern
    Acked-by: Jiri Pirko
    Acked-by: Scott Feldman
    Signed-off-by: David S. Miller

    David Ahern