1. 11 Mar, 2021 2 commits
  2. 10 Mar, 2021 38 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
    • Vladimir Oltean's avatar
      net: enetc: use enum enetc_active_offloads · 7f071a45
      Vladimir Oltean authored
      The active_offloads variable of enetc_ndev_priv has an enum type, use it.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7f071a45
    • Vladimir Oltean's avatar
      net: enetc: simplify callers of enetc_rxbd_next · c027aa92
      Vladimir Oltean authored
      When we iterate through the BDs in the RX ring, the software producer
      index (which is already passed by value to enetc_rxbd_next) lags behind,
      and we end up with this funny looking "++i == rx_ring->bd_count" check
      so that we drag it after us.
      
      Let's pass the software producer index "i" by reference, so that
      enetc_rxbd_next can increment it by itself (mod rx_ring->bd_count),
      especially since enetc_rxbd_next has to increment the index anyway.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c027aa92
    • Vladimir Oltean's avatar
      net: enetc: don't initialize unused ports from a separate code path · 4b47c0b8
      Vladimir Oltean authored
      Since commit 3222b5b6 ("net: enetc: initialize RFS/RSS memories for
      unused ports too") there is a requirement to initialize the memories of
      unused PFs too, which has left the probe path in a bit of a rough shape,
      because we basically have a minimal initialization path for unused PFs
      which is separate from the main initialization path.
      
      Now that initializing a control BD ring is as simple as calling
      enetc_setup_cbdr, let's move that outside of enetc_alloc_si_resources
      (unused PFs don't need classification rules, so no point in allocating
      them just to free them later).
      
      But enetc_alloc_si_resources is called both for PFs and for VFs, so now
      that enetc_setup_cbdr is no longer called from this common function, it
      means that the VF probe path needs to explicitly call enetc_setup_cbdr
      too.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4b47c0b8
    • Vladimir Oltean's avatar
      net: enetc: pass bd_count as an argument to enetc_setup_cbdr · 5b4daa7f
      Vladimir Oltean authored
      It makes no sense from an API perspective to first initialize some
      portion of struct enetc_cbdr outside enetc_setup_cbdr, then leave that
      function to initialize the rest. enetc_setup_cbdr should be able to
      perform all initialization given a zero-initialized struct enetc_cbdr.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5b4daa7f
    • Vladimir Oltean's avatar
      net: enetc: squash clear_cbdr and free_cbdr into teardown_cbdr · 0bfde022
      Vladimir Oltean authored
      All call sites call enetc_clear_cbdr and enetc_free_cbdr one after
      another, so let's combine the two functions into a single method named
      enetc_teardown_cbdr which does both, and in the same order.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0bfde022
    • Vladimir Oltean's avatar
      net: enetc: save the mode register address inside struct enetc_cbdr · 27f9025d
      Vladimir Oltean authored
      enetc_clear_cbdr depends on struct enetc_hw because it must disable the
      ring through a register write. We'd like to remove that dependency, so
      let's do what's already done with the producer and consumer indices,
      which is to save the iomem address in a variable kept in struct enetc_cbdr.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      27f9025d
    • Vladimir Oltean's avatar
      net: enetc: squash enetc_alloc_cbdr and enetc_setup_cbdr · 24be14e3
      Vladimir Oltean authored
      enetc_alloc_cbdr and enetc_setup_cbdr are always called one after
      another, so we can simplify the callers and make enetc_setup_cbdr do
      everything that's needed.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      24be14e3
    • Vladimir Oltean's avatar
      net: enetc: save the DMA device for enetc_free_cbdr · 01121ab7
      Vladimir Oltean authored
      We shouldn't need to pass the struct device *dev to enetc CBDR APIs over
      and over again, so save this inside struct enetc_cbdr::dma_dev and avoid
      calling it from the enetc_free_cbdr functions.
      
      This breaks the dependency of the cbdr API from struct enetc_si (the
      station interface).
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      01121ab7
    • Vladimir Oltean's avatar
      net: enetc: move the CBDR API to enetc_cbdr.c · 176769d1
      Vladimir Oltean authored
      Since there is a dedicated file in this driver for interacting with
      control BD rings, it makes sense to move these functions there.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      176769d1