1. 17 Dec, 2019 29 commits
    • Russell King's avatar
      net: phylink: extend clause 45 PHY validation workaround · df3f57ac
      Russell King authored
      Commit e45d1f52 ("net: phylink: support Clause 45 PHYs on SFP+
      modules") added a workaround to support clause 45 PHYs which
      dynamically switch their interface mode on SFP+ modules.  This was
      implemented by validating the PHYs supported/advertising using
      PHY_INTERFACE_MODE_NA, rather than the specific interface mode that
      we attached the PHY with.
      
      However, we already have a situation where phylink is used to connect
      a Marvell 88X3310 PHY which also behaves in exactly the same way, but
      which seemingly doesn't need this.  The reason seems to be that the
      mvpp2 driver sets a whole bunch of link modes for
      PHY_INTERFACE_MODE_10GKR down to 10Mb/s, despite 10GBASE-R not actually
      supporting anything but 10Gb/s speeds.
      
      When testing with drivers that (correctly) take the mvneta approach,
      where the validate() method only returns what can be supported /
      advertised for the specified link mode, we find that Clause 45 PHYs do
      not behave as we expect: their advertisement is restricted to what
      the current link will support, rather than what the PHY supports
      through its dynamic switching.
      
      Extend this workaround to all such cases; if we have a Clause 45 PHY
      attaching via any means, except in USXGMII, XAUI and RXAUI which are
      all unable to support this dynamic switching or have other solutions
      to it, then we need to validate using PHY_INTERFACE_MODE_NA.
      
      This should allow mvpp2 to switch to a more conformant validate()
      implementation.
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      df3f57ac
    • Russell King's avatar
      net: phylink: improve clause 45 PHY ksettings_set implementation · 5d57c327
      Russell King authored
      While testing ethtool with the Methode DM7052 module, it was noticed
      that attempting to set the advertising mask results in the mask being
      truncated to the support offered by the currently chosen PHY interface
      mode.
      
      When a PHY dynamically changes the PHY interface mode, limiting the
      advertising mask in this way is not correct - if the PHY happened to
      negotiate 10GBASE-T, and selected 10GBASE-R as the host interface, we
      don't want to restrict the advertisement to just 10GBASE-* modes.
      
      Rework setting the advertisement to take account of this; do not pass
      the requested advertisement through phylink_validate(), but rely on
      the advertisement restriction (supported mask) set when the PHY was
      initially setup.
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5d57c327
    • David S. Miller's avatar
      Merge branch 'WireGuard-CI-and-housekeeping' · 6f6dded1
      David S. Miller authored
      Jason A. Donenfeld says:
      
      ====================
      WireGuard CI and housekeeping
      
      This is a collection of commits gathered during the last 1.5 weeks since
      merging WireGuard. If you'd prefer, I can send tree pull requests
      instead, but I figure it might be best for now to just send things as
      full patch sets to netdev.
      
      The first part of this adds in the CI test harness that we've been using
      for quite some time with success. You can type `make` and get the
      selftests running in a fresh VM immediately. This has been an
      instrumental tool in developing WireGuard, and I think it'd benefit most
      from being in-tree alongside the selftests that are already there. Once
      this lands, I plan to get build.wireguard.com building wireguard-
      linux.git and net-next.git on every single commit pushed, and do so on a
      bunch of different architectures. As this migrates into Linus' tree
      eventually and then into net.git, I'll get net.git building there too on
      every commit. Future work with this involves generalizing it to include
      more networking subsystem tests beyond just WireGuard, but one step at a
      time. In the process of porting this to the tree, the builder uncovered
      a mistake in the config menu file, which the second commit fixes.
      
      The last three commits are small housekeeping things, fixing spelling
      mistakes, replacing call_rcu with kfree_rcu, and removing an unused
      include.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6f6dded1
    • Wei Yongjun's avatar
      wireguard: allowedips: use kfree_rcu() instead of call_rcu() · d89ee7d5
      Wei Yongjun authored
      The callback function of call_rcu() just calls a kfree(), so we
      can use kfree_rcu() instead of call_rcu() + callback function.
      Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d89ee7d5
    • YueHaibing's avatar
      wireguard: main: remove unused include <linux/version.h> · 43967b6f
      YueHaibing authored
      Remove <linux/version.h> from the includes for main.c, which is unused.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      [Jason: reworded commit message]
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      43967b6f
    • Josh Soref's avatar
      wireguard: global: fix spelling mistakes in comments · a2ec8b57
      Josh Soref authored
      This fixes two spelling errors in source code comments.
      Signed-off-by: default avatarJosh Soref <jsoref@gmail.com>
      [Jason: rewrote commit message]
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a2ec8b57
    • Jason A. Donenfeld's avatar
      wireguard: Kconfig: select parent dependency for crypto · d7c68a38
      Jason A. Donenfeld authored
      This fixes the crypto selection submenu depenencies. Otherwise, we'd
      wind up issuing warnings in which certain dependencies we also select
      couldn't be satisfied. This condition was triggered by the addition of
      the test suite autobuilder in the previous commit.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d7c68a38
    • Jason A. Donenfeld's avatar
      wireguard: selftests: import harness makefile for test suite · 65d88d04
      Jason A. Donenfeld authored
      WireGuard has been using this on build.wireguard.com for the last
      several years with considerable success. It allows for very quick and
      iterative development cycles, and supports several platforms.
      
      To run the test suite on your current platform in QEMU:
      
        $ make -C tools/testing/selftests/wireguard/qemu -j$(nproc)
      
      To run it with KASAN and such turned on:
      
        $ DEBUG_KERNEL=yes make -C tools/testing/selftests/wireguard/qemu -j$(nproc)
      
      To run it emulated for another platform in QEMU:
      
        $ ARCH=arm make -C tools/testing/selftests/wireguard/qemu -j$(nproc)
      
      At the moment, we support aarch64_be, aarch64, arm, armeb, i686, m68k,
      mips64, mips64el, mips, mipsel, powerpc64le, powerpc, and x86_64.
      
      The system supports incremental rebuilding, so it should be very fast to
      change a single file and then test it out and have immediate feedback.
      
      This requires for the right toolchain and qemu to be installed prior.
      I've had success with those from musl.cc.
      
      This is tailored for WireGuard at the moment, though later projects
      might generalize it for other network testing.
      Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      65d88d04
    • Aditya Pakki's avatar
      net: caif: replace BUG_ON with recovery code · c5dea815
      Aditya Pakki authored
      In caif_xmit, there is a crash if the ptr dev is NULL. However, by
      returning the error to the callers, the error can be handled. The
      patch fixes this issue.
      Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c5dea815
    • Aditya Pakki's avatar
      fore200e: Fix incorrect checks of NULL pointer dereference · bbd20c93
      Aditya Pakki authored
      In fore200e_send and fore200e_close, the pointers from the arguments
      are dereferenced in the variable declaration block and then checked
      for NULL. The patch fixes these issues by avoiding NULL pointer
      dereferences.
      Signed-off-by: default avatarAditya Pakki <pakki001@umn.edu>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bbd20c93
    • David S. Miller's avatar
      Merge branch 'Simplify-IPv4-route-offload-API' · 03d51c4f
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      Simplify IPv4 route offload API
      
      Motivation
      ==========
      
      The aim of this patch set is to simplify the IPv4 route offload API by
      making the stack a bit smarter about the notifications it is generating.
      This allows driver authors to focus on programming the underlying device
      instead of having to duplicate the IPv4 route insertion logic in their
      driver, which is error-prone.
      
      This is the first patch set out of a series of four. Subsequent patch
      sets will simplify the IPv6 API, add offload/trap indication to routes
      and add tests for all the code paths (including error paths). Available
      here [1].
      
      Details
      =======
      
      Today, whenever an IPv4 route is added or deleted a notification is sent
      in the FIB notification chain and it is up to offload drivers to decide
      if the route should be programmed to the hardware or not. This is not an
      easy task as in hardware routes are keyed by {prefix, prefix length,
      table id}, whereas the kernel can store multiple such routes that only
      differ in metric / TOS / nexthop info.
      
      This series makes sure that only routes that are actually used in the
      data path are notified to offload drivers. This greatly simplifies the
      work these drivers need to do, as they are now only concerned with
      programming the hardware and do not need to replicate the IPv4 route
      insertion logic and store multiple identical routes.
      
      The route that is notified is the first FIB alias in the FIB node with
      the given {prefix, prefix length, table ID}. In case the route is
      deleted and there is another route with the same key, a replace
      notification is emitted. Otherwise, a delete notification is emitted.
      
      The above means that in the case of multiple routes with the same key,
      but different TOS, only the route with the highest TOS is notified.
      While the kernel can route a packet based on its TOS, this is not
      supported by any hardware devices I am familiar with. Moreover, this is
      not supported by IPv6 nor by BIRD/FRR from what I could see. Offload
      drivers should therefore use the presence of a non-zero TOS as an
      indication to trap packets matching the route and let the kernel route
      them instead. mlxsw has been doing it for the past two years.
      
      Testing
      =======
      
      To ensure there is no degradation in route insertion rates, I averaged
      the insertion rate of 512k routes (/24 and /32) over 50 runs. Did not
      observe any degradation.
      
      Functional tests are available here [1]. They rely on route trap
      indication, which is only added in the last patch set.
      
      In addition, I have been running syzkaller for the past week with all
      four patch sets and debug options enabled. Did not observe any problems.
      
      Patch set overview
      ==================
      
      Patches #1-#8 gradually introduce the new FIB notifications
      Patch #9 converts mlxsw to use the new notifications
      Patch #10 converts the remaining listeners and removes the old
      notifications
      
      v2:
      * Extend fib_find_alias() with another argument instead of introducing a
        new function (David Ahern)
      
      RFC: https://patchwork.ozlabs.org/cover/1170530/
      
      [1] https://github.com/idosch/linux/tree/fib-notifier
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      03d51c4f
    • Ido Schimmel's avatar
      ipv4: Remove old route notifications and convert listeners · 446f7391
      Ido Schimmel authored
      Unlike mlxsw, the other listeners to the FIB notification chain do not
      require any special modifications as they never considered multiple
      identical routes.
      
      This patch removes the old route notifications and converts all the
      listeners to use the new replace / delete notifications.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      446f7391
    • Ido Schimmel's avatar
      mlxsw: spectrum_router: Start using new IPv4 route notifications · b6a1d871
      Ido Schimmel authored
      With the new notifications mlxsw does not need to handle identical
      routes itself, as this is taken care of by the core IPv4 code.
      
      Instead, mlxsw only needs to take care of inserting and removing routes
      from the device.
      
      Convert mlxsw to use the new IPv4 route notifications and simplify the
      code.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b6a1d871
    • Ido Schimmel's avatar
      ipv4: Only Replay routes of interest to new listeners · 20d15652
      Ido Schimmel authored
      When a new listener is registered to the FIB notification chain it
      receives a dump of all the available routes in the system. Instead, make
      sure to only replay the IPv4 routes that are actually used in the data
      path and are of any interest to the new listener.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      20d15652
    • Ido Schimmel's avatar
      ipv4: Handle route deletion notification during flush · 525bc345
      Ido Schimmel authored
      In a similar fashion to previous patch, when a route is deleted as part
      of table flushing, promote the next route in the list, if exists.
      Otherwise, simply emit a delete notification.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      525bc345
    • Ido Schimmel's avatar
      ipv4: Handle route deletion notification · f613b6e2
      Ido Schimmel authored
      When a route is deleted we potentially need to promote the next route in
      the FIB alias list (e.g., with an higher metric). In case we find such a
      route, a replace notification is emitted. Otherwise, a delete
      notification for the deleted route.
      
      v2:
      * Convert to use fib_find_alias() instead of fib_find_first_alias()
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f613b6e2
    • Ido Schimmel's avatar
      ipv4: Notify newly added route if should be offloaded · a8674f75
      Ido Schimmel authored
      When a route is added, it should only be notified in case it is the
      first route in the FIB alias list with the given {prefix, prefix length,
      table ID}. Otherwise, it is not used in the data path and should not be
      considered by switch drivers.
      
      v2:
      * Convert to use fib_find_alias() instead of fib_find_first_alias()
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a8674f75
    • Ido Schimmel's avatar
      ipv4: Notify route if replacing currently offloaded one · ee3936d6
      Ido Schimmel authored
      When replacing a route, its replacement should only be notified in case
      the replaced route is of any interest to listeners. In other words, if
      the replaced route is currently used in the data path, which means it is
      the first route in the FIB alias list with the given {prefix, prefix
      length, table ID}.
      
      v2:
      * Convert to use fib_find_alias() instead of fib_find_first_alias()
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ee3936d6
    • Ido Schimmel's avatar
      ipv4: Extend FIB alias find function · b5fc0430
      Ido Schimmel authored
      Extend the function with another argument, 'find_first'. When set, the
      function returns the first FIB alias with the matching {prefix, prefix
      length, table ID}. The TOS and priority parameters are ignored. Current
      callers are converted to pass 'false' in order to maintain existing
      behavior.
      
      This will be used by subsequent patches in the series.
      
      v2:
      * New patch
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Suggested-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b5fc0430
    • Ido Schimmel's avatar
      ipv4: Notify route after insertion to the routing table · a6c76c17
      Ido Schimmel authored
      Currently, a new route is notified in the FIB notification chain before
      it is inserted to the FIB alias list.
      
      Subsequent patches will use the placement of the new route in the
      ordered FIB alias list in order to determine if the route should be
      notified or not.
      
      As a preparatory step, change the order so that the route is first
      inserted into the FIB alias list and only then notified.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6c76c17
    • Ido Schimmel's avatar
      net: fib_notifier: Add temporary events to the FIB notification chain · ba838123
      Ido Schimmel authored
      Subsequent patches are going to simplify the IPv4 route offload API,
      which will only use two events - replace and delete.
      
      Introduce a temporary version of these two events in order to make the
      conversion easier to review.
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ba838123
    • David S. Miller's avatar
      Merge branch 'hns3-next' · 366c7bb0
      David S. Miller authored
      Huazhong Tan says:
      
      ====================
      net: hns3: some optimizaions related to work task
      
      This series refactors the work task of the HNS3 ethernet driver.
      
      [patch 1/5] uses delayed workqueue to replace the timer for
      hclgevf_service task, make the code simpler.
      
      [patch 2/5] & [patch 3/5] unifies current mailbox, reset and
      service work into one.
      
      [patch 4/5] allocates a private work queue with WQ_MEM_RECLAIM
      for the HNS3 driver.
      
      [patch 5/5] adds a new flag to indicate whether reset fails,
      and prevent scheduling service task to handle periodic task
      when this flag has been set.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      366c7bb0
    • Guojia Liao's avatar
      net: hns3: do not schedule the periodic task when reset fail · d5432455
      Guojia Liao authored
      service_task will be scheduled  per second to do some periodic
      jobs. When reset fails, it means this device is not available
      now, so the periodic jobs do not need to be handled.
      
      This patch adds flag HCLGE_STATE_RST_FAIL/HCLGEVF_STATE_RST_FAIL
      to indicate that reset fails, and checks this flag before
      schedule periodic task.
      Signed-off-by: default avatarGuojia Liao <liaoguojia@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d5432455
    • Yunsheng Lin's avatar
      net: hns3: allocate WQ with WQ_MEM_RECLAIM flag · 0ea68902
      Yunsheng Lin authored
      The hns3 driver may be used in memory reclaim path when it
      is the low level transport of a network file system, so it
      needs to guarantee forward progress even under memory pressure.
      
      This patch allocates a private WQ with WQ_MEM_RECLAIM set for
      both hclge_main and hclgevf_main modules.
      Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0ea68902
    • Yunsheng Lin's avatar
      net: hns3: remove unnecessary work in hclgevf_main · ff200099
      Yunsheng Lin authored
      There are four work (mbx_service_task, service_task,
      rst_service_task and keep_alive_task)in the hclgevf module,
      mbx_service_task is for handling mailbox issue, service_task is
      for periodic management issue and rst_service_task is for reset
      related issue, keep_alive_task is used to keepalive between PF
      and VF, which can be done in a single work.
      
      This patch removes the mbx_service_task, rst_service_task and
      keep_alive_task, and moves the related handling to the
      service_task work in order to remove concurrency between the four
      work and to improve efficiency.
      Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ff200099
    • Yunsheng Lin's avatar
      net: hns3: remove mailbox and reset work in hclge_main · 1c6dfe6f
      Yunsheng Lin authored
      There are three work (mbx_service_task, service_task,
      rst_service_task) in the HNS3 driver, mbx_service_task is for
      handling mailbox work, service_task is for periodic management
      issue and rst_service_task is for reset related issue, which can
      be handled in a single work.
      
      This patch removes the mbx_service_task and rst_service_task
      work, and moves the related handling to the service_task work
      in order to remove concurrency between the three work and to
      improve efficiency.
      
      BTW, since stats_timer in struct hclge_hw_stats is not needed
      anymore, so removes the definition of struct hclge_hw_stats,
      and moves mac_stats into struct hclge_dev.
      Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1c6dfe6f
    • Yunsheng Lin's avatar
      net: hns3: schedule hclgevf_service by using delayed workqueue · b3c3fe8e
      Yunsheng Lin authored
      Currently, a timer is defined to schedule hclgevf_service per
      second. To simplify the code, this patch uses the delayed work
      instead of timer to schedule hclgevf_serive.
      Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
      Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b3c3fe8e
    • Sven Eckelmann's avatar
      ipv6: Annotate ipv6_addr_is_* bitwise pointer casts · 54e1f08b
      Sven Eckelmann authored
      The sparse commit 6002ded74587 ("add a flag to warn on casts to/from
      bitwise pointers") introduced a check for non-direct casts from/to
      restricted datatypes (when -Wbitwise-pointer is enabled).
      
      This triggered a warning in the 64 bit optimized ipv6_addr_is_*() functions
      because sparse doesn't know that the buffer already points to some data in
      the correct bitwise integer format. But these were correct and can
      therefore be marked with __force to signalize sparse an intended cast to a
      specific bitwise type.
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      54e1f08b
    • Sven Eckelmann's avatar
      ipv6: Annotate bitwise IPv6 dsfield pointer cast · 1f1c1d7c
      Sven Eckelmann authored
      The sparse commit 6002ded74587 ("add a flag to warn on casts to/from
      bitwise pointers") introduced a check for non-direct casts from/to
      restricted datatypes (when -Wbitwise-pointer is enabled).
      
      This triggered a warning in ipv6_get_dsfield() because sparse doesn't know
      that the buffer already points to some data in the correct bitwise integer
      format. This was already fixed in ipv6_change_dsfield() by the __force
      attribute and can be fixed here the same way.
      Signed-off-by: default avatarSven Eckelmann <sven@narfation.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f1c1d7c
  2. 16 Dec, 2019 5 commits
  3. 15 Dec, 2019 6 commits