1. 20 Dec, 2018 29 commits
  2. 19 Dec, 2018 11 commits
    • David S. Miller's avatar
      Merge branch 'neigh-get-support' · 24894bc6
      David S. Miller authored
      
      
      Roopa Prabhu says:
      
      ====================
      neigh get support
      
      This series adds support for neigh get similar
      to route and recently added fdb get.
      
      v2: fix key len check. and some other fixes
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      24894bc6
    • Roopa Prabhu's avatar
    • Roopa Prabhu's avatar
      neighbour: register rtnl doit handler · 82cbb5c6
      Roopa Prabhu authored
      
      
      this patch registers neigh doit handler. The doit handler
      returns a neigh entry given dst and dev. This is similar
      to route and fdb doit (get) handlers. Also moves nda_policy
      declaration from rtnetlink.c to neighbour.c
      
      Signed-off-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
      Reviewed-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      82cbb5c6
    • David S. Miller's avatar
      Merge branch 'mlxsw-Make-driver-more-robust' · 4ab0edec
      David S. Miller authored
      
      
      Ido Schimmel says:
      
      ====================
      mlxsw: Make driver more robust
      
      In recent months we fixed several bugs in the driver that could have
      been avoided by re-evaluating some of the involved code paths and by
      introducing relevant and comprehensive test cases.
      
      This patchset tries to do that by introducing a set of small and mostly
      non-functional changes in addition to a new test. I have further
      improvements in mind, but they can be done in a different set.
      
      Patch #1 makes sure we correctly sanitize upper devices of a VLAN
      interface.
      
      Patch #2 removes an unexpected behavior from the driver, in which routes
      configured on a VLAN interface will cease being offloaded after certain
      operations.
      
      Patch #3 is a small cleanup.
      
      Patch #4 simplifies the driver by removing reference counting from VLAN
      entries configured on a port.
      
      Patches #5-#6 simplify linking/unlinking from a bridge, especially when
      LAG and VLAN devices are involved. They make both operations symmetric
      even when ports are unlinked from a bridged LAG device.
      
      Patch #7-#9 make router interface (RIF) deletion more robust by removing
      reliance on device chain to indicate whether a NETDEV_DOWN event in the
      inet{,6}addr notification chains should be processed. This is due to the
      fact that IP addresses can be flushed from a netdev after it was
      unlinked from its lower device.
      
      Patch #10 adds a new test to for valid and invalid configurations over
      mlxsw ports. Some of the test cases are derived from recent fixes. I
      expect that more test cases will be added over time.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ab0edec
    • Ido Schimmel's avatar
      selftests: mlxsw: Add rtnetlink tests · 489c25f9
      Ido Schimmel authored
      
      
      Add a new test that is focused on rtnetlink configuration. Its purpose
      is to test valid and invalid (as deemed by mlxsw) configurations and
      make sure that they succeed / fail without producing a trace.
      
      Some of the test cases are derived from recent fixes in order to make
      sure that the fixed bugs are not introduced again.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      489c25f9
    • Ido Schimmel's avatar
      mlxsw: spectrum_router: Hold a reference on RIF's netdev · b61cd7c6
      Ido Schimmel authored
      
      
      Previous patches tried to make RIF deletion more robust and avoid
      use-after-free situations.
      
      As another precaution, hold a reference on a RIF's netdev and release it
      when the RIF is deleted.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b61cd7c6
    • Ido Schimmel's avatar
      mlxsw: spectrum_router: Make RIF deletion more robust · 965fa8e6
      Ido Schimmel authored
      
      
      In the past we had multiple instances where RIFs were not properly
      deleted.
      
      One of the reasons for leaking a RIF was that at the time when IP
      addresses were flushed from the respective netdev (prompting the
      destruction of the RIF), the netdev was no longer a mlxsw upper. This
      caused the inet{,6}addr notification blocks to ignore the NETDEV_DOWN
      event and leak the RIF.
      
      Instead of checking whether the netdev is our upper when an IP address
      is removed, we can instead check if the netdev has a RIF configured.
      
      To look up a RIF we need to access mlxsw private data, so the patch
      stores the notification blocks inside a mlxsw struct. This then allows
      us to use container_of() and extract the required private data.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      965fa8e6
    • Ido Schimmel's avatar
      mlxsw: spectrum_router: Propagate 'struct mlxsw_sp' further · 21ffedb6
      Ido Schimmel authored
      
      
      Next patch is going to make RIF deletion more robust by removing
      reliance on fragile mlxsw_sp_lower_get(). This is because a netdev is
      not necessarily our upper anymore when its IP addresses are flushed.
      
      The inet{,6}addr notification blocks are going to resolve 'struct
      mlxsw_sp' using container_of(), but the functions they call still use
      mlxsw_sp_lower_get().
      
      As a preparation for the next patch, propagate 'struct mlxsw_sp' down to
      the functions called from the notification blocks and remove reliance on
      mlxsw_sp_lower_get().
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      21ffedb6
    • Ido Schimmel's avatar
      mlxsw: spectrum: Properly cleanup LAG uppers when removing port from LAG · be2d6f42
      Ido Schimmel authored
      
      
      When a LAG device or a VLAN device on top of it is enslaved to a bridge,
      the driver propagates the CHANGEUPPER event to the LAG's slaves.
      
      This causes each physical port to increase the reference count of the
      internal representation of the bridge port by calling
      mlxsw_sp_port_bridge_join().
      
      However, when a port is removed from a LAG, the corresponding leave()
      function is not called and the reference count is not decremented. This
      leads to ugly hacks such as mlxsw_sp_bridge_port_should_destroy() that
      try to understand if the bridge port should be destroyed even when its
      reference count is not 0.
      
      Instead, make sure that when a port is unlinked from a LAG it would see
      the same events as if the LAG (or its uppers) were unlinked from a
      bridge.
      
      The above is achieved by walking the LAG's uppers when a port is
      unlinked and calling mlxsw_sp_port_bridge_leave() for each upper that is
      enslaved to a bridge.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      be2d6f42
    • Ido Schimmel's avatar
      mlxsw: spectrum: Remove reference count from VLAN entries · 635c8c8b
      Ido Schimmel authored
      Commit b3529af6
      
       ("spectrum: Reference count VLAN entries") started
      reference counting port-VLAN entries in a similar fashion to the 8021q
      driver.
      
      However, this is not actually needed and only complicates things.
      Instead, the driver should forbid the creation of a VLAN on a port if
      this VLAN already exists. This would also solve the issue fixed by the
      mentioned commit.
      
      Therefore, remove the get()/put() API and use create()/destroy()
      instead.
      
      One place that needs special attention is VLAN addition in a VLAN-aware
      bridge via switchdev operations. In case the VLAN flags (e.g., 'pvid')
      are toggled, then the VLAN entry already exists. To prevent the driver
      from wrongly returning EEXIST, the driver is changed to check in the
      prepare phase whether the entry already exists and only returns an error
      in case it is not associated with the correct bridge port.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      635c8c8b
    • Ido Schimmel's avatar
      mlxsw: spectrum: Handle VLAN device unlinking · e149113a
      Ido Schimmel authored
      In commit 993107fe
      
       ("mlxsw: spectrum_switchdev: Fix VLAN device
      deletion via ioctl") I fixed a bug caused by the fact that the driver
      views differently the deletion of a VLAN device when it is deleted via
      an ioctl and netlink.
      
      Instead of relying on a specific order of events (device being
      unregistered vs. VLAN filter being updated), simply make sure that the
      driver performs the necessary cleanup when the VLAN device is unlinked,
      which always happens before the other two events.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e149113a