1. 03 Sep, 2020 14 commits
    • David S. Miller's avatar
      Merge branch 'l2tp-miscellaneous-cleanups' · 08aaa081
      David S. Miller authored
      Tom Parkin says:
      
      ====================
      l2tp: miscellaneous cleanups
      
      This series of patches makes the following cleanups and improvements to
      the l2tp code:
      
       * various API tweaks to remove unused parameters from function calls
       * lightly refactor the l2tp transmission path to capture more error
         conditions in the data plane statistics
       * repurpose the "magic feather" validation in l2tp to check for
         sk_user_data (ab)use as opposed to refcount debugging
       * remove some duplicated code
      ====================
      Reviewed-by: default avatarJames Chapman <jchapman@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      08aaa081
    • Tom Parkin's avatar
      l2tp: avoid duplicated code in l2tp_tunnel_closeall · 9d319a8e
      Tom Parkin authored
      l2tp_tunnel_closeall is called as a part of tunnel shutdown in order to
      close all the sessions held by the tunnel.  The code it uses to close a
      session duplicates what l2tp_session_delete does.
      
      Rather than duplicating the code, have l2tp_tunnel_closeall call
      l2tp_session_delete instead.
      
      This involves a very minor change to locking in l2tp_tunnel_closeall.
      Previously, l2tp_tunnel_closeall checked the session "dead" flag while
      holding tunnel->hlist_lock.  This allowed for the code to step to the
      next session in the list without releasing the lock if the current
      session happened to be in the process of closing already.
      
      By calling l2tp_session_delete instead, l2tp_tunnel_closeall must now
      drop and regain the hlist lock for each session in the tunnel list.
      Given that the likelihood of a session being in the process of closing
      when the tunnel is closed, it seems worth this very minor potential
      loss of efficiency to avoid duplication of the session delete code.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9d319a8e
    • Tom Parkin's avatar
      l2tp: make magic feather checks more useful · 45faeff1
      Tom Parkin authored
      The l2tp tunnel and session structures contain a "magic feather" field
      which was originally intended to help trace lifetime bugs in the code.
      
      Since the introduction of the shared kernel refcount code in refcount.h,
      and l2tp's porting to those APIs, we are covered by the refcount code's
      checks and warnings.  Duplicating those checks in the l2tp code isn't
      useful.
      
      However, magic feather checks are still useful to help to detect bugs
      stemming from misuse/trampling of the sk_user_data pointer in struct
      sock.  The l2tp code makes extensive use of sk_user_data to stash
      pointers to the tunnel and session structures, and if another subsystem
      overwrites sk_user_data it's important to detect this.
      
      As such, rework l2tp's magic feather checks to focus on validating the
      tunnel and session data structures when they're extracted from
      sk_user_data.
      
       * Add a new accessor function l2tp_sk_to_tunnel which contains a magic
         feather check, and is used by l2tp_core and l2tp_ip[6]
       * Comment l2tp_udp_encap_recv which doesn't use this new accessor function
         because of the specific nature of the codepath it is called in
       * Drop l2tp_session_queue_purge's check on the session magic feather:
         it is called from code which is walking the tunnel session list, and
         hence doesn't need validation
       * Drop l2tp_session_free's check on the tunnel magic feather: the
         intention of this check is covered by refcount.h's reference count
         sanity checking
       * Add session magic validation in pppol2tp_ioctl.  On failure return
         -EBADF, which mirrors the approach in pppol2tp_[sg]etsockopt.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      45faeff1
    • Tom Parkin's avatar
      l2tp: capture more tx errors in data plane stats · de68b039
      Tom Parkin authored
      l2tp_xmit_skb has a number of failure paths which are not reflected in
      the tunnel and session statistics because the stats are updated by
      l2tp_xmit_core.  Hence any errors occurring before l2tp_xmit_core is
      called are missed from the statistics.
      
      Refactor the transmit path slightly to capture all error paths.
      
      l2tp_xmit_skb now leaves all the actual work of transmission to
      l2tp_xmit_core, and updates the statistics based on l2tp_xmit_core's
      return code.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      de68b039
    • Tom Parkin's avatar
      l2tp: drop net argument from l2tp_tunnel_create · c9ccd4c6
      Tom Parkin authored
      The argument is unused, so remove it.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c9ccd4c6
    • Tom Parkin's avatar
      l2tp: drop data_len argument from l2tp_xmit_core · 039bca78
      Tom Parkin authored
      The data_len argument passed to l2tp_xmit_core is no longer used, so
      remove it.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      039bca78
    • Tom Parkin's avatar
      l2tp: remove header length param from l2tp_xmit_skb · efe05278
      Tom Parkin authored
      All callers pass the session structure's hdr_len field as the header
      length parameter to l2tp_xmit_skb.
      
      Since we're passing a pointer to the session structure to l2tp_xmit_skb
      anyway, there's not much point breaking the header length out as a
      separate argument.
      Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      efe05278
    • David S. Miller's avatar
      Merge branch 'mlxsw-Expose-critical-and-emergency-module-alarms' · ffd923f5
      David S. Miller authored
      Ido Schimmel says:
      
      ====================
      mlxsw: Expose critical and emergency module alarms
      
      Amit says:
      
      Extend hwmon interface with critical and emergency module alarms.
      
      In case that current module temperature is higher than emergency
      threshold, EMERGENCY alarm will be reported in sensors utility:
      
      $ sensors
      ...
      front panel 025:  +55.0°C  (crit = +35.0°C, emerg = +40.0°C) ALARM(EMERGENCY)
      
      In case that current module temperature is higher than critical
      threshold, CRIT alarm will be reported in sensors utility:
      
      $ sensors
      ...
      front panel 025:  +54.0°C  (crit = +35.0°C, emerg = +80.0°C) ALARM(CRIT)
      
      Patch set overview:
      
      Patches #1-#2 make several changes to make the code easier to change.
      
      Patch #3 extends the hwmon interface with the new module alarms.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ffd923f5
    • Amit Cohen's avatar
      mlxsw: core_hwmon: Extend hwmon interface with critical and emergency alarms · 91df5d3a
      Amit Cohen authored
      Add new attributes to hwmon object for exposing critical and emergency
      alarms.
      
      In case that current temperature is higher than emergency threshold,
      EMERGENCY alarm will be reported in sensors utility:
      
      $ sensors
      ...
      front panel 025:  +55.0°C  (crit = +35.0°C, emerg = +40.0°C) ALARM(EMERGENCY)
      
      In case that current temperature is higher than critical threshold,
      CRIT alarm will be reported in sensors utility:
      
      $ sensors
      ...
      front panel 025:  +54.0°C  (crit = +35.0°C, emerg = +80.0°C) ALARM(CRIT)
      Signed-off-by: default avatarAmit Cohen <amitc@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Acked-by: default avatarVadim Pasternak <vadimp@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      91df5d3a
    • Amit Cohen's avatar
      mlxsw: core_hwmon: Calculate MLXSW_HWMON_ATTR_COUNT more accurately · 02bed4e8
      Amit Cohen authored
      Currently the value of MLXSW_HWMON_ATTR_COUNT is calculated not really
      accurate.
      
      Add several defines to make the calculation clearer and easier to
      change.
      
      Calculate the precise high bound of number of attributes that may be
      needed.
      Signed-off-by: default avatarAmit Cohen <amitc@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      02bed4e8
    • Amit Cohen's avatar
      mlxsw: core_hwmon: Split temperature querying from show functions · ad38d47b
      Amit Cohen authored
      mlxsw_hwmon_module_temp_show(), mlxsw_hwmon_module_temp_critical_show()
      and mlxsw_hwmon_module_temp_emergency_show() query the relevant
      temperature from firmware and fill the value in provided buffers.
      
      Split the temperature querying functionality to individual get()
      functions and call them from the show() functions.
      
      The get() functions will be used by subsequent patches in the set.
      Signed-off-by: default avatarAmit Cohen <amitc@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ad38d47b
    • David S. Miller's avatar
      Merge branch 'Minor-improvements-to-b53-dmesg-output' · 7544abd9
      David S. Miller authored
      Paul Barker says:
      
      ====================
      Minor improvements to b53 dmesg output
      
      These changes were made while debugging the b53 driver for use on a
      custom board. They've been runtime tested on a patched 4.14.y kernel
      which supports this board as well as build tested with 5.9-rc3. The
      changes are straightforward enough that I think this testing is
      sufficient but let me know if further testing is required.
      
      Unfortunately I don't have a board to hand which boots with a more
      recent kernel and has a switch supported by the b53 driver. I'd still
      like to upstream these patches if possible though.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7544abd9
    • Paul Barker's avatar
      net: dsa: b53: Print err message on SW_RST timeout · 434d2312
      Paul Barker authored
      This allows us to differentiate between the possible failure modes of
      b53_switch_reset() by looking at the dmesg output.
      Signed-off-by: default avatarPaul Barker <pbarker@konsulko.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      434d2312
    • Paul Barker's avatar
      net: dsa: b53: Use dev_{err,info} instead of pr_* · 3b33438c
      Paul Barker authored
      This change allows us to see which device the err or info messages are
      referring to if we have multiple b53 compatible devices on a board.
      
      As this removes the only pr_*() calls in this file we can drop the
      definition of pr_fmt().
      Signed-off-by: default avatarPaul Barker <pbarker@konsulko.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3b33438c
  2. 02 Sep, 2020 11 commits
  3. 01 Sep, 2020 15 commits