1. 04 Aug, 2021 26 commits
    • DENG Qingfang's avatar
      net: dsa: mt7530: use independent VLAN learning on VLAN-unaware bridges · 6087175b
      DENG Qingfang authored
      Consider the following bridge configuration, where bond0 is not
      offloaded:
      
               +-- br0 --+
              / /   |     \
             / /    |      \
            /  |    |     bond0
           /   |    |     /   \
         swp0 swp1 swp2 swp3 swp4
           .        .       .
           .        .       .
           A        B       C
      
      Ideally, when the switch receives a packet from swp3 or swp4, it should
      forward the packet to the CPU, according to the port matrix and unknown
      unicast flood settings.
      
      But packet loss will happen if the destination address is at one of the
      offloaded ports (swp0~2). For example, when client C sends a packet to
      A, the FDB lookup will indicate that it should be forwarded to swp0, but
      the port matrix of swp3 and swp4 is configured to only allow the CPU to
      be its destination, so it is dropped.
      
      However, this issue does not happen if the bridge is VLAN-aware. That is
      because VLAN-aware bridges use independent VLAN learning, i.e. use VID
      for FDB lookup, on offloaded ports. As swp3 and swp4 are not offloaded,
      shared VLAN learning with default filter ID of 0 is used instead. So the
      lookup for A with filter ID 0 never hits and the packet can be forwarded
      to the CPU.
      
      In the current code, only two combinations were used to toggle user
      ports' VLAN awareness: one is PCR.PORT_VLAN set to port matrix mode with
      PVC.VLAN_ATTR set to transparent port, the other is PCR.PORT_VLAN set to
      security mode with PVC.VLAN_ATTR set to user port.
      
      It turns out that only PVC.VLAN_ATTR contributes to VLAN awareness, and
      port matrix mode just skips the VLAN table lookup. The reference manual
      is somehow misleading when describing PORT_VLAN modes. It states that
      PORT_MEM (VLAN port member) is used for destination if the VLAN table
      lookup hits, but actually **PORT_MEM & PORT_MATRIX** (bitwise AND of
      VLAN port member and port matrix) is used instead, which means we can
      have two or more separate VLAN-aware bridges with the same PVID and
      traffic won't leak between them.
      
      Therefore, to solve this, enable independent VLAN learning with PVID 0
      on VLAN-unaware bridges, by setting their PCR.PORT_VLAN to fallback
      mode, while leaving standalone ports in port matrix mode. The CPU port
      is always set to fallback mode to serve those bridges.
      
      During testing, it is found that FDB lookup with filter ID of 0 will
      also hit entries with VID 0 even with independent VLAN learning. To
      avoid that, install all VLANs with filter ID of 1.
      Signed-off-by: default avatarDENG Qingfang <dqfext@gmail.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6087175b
    • DENG Qingfang's avatar
      net: dsa: mt7530: enable assisted learning on CPU port · 0b69c54c
      DENG Qingfang authored
      Consider the following bridge configuration, where bond0 is not
      offloaded:
      
               +-- br0 --+
              / /   |     \
             / /    |      \
            /  |    |     bond0
           /   |    |     /   \
         swp0 swp1 swp2 swp3 swp4
           .        .       .
           .        .       .
           A        B       C
      
      Address learning is enabled on offloaded ports (swp0~2) and the CPU
      port, so when client A sends a packet to C, the following will happen:
      
      1. The switch learns that client A can be reached at swp0.
      2. The switch probably already knows that client C can be reached at the
         CPU port, so it forwards the packet to the CPU.
      3. The bridge core knows client C can be reached at bond0, so it
         forwards the packet back to the switch.
      4. The switch learns that client A can be reached at the CPU port.
      5. The switch forwards the packet to either swp3 or swp4, according to
         the packet's tag.
      
      That makes client A's MAC address flap between swp0 and the CPU port. If
      client B sends a packet to A, it is possible that the packet is
      forwarded to the CPU. With offload_fwd_mark = 1, the bridge core won't
      forward it back to the switch, resulting in packet loss.
      
      As we have the assisted_learning_on_cpu_port in DSA core now, enable
      that and disable hardware learning on the CPU port.
      Signed-off-by: default avatarDENG Qingfang <dqfext@gmail.com>
      Reviewed-by: default avatarVladimir Oltean <oltean@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0b69c54c
    • David S. Miller's avatar
      Merge branch 'ipa-pm-irqs' · 8eceea41
      David S. Miller authored
      Alex Elder says:
      
      ====================
      net: ipa: prepare GSI interrupts for runtime PM
      
      The last patch in this series arranges for GSI interrupts to be
      disabled when the IPA hardware is suspended.  This ensures the clock
      is always operational when a GSI interrupt fires.  Leading up to
      that are patches that rearrange the code a bit to allow this to
      be done.
      
      The first two patches aren't *directly* related.  They remove some
      flag arguments to some GSI suspend/resume related functions, using
      the version field now present in the GSI structure.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8eceea41
    • Alex Elder's avatar
      net: ipa: disable GSI interrupts while suspended · 45a42a3c
      Alex Elder authored
      Introduce new functions gsi_suspend() and gsi_resume(), which will
      disable the GSI interrupt handler after all endpoints are suspended
      and re-enable it before endpoints are resumed.  This will ensure no
      GSI interrupt handler will fire when the hardware is suspended.
      
      Here's a little further explanation.  There are seven GSI interrupt
      types, and most are disabled except when needed.
        - These two are not used (never enabled):
            GSI_INTER_EE_CH_CTRL
            GSI_INTER_EE_EV_CTRL
        - These two are only used to implement channel and event ring
          commands, and are only enabled while a command is underway:
            GSI_CH_CTRL
            GSI_EV_CTRL
        - The IEOB interrupt signals I/O completion.  It will not fire
          when a channel is stopped (or "suspended").
            GSI_IEOB
        - This interrupt is used to allocate or halt modem channels,
          and is only enabled while such a command is underway.
            GSI_GLOB_EE
          However it also is used to signal certain errors, and this could
          occur at any time.
        - The general interrupt signals general errors, and could occur at
          any time.
            GSI_GENERAL
      
      The purpose for this change is to ensure no global or general
      interrupts fire due to errors while the hardware is suspended.
      We enable the clock on resume, and at that time we can "handle"
      (at least report) these error conditions.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      45a42a3c
    • Alex Elder's avatar
      net: ipa: move gsi_irq_init() code into setup · b176f95b
      Alex Elder authored
      The GSI IRQ handler could be triggered as soon as it is registered
      with request_irq().  The handler function, gsi_isr(), touches
      hardware, meaning the IPA clock must be operational.  The IPA clock
      is not operating when the handler is registered (in gsi_irq_init()),
      so this is a problem.
      
      Move the call to request_irq() for the GSI interrupt handler into
      gsi_irq_setup(), which is called when the IPA clock is known to be
      operational (and furthermore, the GSI firmware will have been
      loaded).  Request the IRQ at the end of that function, after all
      interrupt types have been disabled and masked.
      
      Move the matching free_irq() call into gsi_irq_teardown(), and get
      rid of the now empty gsi_irq_exit(),
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b176f95b
    • Alex Elder's avatar
      net: ipa: have gsi_irq_setup() return an error code · 1657d8a4
      Alex Elder authored
      Change gsi_irq_setup() so it returns an error value, and introduce
      gsi_irq_teardown() as its inverse.  Set the interrupt type (IRQ
      rather than MSI) in gsi_irq_setup().
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1657d8a4
    • Alex Elder's avatar
      net: ipa: move some GSI setup functions · a7860a5f
      Alex Elder authored
      Move gsi_irq_setup() and gsi_ring_setup() so they're defined right
      above gsi_setup() where they're called.  This is a trivial movement
      of code to prepare for upcoming patches.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7860a5f
    • Alex Elder's avatar
      net: ipa: move version check for channel suspend/resume · 4a4ba483
      Alex Elder authored
      Change the Boolean flags passed to __gsi_channel_start() and
      __gsi_channel_stop() so they represent whether the request is being
      made to implement suspend (versus stop) or resume (versus start).
      
      Then stop or start the channel for suspend/resume requests only if
      the hardware version indicates it should be done.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4a4ba483
    • Alex Elder's avatar
      net: ipa: use gsi->version for channel suspend/resume · decfef0f
      Alex Elder authored
      The GSI layer has the IPA version now, so there's no need for
      version-specific flags to be passed from IPA.  One instance of
      this is in gsi_channel_suspend() and gsi_channel_resume(), which
      indicate whether or not the endpoint suspend is implemented by
      GSI stopping the channel.  We can make that determination based
      on gsi->version, eliminating the need for a Boolean flag in those
      functions.
      Signed-off-by: default avatarAlex Elder <elder@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      decfef0f
    • David S. Miller's avatar
      Merge branch 'mhi-mbim' · 93bbcfee
      David S. Miller authored
      Loic Poulain says:
      
      ====================
      net: mhi: move MBIM to WWAN
      
      Implement a proper WWAN driver for MBIM network protocol, with multi link
      management supported through the WWAN framework (wwan rtnetlink).
      
      Until now, MBIM over MHI was supported directly in the mhi_net driver, via
      some protocol rx/tx fixup callbacks, but with only one session supported
      (no multilink muxing). We can then remove that part from mhi_net and restore
      the driver to a simpler version for 'raw' ip transfer (or QMAP via rmnet link).
      
      Note that a wwan0 link is created by default for session-id 0. Additional links
      can be managed via ip tool:
      
          $ ip link add dev wwan0mms parentdev wwan0 type wwan linkid 1
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      93bbcfee
    • Loic Poulain's avatar
      net: mhi: Remove MBIM protocol · 7ffa7542
      Loic Poulain authored
      The MBIM protocol has now been integrated in a proper WWAN driver. We
      can then revert back to a simpler driver for mhi_net, which is used
      for raw IP or QMAP protocol (via rmnet link).
      
      - Remove protocol management
      - Remove WWAN framework usage (only valid for mbim)
      - Remove net/mhi directory for simpler mhi_net.c file
      Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7ffa7542
    • Loic Poulain's avatar
      net: wwan: Add MHI MBIM network driver · aa730a99
      Loic Poulain authored
      Add new wwan driver for MBIM over MHI. MBIM is a transport protocol
      for IP packets, allowing packet aggregation and muxing. Initially
      designed for USB bus, it is also exposed through MHI bus for QCOM
      based PCIe wwan modems.
      
      This driver supports the new wwan rtnetlink interface for multi-link
      management and has been tested with Quectel EM120R-GL M2 module.
      Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      aa730a99
    • David S. Miller's avatar
      Merge branch 'queues' · 8730379e
      David S. Miller authored
      Jakub Kicinski says:
      
      ====================
      net: add netif_set_real_num_queues() for device reconfig
      
      This short set adds a helper to make the implementation of
      two-phase NIC reconfig easier.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8730379e
    • Jakub Kicinski's avatar
      nfp: use netif_set_real_num_queues() · e874f455
      Jakub Kicinski authored
      Avoid reconfig problems due to failures in netif_set_real_num_tx_queues()
      by using netif_set_real_num_queues().
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e874f455
    • Jakub Kicinski's avatar
      net: add netif_set_real_num_queues() for device reconfig · 271e5b7d
      Jakub Kicinski authored
      netif_set_real_num_rx_queues() and netif_set_real_num_tx_queues()
      can fail which breaks drivers trying to implement reconfiguration
      in a way that can't leave the device half-broken. In other words
      those functions are incompatible with prepare/commit approach.
      
      Luckily setting real number of queues can fail only if the number
      is increased, meaning that if we order operations correctly we
      can guarantee ending up with either new config (success), or
      the old one (on error).
      
      Provide a helper implementing such logic so that drivers don't
      have to duplicate it.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      271e5b7d
    • Rocco Yue's avatar
      net: add extack arg for link ops · 8679c31e
      Rocco Yue authored
      Pass extack arg to validate_linkmsg and validate_link_af callbacks.
      If a netlink attribute has a reject_message, use the extended ack
      mechanism to carry the message back to user space.
      Signed-off-by: default avatarRocco Yue <rocco.yue@mediatek.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8679c31e
    • Rao Shoaib's avatar
      af_unix: Add OOB support · 314001f0
      Rao Shoaib authored
      This patch adds OOB support for AF_UNIX sockets.
      The semantics is same as TCP.
      
      The last byte of a message with the OOB flag is
      treated as the OOB byte. The byte is separated into
      a skb and a pointer to the skb is stored in unix_sock.
      The pointer is used to enforce OOB semantics.
      Signed-off-by: default avatarRao Shoaib <rao.shoaib@oracle.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      314001f0
    • David S. Miller's avatar
      Merge branch 'dpaa2-switch-next' · 7e89350c
      David S. Miller authored
      Ioana Ciornei says:
      
      ====================
      dpaa2-switch: integrate the MAC endpoint support
      
      This patch set integrates the already available MAC support into the
      dpaa2-switch driver as well.
      
      The first 4 patches are fixing up some minor problems or optimizing the
      code, while the remaining ones are actually integrating the dpaa2-mac
      support into the switch driver by calling the dpaa2_mac_* provided
      functions. While at it, we also export the MAC statistics in ethtool
      like we do for dpaa2-eth.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7e89350c
    • Ioana Ciornei's avatar
      dpaa2-switch: export MAC statistics in ethtool · f0653a89
      Ioana Ciornei authored
      If a switch port is connected to a MAC, use the common dpaa2-mac support
      for exporting the available MAC statistics.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f0653a89
    • Ioana Ciornei's avatar
      dpaa2-switch: add a prefix to HW ethtool stats · 8581362d
      Ioana Ciornei authored
      In the next patch, we'll add support for also exporting the MAC
      statistics in the ethtool stats. Annotate already present HW stats with
      a suggestive prefix.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8581362d
    • Ioana Ciornei's avatar
      dpaa2-switch: integrate the MAC endpoint support · 84cba729
      Ioana Ciornei authored
      Integrate the common MAC endpoint management support into the
      dpaa2-switch driver as well. Nothing special happens here, just that the
      already available dpaa2-mac functions are also called from dpaa2-switch.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      84cba729
    • Ioana Ciornei's avatar
      bus: fsl-mc: extend fsl_mc_get_endpoint() to pass interface ID · 27cfdadd
      Ioana Ciornei authored
      In case of a switch DPAA2 object, the interface ID is also needed when
      querying for the object endpoint. Extend fsl_mc_get_endpoint() so that
      users can also pass the interface ID that are interested in.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      27cfdadd
    • Ioana Ciornei's avatar
      dpaa2-switch: no need to check link state right after ndo_open · 2b24ffd8
      Ioana Ciornei authored
      The call to dpaa2_switch_port_link_state_update is a leftover from the
      time when on DPAA2 platforms the PHYs were started at boot time so when
      an ifconfig was issued on the associated interface, the link status
      needed to be checked directly from the ndo_open() callback.  This is not
      needed anymore since we are now properly integrated with the PHY layer
      thus a link interrupt will come directly from the PHY eventually without
      the need to call the sync function.
      Fix this up by removing the call to dpaa2_switch_port_link_state_update.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b24ffd8
    • Ioana Ciornei's avatar
      dpaa2-switch: do not enable the DPSW at probe time · 042ad90c
      Ioana Ciornei authored
      We should not enable the switch interfaces at probe time since this is
      trigged by the open callback. Remove the call dpsw_enable() which does
      exactly this.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      042ad90c
    • Ioana Ciornei's avatar
      dpaa2-switch: use the port index in the IRQ handler · 24ab724f
      Ioana Ciornei authored
      The MC firmware supplies us the switch interface index for which an
      interrupt was triggered. Use this to our advantage instead of looping
      through all the switch ports and doing unnecessary work.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      24ab724f
    • Ioana Ciornei's avatar
      dpaa2-switch: request all interrupts sources on the DPSW · 1ca6cf5e
      Ioana Ciornei authored
      Request all interrupt sources to be read and then cleared on the DPSW
      object. In the next patches we'll also add support for treating other
      interrupts.
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1ca6cf5e
  2. 03 Aug, 2021 14 commits