1. 28 3月, 2020 3 次提交
    • I
      mlxsw: spectrum_router: Avoid uninitialized symbol errors · a84acf78
      Ido Schimmel 提交于
      Suppress the following smatch errors. None of these are actually
      possible with current code paths.
      
      drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1220
      mlxsw_sp_ipip_entry_find_decap() error: uninitialized symbol 'saddrp'.
      drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1220
      mlxsw_sp_ipip_entry_find_decap() error: uninitialized symbol
      'saddr_len'.
      drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1221
      mlxsw_sp_ipip_entry_find_decap() error: uninitialized symbol
      'saddr_prefix_len'.
      
      drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:1390
      mlxsw_sp_netdevice_ipip_ol_reg_event() error: uninitialized symbol
      'ipipt'.
      
      drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c:3255
      mlxsw_sp_nexthop_group_update() error: uninitialized symbol 'err'.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a84acf78
    • I
      mlxsw: spectrum: Remove unused RIF and FID families · bdb373cf
      Ido Schimmel 提交于
      In merge commit 50853808 ("Merge branch
      'mlxsw-Prepare-for-VLAN-aware-bridge-w-VxLAN'") I flipped mlxsw to use
      emulated 802.1Q FIDs and correspondingly emulated VLAN RIFs. This means
      that the non-emulated variants are no longer used. Remove them and
      suppress the following warnings when compiling with W=1:
      
      drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:7572:38: warning:
      ‘mlxsw_sp_rif_vlan_ops’ defined but not used [-Wunused-const-variable=]
      
      drivers/net/ethernet/mellanox/mlxsw//spectrum_fid.c:584:41: warning:
      ‘mlxsw_sp_fid_8021q_family’ defined but not used
      [-Wunused-const-variable=]
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      bdb373cf
    • I
      mlxsw: spectrum_router: Add proper function documentation · f0a66984
      Ido Schimmel 提交于
      Suppress following warnings when compiling with W=1:
      
      drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1552: warning:
      Function parameter or member 'mlxsw_sp' not described in
      '__mlxsw_sp_ipip_entry_update_tunnel'
      drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1552: warning:
      Function parameter or member 'ipip_entry' not described in
      '__mlxsw_sp_ipip_entry_update_tunnel'
      drivers/net/ethernet/mellanox/mlxsw//spectrum_router.c:1552: warning:
      Function parameter or member 'extack' not described in
      '__mlxsw_sp_ipip_entry_update_tunnel'
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Reviewed-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f0a66984
  2. 23 2月, 2020 8 次提交
  3. 21 2月, 2020 7 次提交
  4. 18 2月, 2020 1 次提交
  5. 08 2月, 2020 2 次提交
  6. 19 1月, 2020 1 次提交
  7. 15 1月, 2020 2 次提交
    • I
      mlxsw: spectrum_router: Set hardware flags for routes · ee5a0448
      Ido Schimmel 提交于
      Previous patches added support for two hardware flags for IPv4 and IPv6
      routes: 'RTM_F_OFFLOAD' and 'RTM_F_TRAP'. Both indicate the presence of
      the route in hardware. The first indicates that traffic is actually
      offloaded from the kernel, whereas the second indicates that packets
      hitting such routes are trapped to the kernel for processing (e.g., host
      routes).
      
      Use these two flags in mlxsw. The flags are modified in two places.
      Firstly, whenever a route is updated in the device's table. This
      includes the addition, deletion or update of a route. For example, when
      a host route is promoted to perform NVE decapsulation, its action in the
      device is updated, the 'RTM_F_OFFLOAD' flag set and the 'RTM_F_TRAP'
      flag cleared.
      
      Secondly, when a route is replaced and overwritten by another route, its
      flags are cleared.
      
      v2:
      * Convert to new fib_alias_hw_flags_set() interface
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ee5a0448
    • I
      mlxsw: spectrum_router: Separate nexthop offload indication from route · 8c5a5b9b
      Ido Schimmel 提交于
      The driver currently uses the 'RTNH_F_OFFLOAD' flag for both routes and
      nexthops, which is cumbersome and unnecessary now that we have separate
      flag for the route itself.
      
      Separate the offload indication for nexthops from routes and call it
      whenever the offload state within the nexthop group changes.
      
      Note that IPv6 (unlike IPv4) does not share the same nexthop group
      between different routes, whereas mlxsw does. Therefore, whenever the
      offload indication within an IPv6 nexthop group changes, all the linked
      routes need to be updated.
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8c5a5b9b
  8. 30 12月, 2019 1 次提交
    • A
      mlxsw: spectrum_router: Skip loopback RIFs during MAC validation · 314bd842
      Amit Cohen 提交于
      When a router interface (RIF) is created the MAC address of the backing
      netdev is verified to have the same MSBs as existing RIFs. This is
      required in order to avoid changing existing RIF MAC addresses that all
      share the same MSBs.
      
      Loopback RIFs are special in this regard as they do not have a MAC
      address, given they are only used to loop packets from the overlay to
      the underlay.
      
      Without this change, an error is returned when trying to create a RIF
      after the creation of a GRE tunnel that is represented by a loopback
      RIF. 'rif->dev->dev_addr' points to the GRE device's local IP, which
      does not share the same MSBs as physical interfaces. Adding an IP
      address to any physical interface results in:
      
      Error: mlxsw_spectrum: All router interface MAC addresses must have the
      same prefix.
      
      Fix this by skipping loopback RIFs during MAC validation.
      
      Fixes: 74bc9939 ("mlxsw: spectrum_router: Veto unsupported RIF MAC addresses")
      Signed-off-by: NAmit Cohen <amitc@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      314bd842
  9. 27 12月, 2019 5 次提交
  10. 25 12月, 2019 2 次提交
  11. 17 12月, 2019 2 次提交
  12. 10 12月, 2019 1 次提交
  13. 25 11月, 2019 2 次提交
  14. 19 11月, 2019 1 次提交
    • P
      mlxsw: spectrum_router: Fix determining underlay for a GRE tunnel · 1fc16577
      Petr Machata 提交于
      The helper mlxsw_sp_ipip_dev_ul_tb_id() determines the underlay VRF of a
      GRE tunnel. For a tunnel without a bound device, it uses the same VRF that
      the tunnel is in. However in Linux, a GRE tunnel without a bound device
      uses the main VRF as the underlay. Fix the function accordingly.
      
      mlxsw further assumed that moving a tunnel to a different VRF could cause
      conflict in local tunnel endpoint address, which cannot be offloaded.
      However, the only way that an underlay could be changed by moving the
      tunnel device itself is if the tunnel device does not have a bound device.
      But in that case the underlay is always the main VRF, so there is no
      opportunity to introduce a conflict by moving such device. Thus this check
      constitutes a dead code, and can be removed, which do.
      
      Fixes: 6ddb7426 ("mlxsw: spectrum_router: Introduce loopback RIFs")
      Signed-off-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1fc16577
  15. 16 11月, 2019 1 次提交
    • I
      mlxsw: spectrum_router: Allocate discard adjacency entry when needed · 983db619
      Ido Schimmel 提交于
      Commit 0c3cbbf9 ("mlxsw: Add specific trap for packets routed via
      invalid nexthops") allocated an adjacency entry during driver
      initialization whose purpose is to discard packets hitting the route
      pointing to it.
      
      These adjacency entries are allocated from a resource called KVD linear
      (KVDL). There are situations in which the user can decide to set the
      size of this resource (via devlink-resource) to 0, in which case the
      driver will not be able to load.
      
      Therefore, instead of pre-allocating this adjacency entry, simply
      allocate it only when needed. A variable indicating the validity of the
      entry is added and is used to ensure it is only allocated and written
      once and that it is freed after all the routes were flushed.
      
      Fixes: 0c3cbbf9 ("mlxsw: Add specific trap for packets routed via invalid nexthops")
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      983db619
  16. 08 11月, 2019 1 次提交
    • A
      mlxsw: Add specific trap for packets routed via invalid nexthops · 0c3cbbf9
      Amit Cohen 提交于
      Currently, mlxsw does not differentiate between these two cases of
      routes with invalid nexthops:
      
      1. Nexthops whose nexthop device is a mlxsw upper (has a RIF), but whose
      neighbour could not be resolved
      
      2. Nexthops whose nexthop device is not a mlxsw upper (e.g., management
      interface)
      
      Up until now this did not matter and mlxsw trapped packets for both
      cases using the same trap ID. However, packets that should have been
      routed in hardware (case 1), but incurred a problem are considered
      exceptions and should be reported to the user. The two cases should
      therefore be split between two different trap IDs.
      
      Allocate a new adjacency entry during initialization and upon the
      insertion of the first route with an invalid mlxsw nexthop, program this
      entry to discard packets. Packets hitting this entry will be reported
      using new trap ID - "DISCARD_ROUTER3".
      
      In the future, the entry could be written during initialization, but
      currently firmware requires a valid RIF, which is not available at this
      stage.
      Signed-off-by: NAmit Cohen <amitc@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0c3cbbf9