Skip to content
  1. Feb 18, 2020
    • Ido Schimmel's avatar
      mlxsw: spectrum: Reduce dependency between bridge and router code · da1f9f8c
      Ido Schimmel authored
      
      
      Commit f40be47a ("mlxsw: spectrum_router: Do not force specific
      configuration order") added a call from the routing code to the bridge
      code in order to handle the case where VNI should be set on a FID
      following the joining of the router port to the FID.
      
      This is no longer required, as previous patches made VXLAN devices
      explicitly take a reference on the FID and set VNI on it.
      
      Therefore, remove the unnecessary call and simply have the RIF take a
      reference on the FID without checking if VNI should also be set on it.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      da1f9f8c
    • Ido Schimmel's avatar
      mlxsw: spectrum_switchdev: Remove VXLAN checks during FID membership · 578e5512
      Ido Schimmel authored
      
      
      As explained in previous patch, VXLAN devices now take a reference on
      the FID and not only local ports. Therefore, there is no need for local
      ports to check if they need to set a VNI on the FID when they join the
      FID.
      
      Remove these unnecessary checks.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      578e5512
    • Ido Schimmel's avatar
      mlxsw: spectrum_switchdev: Have VXLAN device take reference on FID · 71afb45a
      Ido Schimmel authored
      
      
      Up until now only local ports and the router port (which is also a local
      port) took a reference on the corresponding FID (Filtering Identifier)
      when joining a bridge. For example:
      
              192.0.2.1/24
                  br0
                   |
            +------+------+
            |             |
           swp1        vxlan0
      
      In this case the reference count of the FID will be '2'. Since the VXLAN
      device does not take a reference on the FID, whenever a local port joins
      the bridge it needs to check if a VXLAN device is already enslaved. If
      the VXLAN device should be mapped to the FID in question, then the VXLAN
      device's VNI is set on the FID.
      
      Beside the fact that this scheme special-cases the VXLAN device, it also
      creates an unnecessary dependency between the routing and bridge code:
      
      1. [R] IP address is added on 'br0', which prompts the creation of a RIF
         and a backing FID
      2. [B] VNI is enabled on backing FID
      3. [R] Host route corresponding to VXLAN device's source address is
         promoted to perform NVE decapsulation
      
      [R] - Routing code
      [B] - Bridge code
      
      This back and forth dependency will become problematic when a lock is
      added in the routing code instead of relying on RTNL, as it will result
      in an AA deadlock.
      
      Instead, have the VXLAN device take a reference on the FID just like all
      the other netdev members of the bridge. In order to correctly handle the
      case where VXLAN devices are already enslaved to the bridge when it is
      offloaded, walk the bridge's slaves and replay the configuration.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Reviewed-by: default avatarPetr Machata <petrm@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71afb45a
    • Ido Schimmel's avatar
      mlxsw: spectrum_switchdev: Propagate extack to bridge creation function · 23a1a0b3
      Ido Schimmel authored
      
      
      Propagate extack to bridge creation function so that error messages
      could be passed to user space via netlink instead of printing them to
      kernel log.
      
      A subsequent patch will pass the new extack argument to more functions.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      23a1a0b3
    • Ido Schimmel's avatar
      mlxsw: spectrum_fid: Use 'refcount_t' for FID reference counting · b96f5469
      Ido Schimmel authored
      
      
      'refcount_t' is very useful for catching over/under flows. Convert the
      FID (Filtering Identifier) objects to use it instead of 'unsigned int'
      for their reference count.
      
      A subsequent patch in the series will change the way VXLAN devices hold
      / release the FID reference, which is why the conversion is made now.
      
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b96f5469
    • Julian Wiedmann's avatar
      net: bridge: teach ndo_dflt_bridge_getlink() more brport flags · 583cb0b4
      Julian Wiedmann authored
      
      
      This enables ndo_dflt_bridge_getlink() to report a bridge port's
      offload settings for multicast and broadcast flooding.
      
      CC: Roopa Prabhu <roopa@cumulusnetworks.com>
      CC: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      583cb0b4
    • David S. Miller's avatar
      Merge branch 'sfc-couple-more-ARFS-tidy-ups' · 5f1475b1
      David S. Miller authored
      
      
      Edward Cree says:
      
      ====================
      couple more ARFS tidy-ups
      
      Tie up some loose ends from the recent ARFS work.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5f1475b1
    • Edward Cree's avatar
      sfc: move some ARFS code out of headers · 025c5a0b
      Edward Cree authored
      
      
      efx_filter_rfs_expire() is a work-function, so it being inline makes no
       sense.  It's only ever used in efx_channels.c, so move it there.
      While we're at it, clean out some related unused cruft.
      
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      025c5a0b
    • Edward Cree's avatar
      sfc: only schedule asynchronous filter work if needed · b7683155
      Edward Cree authored
      
      
      Prevent excessive CPU time spent running a workitem with nothing to do.
      
      We avoid any races by keeping the same check in efx_filter_rfs_expire().
      
      Suggested-by: default avatarMartin Habets <mhabets@solarflare.com>
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b7683155
    • Julian Wiedmann's avatar
      net: vlan: suppress "failed to kill vid" warnings · bd706ff8
      Julian Wiedmann authored
      
      
      When a real dev unregisters, vlan_device_event() also unregisters all
      of its vlan interfaces. For each VID this ends up in __vlan_vid_del(),
      which attempts to remove the VID from the real dev's VLAN filter.
      
      But the unregistering real dev might no longer be able to issue the
      required IOs, and return an error. Subsequently we raise a noisy warning
      msg that is not appropriate for this situation: the real dev is being
      torn down anyway, there shouldn't be any worry about cleanly releasing
      all of its HW-internal resources.
      
      So to avoid scaring innocent users, suppress this warning when the
      failed deletion happens on an unregistering device.
      While at it also convert the raw pr_warn() to a more fitting
      netdev_warn().
      
      Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bd706ff8
    • Andy Shevchenko's avatar
      net: stmmac: Get rid of custom STMMAC_DEVICE() macro · 3e07df43
      Andy Shevchenko authored
      
      
      Since PCI core provides a generic PCI_DEVICE_DATA() macro,
      replace STMMAC_DEVICE() with former one.
      
      No functional change intended.
      
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3e07df43
    • David S. Miller's avatar
      Merge branch 'Remove-rtnl-lock-dependency-from-flow_action-infra' · b5d30812
      David S. Miller authored
      Vlad Buslov says:
      
      ====================
      Remove rtnl lock dependency from flow_action infra
      
      Currently, TC flow_action infrastructure code obtain rtnl lock before
      accessing action state in tc_setup_flow_action() function and releases
      it afterwards. This behavior is not supposed to impact TC filter
      insertion rate because filling flow_action representation is only a
      small part of creating new filter and expensive operations (hardware
      offload callbacks, classifiers, cls API code that creates chains and
      classifiers instances) already support unlocked execution. However,
      typical vswitch implementation might need to also dump TC filters
      concurrently, for example to age out unused flows or update flow
      counters. TC dump is fully serialized and holds rtnl lock during its
      whole execution in kernel space. As such, it can significantly impact
      concurrent tasks that try to intermittently obtain rtnl lock when
      filling intermediate representation for new filter offload (performance
      evaluation at the end of this mail).
      
      Refactor flow_action cls API infrastructure and its dependencies to not
      rely on rtnl lock for synchronization. Patch set overview:
      
      - Refactor tc_setup_flow_action() to obtain action tcf_lock when
        accessing action state. Fix its dependencies to not obtain tcf_lock
        themselves and assume that caller already holds it (needs to be done
        in same patch to prevent deadlock) and not to call sleeping functions
        (needs to be done in same patch to prevent "sleeping while atomic"
        dmesg warnings).
      
      - Refactor action helper functions to require tcf_lock instead of rtnl.
        Internally, all of the actions already use tcf_lock for
        synchronization to accommodate unlocked classifier API, so this change
        relies on already existing functionality.
      
      - Remove rtnl lock and "rtnl_held" argument from tc_setup_flow_action()
        function.
      
      To test the change, multiple concurrent TC instances are invoked with
      following command:
      
      time ls add* | xargs -n 1 -P 100 sudo tc -b
      
      Ten batch files with following typical rules (100k each) are used:
      
      filter add dev ens1f0_0 protocol ip ingress prio 1 handle 1 flower
      	src_mac e4:11:0:0:0:0 dst_mac e4:12:0:0:0:0 src_ip 192.168.111.1
      	dst_ip 192.168.111.2 ip_proto udp dst_port 1 src_port 1 action
      	tunnel_key set id 1 src_ip 2.2.2.2 dst_ip 2.2.2.3 dst_port 4789
      	no_percpu action mirred egress redirect dev vxlan1 no_percpu
      
      TC dump of same device is called in infinite loop from five concurrent
      instances:
      
      while true do tc -s filter show dev $NIC ingress >/dev/null done
      
      Results obtained on current net-next commit 9f68e365 ("Merge tag
      'drm-next-2020-01-30' of git://anongit.freedesktop.org/drm/drm"
      
      ):
      
                     | net-next | this change
      ---------------+----------+-------------
       TC add        | 6.3s     | 6.3s
       TC add + dump | 29.3s    | 6.8s
      
      Test results confirm significant impact of concurrent TC dump. The
      impact is almost fully mitigated by proposed change (differences can be
      attributed to contention for chain and tp locks between add and dump TC
      instances).
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b5d30812
    • Vlad Buslov's avatar
      net: sched: don't take rtnl lock during flow_action setup · b15e7a6e
      Vlad Buslov authored
      
      
      Refactor tc_setup_flow_action() function not to use rtnl lock and remove
      'rtnl_held' argument that is no longer needed.
      
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b15e7a6e
    • Vlad Buslov's avatar
      net: sched: refactor ct action helpers to require tcf_lock · 107f2d50
      Vlad Buslov authored
      
      
      In order to remove rtnl lock dependency from flow_action representation
      translator, change rtnl_dereference() to rcu_dereference_protected() in ct
      action helpers that provide external access to zone and action values. This
      is safe to do because the functions are not called from anywhere else
      outside flow_action infrastructure which was modified to obtain tcf_lock
      when accessing action data in one of previous patches in the series.
      
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      107f2d50
    • Vlad Buslov's avatar
      net: sched: refactor police action helpers to require tcf_lock · 487e9589
      Vlad Buslov authored
      
      
      In order to remove rtnl lock dependency from flow_action representation
      translator, change rcu_dereference_bh_rtnl() to rcu_dereference_protected()
      in police action helpers that provide external access to rate and burst
      values. This is safe to do because the functions are not called from
      anywhere else outside flow_action infrastructure which was modified to
      obtain tcf_lock when accessing action data in one of previous patches in
      the series.
      
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      487e9589
    • Vlad Buslov's avatar
      net: sched: lock action when translating it to flow_action infra · 7a472814
      Vlad Buslov authored
      
      
      In order to remove dependency on rtnl lock, take action's tcfa_lock when
      constructing its representation as flow_action_entry structure.
      
      Refactor tcf_sample_get_group() to assume that caller holds tcf_lock and
      don't take it manually. This callback is only called from flow_action infra
      representation translator which now calls it with tcf_lock held, so this
      refactoring is necessary to prevent deadlock.
      
      Allocate memory with GFP_ATOMIC flag for ip_tunnel_info copy because
      tcf_tunnel_info_copy() is only called from flow_action representation infra
      code with tcf_lock spinlock taken.
      
      Signed-off-by: default avatarVlad Buslov <vladbu@mellanox.com>
      Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7a472814
  2. Feb 17, 2020