1. 11 Mar, 2021 11 commits
    • Saeed Mahameed's avatar
      net/mlx5e: mlx5_tc_ct_init does not fail · 51ada5a5
      Saeed Mahameed authored
      mlx5_tc_ct_init() either returns a valid pointer or a NULL, either way
      the caller can continue, remove IS_ERR check from callers as it has no
      effect.
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      51ada5a5
    • Vlad Buslov's avatar
      net/mlx5: Fix indir stable stubs · fbeab6be
      Vlad Buslov authored
      Some of the stubs for CONFIG_MLX5_CLS_ACT==disabled are missing "static
      inline" in their definition which causes the following compilation
      warnings:
      
         In file included from drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c:41:
      >> drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.h:34:1: warning: no previous prototype for function 'mlx5_esw_indir_table_init' [-Wmissing-prototypes]
         mlx5_esw_indir_table_init(void)
         ^
         drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.h:33:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
         struct mlx5_esw_indir_table *
         ^
         static
      >> drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.h:40:1: warning: no previous prototype for function 'mlx5_esw_indir_table_destroy' [-Wmissing-prototypes]
         mlx5_esw_indir_table_destroy(struct mlx5_esw_indir_table *indir)
         ^
         drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.h:39:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
         void
         ^
         static
      >> drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.h:61:1: warning: no previous prototype for function 'mlx5_esw_indir_table_needed' [-Wmissing-prototypes]
         mlx5_esw_indir_table_needed(struct mlx5_eswitch *esw,
         ^
         drivers/net/ethernet/mellanox/mlx5/core/esw/indir_table.h:60:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
         bool
         ^
         static
         3 warnings generated.
      
      Add "static inline" prefix to signatures of stubs that were missing it.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      fbeab6be
    • Vlad Buslov's avatar
      net/mlx5e: Add missing include · 5632817b
      Vlad Buslov authored
      When CONFIG_IPV6 is disabled the header nexthop.h is not included by
      fib_notifier.h which causes tc_tun_encap.c to fail to compile:
      
         In file included from drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:5:
         In file included from drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.h:7:
         In file included from drivers/net/ethernet/mellanox/mlx5/core/en/tc_priv.h:7:
         In file included from drivers/net/ethernet/mellanox/mlx5/core/en_tc.h:40:
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h:78:5: warning: no previous prototype for function 'mlx5e_tc_tun_update_header_ipv6' [-Wmissing-prototypes]
         int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv,
             ^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.h:78:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
         int mlx5e_tc_tun_update_header_ipv6(struct mlx5e_priv *priv,
         ^
         static
      >> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1510:12: error: implicit declaration of function 'fib_info_nh' [-Werror,-Wimplicit-function-declaration]
                 fib_dev = fib_info_nh(fen_info->fi, 0)->fib_nh_dev;
                           ^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1510:12: note: did you mean 'fib_info_put'?
         include/net/ip_fib.h:528:20: note: 'fib_info_put' declared here
         static inline void fib_info_put(struct fib_info *fi)
                            ^
      >> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1510:42: error: member reference type 'int' is not a pointer
                 fib_dev = fib_info_nh(fen_info->fi, 0)->fib_nh_dev;
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
         include/net/ip_fib.h:113:21: note: expanded from macro 'fib_nh_dev'
         #define fib_nh_dev              nh_common.nhc_dev
                                         ^
      >> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1552:13: error: incomplete definition of type 'struct fib6_entry_notifier_info'
                 fen_info = container_of(info, struct fib6_entry_notifier_info, info);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         include/linux/kernel.h:694:51: note: expanded from macro 'container_of'
                 BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
         include/linux/compiler_types.h:256:74: note: expanded from macro '__same_type'
         #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
                                                                                  ^
         include/linux/build_bug.h:39:58: note: expanded from macro 'BUILD_BUG_ON_MSG'
         #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                             ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
         include/linux/compiler_types.h:320:22: note: expanded from macro 'compiletime_assert'
                 _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
                 ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         include/linux/compiler_types.h:308:23: note: expanded from macro '_compiletime_assert'
                 __compiletime_assert(condition, msg, prefix, suffix)
                 ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         include/linux/compiler_types.h:300:9: note: expanded from macro '__compiletime_assert'
                         if (!(condition))                                       \
                               ^~~~~~~~~
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1546:9: note: forward declaration of 'struct fib6_entry_notifier_info'
                 struct fib6_entry_notifier_info *fen_info;
                        ^
      >> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1552:13: error: offsetof of incomplete type 'struct fib6_entry_notifier_info'
                 fen_info = container_of(info, struct fib6_entry_notifier_info, info);
                            ^                  ~~~~~~
         include/linux/kernel.h:697:21: note: expanded from macro 'container_of'
                 ((type *)(__mptr - offsetof(type, member))); })
                                    ^        ~~~~
         include/linux/stddef.h:17:32: note: expanded from macro 'offsetof'
         #define offsetof(TYPE, MEMBER)  __compiler_offsetof(TYPE, MEMBER)
                                         ^                   ~~~~
         include/linux/compiler_types.h:140:35: note: expanded from macro '__compiler_offsetof'
         #define __compiler_offsetof(a, b)       __builtin_offsetof(a, b)
                                                 ^                  ~
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1546:9: note: forward declaration of 'struct fib6_entry_notifier_info'
                 struct fib6_entry_notifier_info *fen_info;
                        ^
      >> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1552:11: error: assigning to 'struct fib6_entry_notifier_info *' from incompatible type 'void'
                 fen_info = container_of(info, struct fib6_entry_notifier_info, info);
                          ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      >> drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1553:12: error: implicit declaration of function 'fib6_info_nh_dev' [-Werror,-Wimplicit-function-declaration]
                 fib_dev = fib6_info_nh_dev(fen_info->rt);
                           ^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1553:37: error: incomplete definition of type 'struct fib6_entry_notifier_info'
                 fib_dev = fib6_info_nh_dev(fen_info->rt);
                                            ~~~~~~~~^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1546:9: note: forward declaration of 'struct fib6_entry_notifier_info'
                 struct fib6_entry_notifier_info *fen_info;
                        ^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1555:14: error: incomplete definition of type 'struct fib6_entry_notifier_info'
                     fen_info->rt->fib6_dst.plen != 128)
                     ~~~~~~~~^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1546:9: note: forward declaration of 'struct fib6_entry_notifier_info'
                 struct fib6_entry_notifier_info *fen_info;
                        ^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1562:39: error: incomplete definition of type 'struct fib6_entry_notifier_info'
                 memcpy(&key.endpoint_ip.v6, &fen_info->rt->fib6_dst.addr,
                                              ~~~~~~~~^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1546:9: note: forward declaration of 'struct fib6_entry_notifier_info'
                 struct fib6_entry_notifier_info *fen_info;
                        ^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1563:24: error: incomplete definition of type 'struct fib6_entry_notifier_info'
                        sizeof(fen_info->rt->fib6_dst.addr));
                               ~~~~~~~~^
         drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c:1546:9: note: forward declaration of 'struct fib6_entry_notifier_info'
                 struct fib6_entry_notifier_info *fen_info;
                        ^
         1 warning and 10 errors generated.
      
      Manually include net/nexthop.h in tc_tun_encap.c.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      5632817b
    • Arnd Bergmann's avatar
      net/mlx5e: fix mlx5e_tc_tun_update_header_ipv6 dummy definition · 87f77a67
      Arnd Bergmann authored
      The alternative implementation of this function in a header file
      is declared as a global symbol, and gets added to every .c file
      that includes it, which leads to a link error:
      
      arm-linux-gnueabi-ld: drivers/net/ethernet/mellanox/mlx5/core/en_rx.o: in function `mlx5e_tc_tun_update_header_ipv6':
      en_rx.c:(.text+0x0): multiple definition of `mlx5e_tc_tun_update_header_ipv6'; drivers/net/ethernet/mellanox/mlx5/core/en_main.o:en_main.c:(.text+0x0): first defined here
      
      Mark it 'static inline' like the other functions here.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarVlad Buslov <vladbu@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      87f77a67
    • Roi Dayan's avatar
      net/mlx5e: CT, Avoid false lock dependency warning · 76e68d95
      Roi Dayan authored
      To avoid false lock dependency warning set the ct_entries_ht lock
      class different than the lock class of the ht being used when deleting
      last flow from a group and then deleting a group, we get into del_sw_flow_group()
      which call rhashtable_destroy on fg->ftes_hash which will take ht->mutex but
      it's different than the ht->mutex here.
      
      ======================================================
      WARNING: possible circular locking dependency detected
      5.10.0-rc2+ #8 Tainted: G           O
      ------------------------------------------------------
      revalidator23/24009 is trying to acquire lock:
      ffff888128d83828 (&node->lock){++++}-{3:3}, at: mlx5_del_flow_rules+0x83/0x7a0 [mlx5_core]
      
      but task is already holding lock:
      ffff8881081ef518 (&ht->mutex){+.+.}-{3:3}, at: rhashtable_free_and_destroy+0x37/0x720
      
      which lock already depends on the new lock.
      Signed-off-by: default avatarRoi Dayan <roid@nvidia.com>
      Reviewed-by: default avatarPaul Blakey <paulb@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      76e68d95
    • Leon Romanovsky's avatar
      net/mlx5: Check returned value from health recover sequence · fe06992b
      Leon Romanovsky authored
      MLX5_INTERFACE_STATE_UP is far from being reliable check for success to
      recover, because it can be changed any time and health logic doesn't
      have any locks to protect from it.
      
      The locks are not needed here because health recover is good to have,
      but not must to success, so rely on the returned value from the
      mlx5_recover_device() as a marker for success/failure.
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      fe06992b
    • Leon Romanovsky's avatar
      net/mlx5: Don't rely on interface state bit · 7ad67a20
      Leon Romanovsky authored
      The check of MLX5_INTERFACE_STATE_UP is completely useless, because
      the FW tracer cleanup is called on every change of the interface
      and it ensures that notifier is disabled together with canceling
      all the pending works.
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      7ad67a20
    • Leon Romanovsky's avatar
      net/mlx5: Remove second FW tracer check · 7e615b99
      Leon Romanovsky authored
      The FW tracer check is called twice, so delete one of them.
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      7e615b99
    • Leon Romanovsky's avatar
      net/mlx5: Separate probe vs. reload flows · 6dea2f7e
      Leon Romanovsky authored
      The mix between probe/unprobe and reload flows causes to have an extra
      mutex lock intf_state_mutex that generates LOCKDEP warning between it
      and devlink_mutex. As a preparation for the future removal, separate
      those flows.
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      6dea2f7e
    • Leon Romanovsky's avatar
      net/mlx5: Remove impossible checks of interface state · d89edb36
      Leon Romanovsky authored
      The interface state is constant at this stage and checked
      before calling to the register/unregister reserved GIDs.
      
      There is no need to double check it.
      Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      d89edb36
    • Saeed Mahameed's avatar
      net/mlx5: Don't skip vport check · 7bef147a
      Saeed Mahameed authored
      Users of mlx5_eswitch_get_vport() are required to check return value
      prior to passing mlx5_vport further. Fix all the places to do not skip
      that check.
      Reviewed-by: default avatarEli Cohen <elic@nvidia.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      7bef147a
  2. 10 Mar, 2021 29 commits
    • Bhaskar Chowdhury's avatar
      net: fddi: skfp: Mundane typo fixes throughout the file smt.h · 34bb9751
      Bhaskar Chowdhury authored
      Few spelling fixes throughout the file.
      Signed-off-by: default avatarBhaskar Chowdhury <unixbhaskar@gmail.com>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      34bb9751
    • Shubhankar Kuranagatti's avatar
      net: ipv4: route.c: fix space before tab · 6b9c8f46
      Shubhankar Kuranagatti authored
      The extra space before tab space has been removed.
      Signed-off-by: default avatarShubhankar Kuranagatti <shubhankarvk@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6b9c8f46
    • David S. Miller's avatar
      Merge branch 'ionic-next' · f2050d91
      David S. Miller authored
      Shannon Nelson says:
      
      ====================
      ionic Rx updates
      
      The ionic driver's Rx path is due for an overhaul in order to
      better use memory buffers and to clean up the data structures.
      
      The first two patches convert the driver to using page sharing
      between buffers so as to lessen the  page alloc and free overhead.
      
      The remaining patches clean up the structs and fastpath code for
      better efficency.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f2050d91
    • Shannon Nelson's avatar
      ionic: simplify use of completion types · a25edab9
      Shannon Nelson authored
      Make better use of our struct types and type checking by passing
      the actual Rx or Tx completion type rather than a generic void
      pointer type.
      Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a25edab9
    • Shannon Nelson's avatar
      ionic: rebuild debugfs on qcq swap · 55eda6bb
      Shannon Nelson authored
      With a reconfigure of each queue is needed a rebuild of
      the matching debugfs information.
      Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      55eda6bb
    • Shannon Nelson's avatar
      ionic: simplify rx skb alloc · 89e572e7
      Shannon Nelson authored
      Remove an unnecessary layer over rx skb allocation.
      Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      89e572e7
    • Shannon Nelson's avatar
      ionic: optimize fastpath struct usage · f37bc346
      Shannon Nelson authored
      Clean up a couple of struct uses to make for better fast path
      access.
      Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f37bc346
    • Shannon Nelson's avatar
      ionic: implement Rx page reuse · 4b0a7539
      Shannon Nelson authored
      Rework the Rx buffer allocations to use pages twice when using
      normal MTU in order to cut down on buffer allocation and mapping
      overhead.
      
      Instead of tracking individual pages, in which we may have
      wasted half the space when using standard 1500 MTU, we track
      buffers which use half pages, so we can use the second half
      of the page rather than allocate and map a new page once the
      first buffer has been used.
      Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4b0a7539
    • Shannon Nelson's avatar
      ionic: move rx_page_alloc and free · 2b5720f2
      Shannon Nelson authored
      Move ionic_rx_page_alloc() and ionic_rx_page_free() to earlier
      in the file to make the next patch easier to review.
      Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b5720f2
    • David S. Miller's avatar
      Merge branch 'dpaa2-switch-next' · eeada410
      David S. Miller authored
      Ioana Ciornei says:
      
      ====================
      dpaa2-switch: CPU terminated traffic and move out of staging
      
      This patch set adds support for Rx/Tx capabilities on DPAA2 switch port
      interfaces as well as fixing up some major blunders in how we take care
      of the switching domains. The last patch actually moves the driver out
      of staging now that the minimum requirements are met.
      
      I am sending this directly towards the net-next tree so that I can use
      the rest of the development cycle adding new features on top of the
      current driver without worrying about merge conflicts between the
      staging and net-next tree.
      
      The control interface is comprised of 3 queues in total: Rx, Rx error
      and Tx confirmation. In this patch set we only enable Rx and Tx conf.
      All switch ports share the same queues when frames are redirected to the
      CPU.  Information regarding the ingress switch port is passed through
      frame metadata - the flow context field of the descriptor.
      
      NAPI instances are also shared between switch net_devices and are
      enabled when at least on one of the switch ports .dev_open() was called
      and disabled when no switch port is still up.
      
      Since the last version of this feature was submitted to the list, I
      reworked how the switching and flooding domains are taken care of by the
      driver, thus the switch is now able to also add the control port (the
      queues that the CPU can dequeue from) into the flooding domains of a
      port (broadcast, unknown unicast etc). With this, we are able to receive
      and sent traffic from the switch interfaces.
      
      Also, the capability to properly partition the DPSW object into multiple
      switching domains was added so that when not under a bridge, the ports
      are not actually capable to switch between them. This is possible by
      adding a private FDB table per switch interface.  When multiple switch
      interfaces are under the same bridge, they will all use the same FDB
      table.
      
      Another thing that is fixed in this patch set is how the driver handles
      VLAN awareness. The DPAA2 switch is not capable to run as VLAN unaware
      but this was not reflected in how the driver responded to requests to
      change the VLAN awareness. In the last patch, this is fixed by
      describing the switch interfaces as Rx VLAN filtering on [fixed] and
      declining any request to join a VLAN unaware bridge.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eeada410
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: move the driver out of staging · f48298d3
      Ioana Ciornei authored
      Now that the dpaa2-switch driver has basic I/O capabilities on the
      switch port net_devices and multiple bridging domains are supported,
      move the driver out of staging.
      
      The dpaa2-switch driver is placed right next to the dpaa2-eth driver
      since, in the near future, they will be sharing most of the data path.
      I didn't implement code reuse in this patch series because I wanted to
      keep it as small as possible.
      
      Also, the README is removed from staging with the intention to add
      proper rst documentation afterwards to actually match was is supported
      by the driver.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f48298d3
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: prevent joining a bridge while VLAN uppers are present · 1c4928fc
      Ioana Ciornei authored
      Each time a switch port joins a bridge, it will start to use a FDB table
      common with all the other switch ports that are under the same bridge.
      This means that any VLAN added prior to a bridge join, will retain its
      previous FDB table destination. With this patch, I choose to restrict
      when a switch port can change it's upper device (either join or leave)
      so that the driver does not have to delete all the previously installed
      VLANs from the previous FDB and add them into the new one.
      
      Thus, in the PRECHANGEUPPER  notification we check if there are any VLAN
      type upper devices and if that's true, deny the CHANGEUPPER.
      
      This way, the user is not restricted in the topology but rather in the
      order in which the setup is done: it must first create the bridging
      domain layout and after that add the necessary VLAN devices if
      necessary. The teardown is similar, the VLAN devices will need to be
      destroyed prior to a change in the bridging layout.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1c4928fc
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: add fast-ageing on bridge leave · 685b4801
      Ioana Ciornei authored
      Upon leaving a bridge, any MAC addresses learnt on the switch port prior
      to this point have to be removed so that we preserve the bridging domain
      configuration.
      
      Restructure the dpaa2_switch_port_fdb_dump() function in order to have a
      common dpaa2_switch_fdb_iterate() function between the FDB dump callback
      and the fast age procedure. To accomplish this, add a new callback -
      dpaa2_switch_fdb_cb_t - which will be called on each MAC addr and,
      depending on the situation, will either dump the FDB entry into a
      netlink message or will delete the address from the FDB table, in case
      of the fast-age.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      685b4801
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: accept only vlan-aware upper devices · d671407f
      Ioana Ciornei authored
      The DPAA2 Switch is not capable to handle traffic in a VLAN unaware
      fashion, thus the previous handling of both the accepted upper devices
      and the SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING flag was wrong.
      
      Fix this by checking if the bridge that we are joining is indeed VLAN
      aware, if not return an error. Also, the RX VLAN filtering feature is
      defined as 'on [fixed]' and the .ndo_vlan_rx_add_vid() and
      .ndo_vlan_rx_kill_vid() callbacks are implemented just by recreating a
      switchdev_obj_port_vlan object and then calling the same functions used
      on the switchdev notifier path.
      In addition, changing the vlan_filtering flag to 0 on a bridge under
      which a DPAA2 switch interface is present is not supported, thus
      rejected when SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING is received with
      such a request.
      
      This patch is also adding the use of the switchdev_handle_port_attr_set
      function so that we can iterate through all the lower devices of the
      bridge that the notification was received on and actually catch if the
      user is trying to change the vlan_filtering state. Since on a VLAN
      filtering change the net_device is the bridge, we also move the
      dpaa2_switch_port_dev_check call so that we do not return NOTIFY_DONE
      right away.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d671407f
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: move the notifier register to module_init() · 16abb6ad
      Ioana Ciornei authored
      Move the notifier blocks register into the module_init() step, instead of
      object probe, so that all DPSW devices probed by the dpaa2-switch driver
      can use the same notifiers.
      
      This will enable us to have a more straightforward approach in
      determining if an event is intended for an object managed by this driver
      or not. Previously, the dpaa2_switch_port_dev_check() function was
      forced to also check the notifier block beside the net_device_ops
      structure to determine if the event is for us or not.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      16abb6ad
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: properly setup switching domains · 539dda3c
      Ioana Ciornei authored
      Until now, the DPAA2 switch was not capable to properly setup its
      switching domains depending on the existence, or lack thereof, of a
      upper bridge device. This meant that all switch ports of a DPSW object
      were switching by default even though they were not under the same
      bridge device.
      
      Another issue was the inability to actually add the CPU in the flooding
      domains (broadcast, unknown unicast etc) of a particular switch port.
      This meant that a simple ping on a switch interface was not possible
      since no broadcast ARP frame would actually reach the CPU queues.
      
      This patch tries to fix exactly these problems by:
      
      * Creating and managing a FDB table for each flooding domain. This means
        that when a switch interface is not bridged it will use its own FDB
        table. While in bridged mode all DPAA2 switch interfaces under the
        same upper will use the same FDB table, thus leverage the same FDB
        entries.
      
      * Adding a new MC firmware command - dpsw_set_egress_flood() - through
        which the driver can setup the flooding domains as needed. For
        example, when the switch interface is standalone, thus not in a
        bridge with any other DPAA2 switch port, it will setup its broadcast
        and unknown unicast flooding domains to only include the control
        interface (the queues that reach the CPU and the driver can dequeue
        from). This flooding domain changes when the interface joins a bridge
        and is configured to include, beside the control interface, all other
        DPAA2 switch interfaces.
      
      We impose a minimum limit of FDB tables available equal to the number of
      switch interfaces so that we guarantee that, in the maximal
      configuration - all interfaces are standalone, each switch port will
      have a private FDB table. At the same time, we only probe DPSW objects
      that have the flooding and broadcast replicators configured to be per
      FDB (DPSW_*_PER_FDB). Without this, the dpaa2-switch driver would not
      be able to configure multiple switching domains.
      
      At probe time, a FDB table will be allocated for each port. At a bridge
      join event, the switch port will either continue to use the current FDB
      table (if it's the first dpaa2-switch port to join that bridge) or will
      switch to use the FDB table associated with the port that it's already
      under the bridge. If a FDB switch is necessary, the private FDB table
      which was previously used will be returned to the pool of unused FDBs.
      
      Upon a bridge leave, the switch port needs a private FDB table thus it
      will search and get the first unused FDB table. This way, all the other
      ports remaining under the bridge will continue to use the same FDB
      table.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      539dda3c
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: enable the control interface · 613c0a58
      Ioana Ciornei authored
      Enable the CTRL_IF of the switch object, now that all the pieces are in
      place (buffer and queue management, interrupts, NAPI instances etc).
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      613c0a58
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: add .ndo_start_xmit() callback · 7fd94d86
      Ioana Ciornei authored
      Implement the .ndo_start_xmit() callback for the switch port interfaces.
      For each of the switch ports, gather the corresponding queue
      destination ID (QDID) necessary for Tx enqueueing.
      
      We'll reserve 64 bytes for software annotations, where we keep a skb
      backpointer used on the Tx confirmation side for releasing the allocated
      memory. At the moment, we only support linear skbs.
      
      Also, add support for the Tx confirmation path which for the most part
      shares the code path with the normal Rx queue.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7fd94d86
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: handle Rx path on control interface · 0b1b7137
      Ioana Ciornei authored
      The dpaa2-ethsw supports only one Rx queue that is shared by all switch
      ports. This means that information about which port was the ingress port
      for a specific frame needs to be passed in metadata. In our case, the
      Flow Context (FLC) field from the frame descriptor holds this
      information. Besides the interface ID of the ingress port we also
      receive the virtual QDID of the port. Below is a visual description of
      the 64 bits of FLC.
      
      63           47           31           15           0
      +---------------------------------------------------+
      |            |            |            |            |
      |  RESERVED  |    IF_ID   |  RESERVED  |  IF QDID   |
      |            |            |            |            |
      +---------------------------------------------------+
      
      Because all switch ports share the same Rx and Tx conf queues, NAPI
      management takes into consideration when there is at least one switch
      interface open to enable the NAPI instance.
      
      The Rx path is common, for the most part, for both Rx and Tx conf with
      the mention that each of them has its own consume function of a frame
      descriptor. Dequeueing from a FQ, consuming dequeued store and also the
      NAPI poll function is common between both queues.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0b1b7137
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: setup dpio · 04abc97d
      Ioana Ciornei authored
      Setup interrupts on the control interface queues. We do not force an
      exact affinity between the interrupts received from a specific queue and
      a cpu.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      04abc97d
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: setup buffer pool and RX path rings · 2877e4f7
      Ioana Ciornei authored
      Allocate and setup a buffer pool, needed on the Rx path of the control
      interface. Also, define the Rx buffer size seen by the WRIOP from the
      PAGE_SIZE buffers seeded.
      
      Also, create the needed Rx rings for both frame queues used on the
      control interface.  On the Rx path, when a pull-dequeue operation is
      performed on a software portal, available frame descriptors are put in a
      ring - a DMA memory storage - for further usage.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2877e4f7
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: get control interface attributes · 26d419f3
      Ioana Ciornei authored
      Introduce a new structure to hold all necessary info related to an RX
      queue for the control interface and populate the FQ IDs.
      We only have one Rx queue and one Tx confirmation queue on the control
      interface, both shared by all the switch ports.
      
      Also, increase the minimum version of the object supported by the driver
      since for a basic switch driver support we'll be in need for some ABIs
      added in the latest version of firmware.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      26d419f3
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: remove obsolete .ndo_fdb_{add|del} callbacks · 5dda9a79
      Ioana Ciornei authored
      Since the dpaa2-switch already listens for SWITCHDEV_FDB_ADD_TO_DEVICE /
      SWITCHDEV_FDB_DEL_TO_DEVICE events emitted by the bridge, we don't need
      the bridge bypass operations, and now is a good time to delete them. All
      'bridge fdb' commands need the 'master' flag specified now.
      
      In fact, having the obsolete .ndo_fdb_{add|del} callbacks would even
      complicate the bridge leave/join procedures without any real benefit.
      Every FDB entry is installed in an FDB ID as far as the hardware is
      concerned, and the dpaa2-switch ports change their FDB ID when they join
      or leave a bridge. So we would need to manually delete these FDB entries
      when the FDB ID changes. That's because, unlike FDB entries added
      through switchdev, where the bridge automatically deletes those on
      leave, there isn't anybody who will remove the static FDB entries
      installed via the bridge bypass operations upon a change in the upper
      device.
      
      Note that we still need .ndo_fdb_dump though. The dpaa2-switch does not
      emit any interrupts when a new address is learnt, so we cannot keep the
      bridge FDB in sync with the hardware FDB. Therefore, we need this
      callback to get a chance to print the FDB entries that were dynamically
      learnt by our hardware.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5dda9a79
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: fix up initial forwarding configuration done by firmware · 282d47de
      Ioana Ciornei authored
      By default, the DPSW object is configured with VLAN ID 1 in the VLAN
      table, which all ports are member of. This entry in the VLAN table
      selects the same FDB ID for all ports, meaning that forwarding between
      ports is permitted. This is unlike the switchdev model, where each port
      should operate as standalone by default.
      
      To make the switch operate in standalone ports mode, we need the VLAN
      table to select a unique FDB ID for each port. In order to do that, we
      need to simply delete the VLAN 1 created automatically by firmware, and
      let dpaa2_switch_port_init take over, by readding VLAN ID 1, but
      pointing towards a unique FDB ID.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      282d47de
    • Ioana Ciornei's avatar
      staging: dpaa2-switch: remove broken learning and flooding support · 93a4d0ab
      Ioana Ciornei authored
      This patch is removing the current configuration of learning and
      flooding states per switch port because they are essentially broken in
      terms of integration with the switchdev APIs and the bridge
      understanding of these states.
      
      First of all, the learning state is a per switch port configuration
      while the dpaa2-switch driver was using it to configure the entire
      bridging domain. This is broken since the software learning state could
      be out of sync with the hardware state when ports from the same bridging
      domain are configured by the user with different learning parameters.
      
      The BR_FLOOD flag has been misinterpreted as well. Instead of denoting
      whether unicast traffic for which there is no FDB entry will be flooded
      towards a given port, the dpaa2-switch used the flag to configure
      whether or not a frame with an unknown destination received on a given
      port should be flooded or not. In summary, it was used as ingress
      setting instead of a egress one.
      
      Also, remove the unnecessary call to dpsw_if_set_broadcast() and the API
      definition. The HW default is to let all switch ports to be able to
      flood broadcast traffic thus there is no need to call the API again.
      
      Instead of trying to patch things up, just remove the support for the
      moment so that we'll add it back cleanly once the driver is out of
      staging.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      93a4d0ab
    • David S. Miller's avatar
      Merge branch 'enetc-cleanups' · 157611c8
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Refactoring/cleanup for NXP ENETC
      
      This series performs the following:
      - makes the API for Control Buffer Descriptor Rings in enetc_cbdr.c a
        bit more tightly knit.
      - moves more logic into enetc_rxbd_next to make the callers simpler
      - moves more logic into enetc_refill_rx_ring to make the callers simpler
      - removes forward declarations
      - simplifies the probe path to unify probing for used and unused PFs.
      
      Nothing radical.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      157611c8
    • Vladimir Oltean's avatar
      net: enetc: make enetc_refill_rx_ring update the consumer index · 7a5222cb
      Vladimir Oltean authored
      Since commit fd5736bf ("enetc: Workaround for MDIO register access
      issue"), enetc_refill_rx_ring no longer updates the RX BD ring's
      consumer index, that is left to be done by the caller. This has led to
      bugs such as the ones found in 96a5223b ("net: enetc: remove bogus
      write to SIRXIDR from enetc_setup_rxbdr") and 3a5d12c9 ("net: enetc:
      keep RX ring consumer index in sync with hardware"), so it is desirable
      that we move back the update of the consumer index into enetc_refill_rx_ring.
      
      The trouble with that is the different MDIO locking context for the two
      callers of enetc_refill_rx_ring:
      
      - enetc_clean_rx_ring runs under enetc_lock_mdio()
      - enetc_setup_rxbdr runs outside enetc_lock_mdio()
      
      Simplify the callers of enetc_refill_rx_ring by making enetc_setup_rxbdr
      explicitly take enetc_lock_mdio() around the call. It will be the only
      place in need of ensuring the hot accessors can be used.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7a5222cb
    • Vladimir Oltean's avatar
      net: enetc: remove forward declaration for enetc_map_tx_buffs · 0486185e
      Vladimir Oltean authored
      There is no other reason why this forward declaration exists rather than
      poor ordering of the functions.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0486185e
    • Vladimir Oltean's avatar
      net: enetc: remove forward-declarations of enetc_clean_{rx,tx}_ring · 8580b3c3
      Vladimir Oltean authored
      This patch moves the NAPI enetc_poll after enetc_clean_rx_ring such that
      we can delete the forward declarations.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8580b3c3