1. 02 3月, 2017 1 次提交
  2. 11 2月, 2017 3 次提交
    • I
      mlxsw: spectrum_router: Add support for route replace · 599cf8f9
      Ido Schimmel 提交于
      Upon the reception of an ENTRY_REPLACE notification, resolve the FIB
      node corresponding to the prefix and length and insert the new route
      before the first matching entry.
      
      Since the notification also signals the deletion of the replaced route,
      delete it from the driver's cache.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      599cf8f9
    • I
      mlxsw: spectrum_router: Add support for route append · 4283bce5
      Ido Schimmel 提交于
      When a new route is appended, it's placed after existing routes sharing
      the same parameters (prefix, length, table ID, TOS and priority).
      
      While the device supports only one route with the same prefix and length
      in a single table, it's important to correctly place the appended route
      in the driver's cache, as when a route is deleted the next one is
      programmed into the device.
      
      Following the reception of an ENTRY_APPEND notification, resolve the
      FIB node corresponding to the prefix and length and correctly place the
      new entry in its entry list.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4283bce5
    • I
      mlxsw: spectrum_router: Correctly handle identical routes · 9aecce1c
      Ido Schimmel 提交于
      In the device, routes are indexed in a routing table based on the prefix
      and its length. This is in contrast to the kernel's FIB where several
      FIB aliases can exist with these parameters being identical. In such
      cases, the routes will be sorted by table ID (LOCAL first, then MAIN),
      TOS and finally priority (metric).
      
      During lookup, these routes will be evaluated in order. In case the
      packet's TOS field is non-zero and a FIB alias with a matching TOS is
      found, then it's selected. Otherwise, the lookup defaults to the route
      with TOS 0 (if it exists). However, if the requested scope is narrower
      than the one found, then the lookup continues.
      
      To best reflect the kernel's datapath we should take the above into
      account. Given a prefix and its length, the reflected route will always
      be the first one in the FIB alias list. However, if the route has a
      non-zero TOS then its action will be converted to trap instead of
      forward, since we currently don't support TOS-based routing. If this
      turns out to be a real issue, we can add support for that using
      policy-based switching.
      
      The route's scope can be effectively ignored as any packet being routed
      by the device would've been looked-up using the widest scope (UNIVERSE).
      
      To achieve that we need to do two changes. Firstly, we need to create
      another struct (FIB node) that will hold the list of FIB entries sharing
      the same prefix and length. This struct will be hashed using these two
      parameters.
      
      Secondly, we need to change the route reflection to match the above
      logic, so that the first FIB entry in the list will be programmed into
      the device while the rest will remain in the driver's cache in case of
      subsequent changes.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      9aecce1c
  3. 09 2月, 2017 14 次提交
  4. 07 2月, 2017 7 次提交
  5. 25 1月, 2017 1 次提交
  6. 24 12月, 2016 2 次提交
  7. 04 12月, 2016 2 次提交
    • I
      ipv4: fib: Replay events when registering FIB notifier · c3852ef7
      Ido Schimmel 提交于
      Commit b90eb754 ("fib: introduce FIB notification infrastructure")
      introduced a new notification chain to notify listeners (f.e., switchdev
      drivers) about addition and deletion of routes.
      
      However, upon registration to the chain the FIB tables can already be
      populated, which means potential listeners will have an incomplete view
      of the tables.
      
      Solve that by dumping the FIB tables and replaying the events to the
      passed notification block. The dump itself is done using RCU in order
      not to starve consumers that need RTNL to make progress.
      
      The integrity of the dump is ensured by reading the FIB change sequence
      counter before and after the dump under RTNL. This allows us to avoid
      the problematic situation in which the dumping process sends a ENTRY_ADD
      notification following ENTRY_DEL generated by another process holding
      RTNL.
      
      Callers of the registration function may pass a callback that is
      executed in case the dump was inconsistent with current FIB tables.
      
      The number of retries until a consistent dump is achieved is set to a
      fixed number to prevent callers from looping for long periods of time.
      In case current limit proves to be problematic in the future, it can be
      easily converted to be configurable using a sysctl.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c3852ef7
    • I
      mlxsw: spectrum_router: Implement FIB offload in deferred work · 3057224e
      Ido Schimmel 提交于
      FIB offload is currently done in process context with RTNL held, but
      we're about to dump the FIB tables in RCU critical section, so we can no
      longer sleep.
      
      Instead, defer the operation to process context using deferred work. Make
      sure fib info isn't freed while the work is queued by taking a reference
      on it and releasing it after the operation is done.
      
      Deferring the operation is valid because the upper layers always assume
      the operation was successful. If it's not, then the driver-specific
      abort mechanism is called and all routed traffic is directed to slow
      path.
      
      The work items are submitted to an ordered workqueue to prevent a
      mismatch between the kernel's FIB table and the device's.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3057224e
  8. 17 11月, 2016 1 次提交
  9. 15 11月, 2016 1 次提交
    • I
      mlxsw: spectrum_router: Flush FIB tables during fini · ac571de9
      Ido Schimmel 提交于
      Since commit b45f64d1 ("mlxsw: spectrum_router: Use FIB notifications
      instead of switchdev calls") we reflect to the device the entire FIB
      table and not only FIBs that point to netdevs created by the driver.
      
      During module removal, FIBs of the second type are removed following
      NETDEV_UNREGISTER events sent. The other FIBs are still present in both
      the driver's cache and the device's table.
      
      Fix this by iterating over all the FIB tables in the device and flush
      them. There's no need to take locks, as we're the only writer.
      
      Fixes: b45f64d1 ("mlxsw: spectrum_router: Use FIB notifications instead of switchdev calls")
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ac571de9
  10. 14 11月, 2016 2 次提交
  11. 11 11月, 2016 2 次提交
    • J
      mlxsw: spectrum_router: Ignore FIB notification events for non-init namespaces · 0e3715c9
      Jiri Pirko 提交于
      Since now, the table with same id in multiple netnamespaces were squashed
      to a single virtual router. That is not only incorrect, it also causes
      error messages when trying to use RALUE register to do double remove
      of FIB entries, like this one:
      
      mlxsw_spectrum 0000:03:00.0: EMAD reg access failed (tid=facb831c00007b20,reg_id=8013(ralue),type=write,status=7(bad parameter))
      
      Since we don't allow ports to change namespaces (NETIF_F_NETNS_LOCAL),
      and the infrastructure is not yet prepared to handle netnamespaces, just
      ignore FIB notification events for non-init namespaces. That is clear to
      do since we don't need to offload them.
      
      Fixes: b45f64d1 ("mlxsw: spectrum_router: Use FIB notifications instead of switchdev calls")
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Acked-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0e3715c9
    • J
      mlxsw: spectrum_router: Fix handling of neighbour structure · 33b1341c
      Jiri Pirko 提交于
      __neigh_create function works in a different way than assumed.
      It passes "n" as a parameter to ndo_neigh_construct. But this "n" might
      be destroyed right away before __neigh_create() returns in case there is
      already another neighbour struct in the hashtable with the same dev and
      primary key. That is not expected by mlxsw_sp_router_neigh_construct()
      and the stored "n" points to freed memory, eventually leading to crash.
      
      Fix this by doing tight 1:1 coupling between neighbour struct and
      internal driver neigh_entry. That allows to narrow down the key in
      internal driver hashtable to do lookups by "n" only.
      
      Fixes: 6cf3c971 ("mlxsw: spectrum_router: Add private neigh table")
      Signed-off-by: NJiri Pirko <jiri@mellanox.com>
      Acked-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      33b1341c
  12. 29 10月, 2016 3 次提交
  13. 24 10月, 2016 1 次提交