1. 22 7月, 2021 13 次提交
    • L
      nfp: flower-ct: add flow_pay to the offload table · 453cdc30
      Louis Peens 提交于
      Compile the offload flow metadata and add flow_pay to the offload
      table. Also add in the delete paths. This does not include actual
      offloading to the card yet, this will follow soon.
      Signed-off-by: NLouis Peens <louis.peens@corigine.com>
      Signed-off-by: NYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: NSimon Horman <simon.horman@corigine.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      453cdc30
    • L
      nfp: flower-ct: add actions into flow_pay for offload · d94a63b4
      Louis Peens 提交于
      Combine the actions from the three different rules into one and
      convert into the payload format expected by the nfp.
      Signed-off-by: NLouis Peens <louis.peens@corigine.com>
      Signed-off-by: NYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: NSimon Horman <simon.horman@corigine.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d94a63b4
    • L
      nfp: flower-ct: compile match sections of flow_payload · 5a2b9304
      Louis Peens 提交于
      Add in the code to compile match part of the payload that will be
      sent to the firmware. This works similar to match.c does it, but
      since three flows needs to be merged it iterates through all three
      rules in a loop and combine the match fields to get the most strict
      match as result.
      Signed-off-by: NLouis Peens <louis.peens@corigine.com>
      Signed-off-by: NYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: NSimon Horman <simon.horman@corigine.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5a2b9304
    • L
      nfp: flower-ct: calculate required key_layers · 71e88cfb
      Louis Peens 提交于
      This calculates the correct combined keylayers and key_layer_size
      for the to-be-offloaded flow.
      Signed-off-by: NLouis Peens <louis.peens@corigine.com>
      Signed-off-by: NYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: NSimon Horman <simon.horman@corigine.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      71e88cfb
    • L
      nfp: flower: refactor action offload code slightly · e75dc265
      Louis Peens 提交于
      Change the action related offload functions to take in flow_rule *
      as input instead of flow_cls_offload * as input. The flow_rule
      parts of flow_cls_offload is the only part that is used in any
      case, and this is required for more conntrack offload patches
      which will follow later.
      Signed-off-by: NLouis Peens <louis.peens@corigine.com>
      Signed-off-by: NYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: NSimon Horman <simon.horman@corigine.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e75dc265
    • L
      nfp: flower: refactor match functions to take flow_rule as input · 4b15fb18
      Louis Peens 提交于
      This is a small cleanup to pass in flow->rule to some of the compile
      functions instead of extracting it every time. This is will also be
      useful for conntrack patches later.
      Signed-off-by: NLouis Peens <louis.peens@corigine.com>
      Signed-off-by: NYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: NSimon Horman <simon.horman@corigine.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4b15fb18
    • Y
      nfp: flower: make the match compilation functions reusable · 16416d37
      Yinjun Zhang 提交于
      Expose and refactor the match compilation functions so that they
      can be invoked externally. Also update the functions so they can
      be called multiple times with the results OR'd together. This is
      applicable for the flows-merging scenario, in which there could be
      overlapped and non-conflicting match fields. This will be used
      in upcoming conntrack patches. This is safe to do in the in the
      single call case as well since both unmasked_data and mask_data
      gets initialised to 0.
      Signed-off-by: NYinjun Zhang <yinjun.zhang@corigine.com>
      Signed-off-by: NLouis Peens <louis.peens@corigine.com>
      Signed-off-by: NSimon Horman <simon.horman@corigine.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      16416d37
    • V
      net: bridge: move the switchdev object replay helpers to "push" mode · 4e51bf44
      Vladimir Oltean 提交于
      Starting with commit 4f2673b3 ("net: bridge: add helper to replay
      port and host-joined mdb entries"), DSA has introduced some bridge
      helpers that replay switchdev events (FDB/MDB/VLAN additions and
      deletions) that can be lost by the switchdev drivers in a variety of
      circumstances:
      
      - an IP multicast group was host-joined on the bridge itself before any
        switchdev port joined the bridge, leading to the host MDB entries
        missing in the hardware database.
      - during the bridge creation process, the MAC address of the bridge was
        added to the FDB as an entry pointing towards the bridge device
        itself, but with no switchdev ports being part of the bridge yet, this
        local FDB entry would remain unknown to the switchdev hardware
        database.
      - a VLAN/FDB/MDB was added to a bridge port that is a LAG interface,
        before any switchdev port joined that LAG, leading to the hardware
        database missing those entries.
      - a switchdev port left a LAG that is a bridge port, while the LAG
        remained part of the bridge, and all FDB/MDB/VLAN entries remained
        installed in the hardware database of the switchdev port.
      
      Also, since commit 0d2cfbd4 ("net: bridge: ignore switchdev events
      for LAG ports which didn't request replay"), DSA introduced a method,
      based on a const void *ctx, to ensure that two switchdev ports under the
      same LAG that is a bridge port do not see the same MDB/VLAN entry being
      replayed twice by the bridge, once for every bridge port that joins the
      LAG.
      
      With so many ordering corner cases being possible, it seems unreasonable
      to expect a switchdev driver writer to get it right from the first try.
      Therefore, now that DSA has experimented with the bridge replay helpers
      for a little bit, we can move the code to the bridge driver where it is
      more readily available to all switchdev drivers.
      
      To convert the switchdev object replay helpers from "pull mode" (where
      the driver asks for them) to a "push mode" (where the bridge offers them
      automatically), the biggest problem is that the bridge needs to be aware
      when a switchdev port joins and leaves, even when the switchdev is only
      indirectly a bridge port (for example when the bridge port is a LAG
      upper of the switchdev).
      
      Luckily, we already have a hook for that, in the form of the newly
      introduced switchdev_bridge_port_offload() and
      switchdev_bridge_port_unoffload() calls. These offer a natural place for
      hooking the object addition and deletion replays.
      
      Extend the above 2 functions with:
      - pointers to the switchdev atomic notifier (for FDB replays) and the
        blocking notifier (for MDB and VLAN replays).
      - the "const void *ctx" argument required for drivers to be able to
        disambiguate between which port is targeted, when multiple ports are
        lowers of the same LAG that is a bridge port. Most of the drivers pass
        NULL to this argument, except the ones that support LAG offload and have
        the proper context check already in place in the switchdev blocking
        notifier handler.
      
      Also unexport the replay helpers, since nobody except the bridge calls
      them directly now.
      
      Note that:
      (a) we abuse the terminology slightly, because FDB entries are not
          "switchdev objects", but we count them as objects nonetheless.
          With no direct way to prove it, I think they are not modeled as
          switchdev objects because those can only be installed by the bridge
          to the hardware (as opposed to FDB entries which can be propagated
          in the other direction too). This is merely an abuse of terms, FDB
          entries are replayed too, despite not being objects.
      (b) the bridge does not attempt to sync port attributes to newly joined
          ports, just the countable stuff (the objects). The reason for this
          is simple: no universal and symmetric way to sync and unsync them is
          known. For example, VLAN filtering: what to do on unsync, disable or
          leave it enabled? Similarly, STP state, ageing timer, etc etc. What
          a switchdev port does when it becomes standalone again is not really
          up to the bridge's competence, and the driver should deal with it.
          On the other hand, replaying deletions of switchdev objects can be
          seen a matter of cleanup and therefore be treated by the bridge,
          hence this patch.
      
      We make the replay helpers opt-in for drivers, because they might not
      bring immediate benefits for them:
      
      - nbp_vlan_init() is called _after_ netdev_master_upper_dev_link(),
        so br_vlan_replay() should not do anything for the new drivers on
        which we call it. The existing drivers where there was even a slight
        possibility for there to exist a VLAN on a bridge port before they
        join it are already guarded against this: mlxsw and prestera deny
        joining LAG interfaces that are members of a bridge.
      
      - br_fdb_replay() should now notify of local FDB entries, but I patched
        all drivers except DSA to ignore these new entries in commit
        2c4eca3e ("net: bridge: switchdev: include local flag in FDB
        notifications"). Driver authors can lift this restriction as they
        wish, and when they do, they can also opt into the FDB replay
        functionality.
      
      - br_mdb_replay() should fix a real issue which is described in commit
        4f2673b3 ("net: bridge: add helper to replay port and host-joined
        mdb entries"). However most drivers do not offload the
        SWITCHDEV_OBJ_ID_HOST_MDB to see this issue: only cpsw and am65_cpsw
        offload this switchdev object, and I don't completely understand the
        way in which they offload this switchdev object anyway. So I'll leave
        it up to these drivers' respective maintainers to opt into
        br_mdb_replay().
      
      So most of the drivers pass NULL notifier blocks for the replay helpers,
      except:
      - dpaa2-switch which was already acked/regression-tested with the
        helpers enabled (and there isn't much of a downside in having them)
      - ocelot which already had replay logic in "pull" mode
      - DSA which already had replay logic in "pull" mode
      
      An important observation is that the drivers which don't currently
      request bridge event replays don't even have the
      switchdev_bridge_port_{offload,unoffload} calls placed in proper places
      right now. This was done to avoid unnecessary rework for drivers which
      might never even add support for this. For driver writers who wish to
      add replay support, this can be used as a tentative placement guide:
      https://patchwork.kernel.org/project/netdevbpf/patch/20210720134655.892334-11-vladimir.oltean@nxp.com/
      
      Cc: Vadym Kochan <vkochan@marvell.com>
      Cc: Taras Chornyi <tchornyi@marvell.com>
      Cc: Ioana Ciornei <ioana.ciornei@nxp.com>
      Cc: Lars Povlsen <lars.povlsen@microchip.com>
      Cc: Steen Hegelund <Steen.Hegelund@microchip.com>
      Cc: UNGLinuxDriver@microchip.com
      Cc: Claudiu Manoil <claudiu.manoil@nxp.com>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Grygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Acked-by: Ioana Ciornei <ioana.ciornei@nxp.com> # dpaa2-switch
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4e51bf44
    • V
      net: bridge: switchdev: let drivers inform which bridge ports are offloaded · 2f5dc00f
      Vladimir Oltean 提交于
      On reception of an skb, the bridge checks if it was marked as 'already
      forwarded in hardware' (checks if skb->offload_fwd_mark == 1), and if it
      is, it assigns the source hardware domain of that skb based on the
      hardware domain of the ingress port. Then during forwarding, it enforces
      that the egress port must have a different hardware domain than the
      ingress one (this is done in nbp_switchdev_allowed_egress).
      
      Non-switchdev drivers don't report any physical switch id (neither
      through devlink nor .ndo_get_port_parent_id), therefore the bridge
      assigns them a hardware domain of 0, and packets coming from them will
      always have skb->offload_fwd_mark = 0. So there aren't any restrictions.
      
      Problems appear due to the fact that DSA would like to perform software
      fallback for bonding and team interfaces that the physical switch cannot
      offload.
      
             +-- br0 ---+
            / /   |      \
           / /    |       \
          /  |    |      bond0
         /   |    |     /    \
       swp0 swp1 swp2 swp3 swp4
      
      There, it is desirable that the presence of swp3 and swp4 under a
      non-offloaded LAG does not preclude us from doing hardware bridging
      beteen swp0, swp1 and swp2. The bandwidth of the CPU is often times high
      enough that software bridging between {swp0,swp1,swp2} and bond0 is not
      impractical.
      
      But this creates an impossible paradox given the current way in which
      port hardware domains are assigned. When the driver receives a packet
      from swp0 (say, due to flooding), it must set skb->offload_fwd_mark to
      something.
      
      - If we set it to 0, then the bridge will forward it towards swp1, swp2
        and bond0. But the switch has already forwarded it towards swp1 and
        swp2 (not to bond0, remember, that isn't offloaded, so as far as the
        switch is concerned, ports swp3 and swp4 are not looking up the FDB,
        and the entire bond0 is a destination that is strictly behind the
        CPU). But we don't want duplicated traffic towards swp1 and swp2, so
        it's not ok to set skb->offload_fwd_mark = 0.
      
      - If we set it to 1, then the bridge will not forward the skb towards
        the ports with the same switchdev mark, i.e. not to swp1, swp2 and
        bond0. Towards swp1 and swp2 that's ok, but towards bond0? It should
        have forwarded the skb there.
      
      So the real issue is that bond0 will be assigned the same hardware
      domain as {swp0,swp1,swp2}, because the function that assigns hardware
      domains to bridge ports, nbp_switchdev_add(), recurses through bond0's
      lower interfaces until it finds something that implements devlink (calls
      dev_get_port_parent_id with bool recurse = true). This is a problem
      because the fact that bond0 can be offloaded by swp3 and swp4 in our
      example is merely an assumption.
      
      A solution is to give the bridge explicit hints as to what hardware
      domain it should use for each port.
      
      Currently, the bridging offload is very 'silent': a driver registers a
      netdevice notifier, which is put on the netns's notifier chain, and
      which sniffs around for NETDEV_CHANGEUPPER events where the upper is a
      bridge, and the lower is an interface it knows about (one registered by
      this driver, normally). Then, from within that notifier, it does a bunch
      of stuff behind the bridge's back, without the bridge necessarily
      knowing that there's somebody offloading that port. It looks like this:
      
           ip link set swp0 master br0
                        |
                        v
       br_add_if() calls netdev_master_upper_dev_link()
                        |
                        v
              call_netdevice_notifiers
                        |
                        v
             dsa_slave_netdevice_event
                        |
                        v
              oh, hey! it's for me!
                        |
                        v
                 .port_bridge_join
      
      What we do to solve the conundrum is to be less silent, and change the
      switchdev drivers to present themselves to the bridge. Something like this:
      
           ip link set swp0 master br0
                        |
                        v
       br_add_if() calls netdev_master_upper_dev_link()
                        |
                        v                    bridge: Aye! I'll use this
              call_netdevice_notifiers           ^  ppid as the
                        |                        |  hardware domain for
                        v                        |  this port, and zero
             dsa_slave_netdevice_event           |  if I got nothing.
                        |                        |
                        v                        |
              oh, hey! it's for me!              |
                        |                        |
                        v                        |
                 .port_bridge_join               |
                        |                        |
                        +------------------------+
                   switchdev_bridge_port_offload(swp0, swp0)
      
      Then stacked interfaces (like bond0 on top of swp3/swp4) would be
      treated differently in DSA, depending on whether we can or cannot
      offload them.
      
      The offload case:
      
          ip link set bond0 master br0
                        |
                        v
       br_add_if() calls netdev_master_upper_dev_link()
                        |
                        v                    bridge: Aye! I'll use this
              call_netdevice_notifiers           ^  ppid as the
                        |                        |  switchdev mark for
                        v                        |        bond0.
             dsa_slave_netdevice_event           | Coincidentally (or not),
                        |                        | bond0 and swp0, swp1, swp2
                        v                        | all have the same switchdev
              hmm, it's not quite for me,        | mark now, since the ASIC
               but my driver has already         | is able to forward towards
                 called .port_lag_join           | all these ports in hw.
                for it, because I have           |
            a port with dp->lag_dev == bond0.    |
                        |                        |
                        v                        |
                 .port_bridge_join               |
                 for swp3 and swp4               |
                        |                        |
                        +------------------------+
                  switchdev_bridge_port_offload(bond0, swp3)
                  switchdev_bridge_port_offload(bond0, swp4)
      
      And the non-offload case:
      
          ip link set bond0 master br0
                        |
                        v
       br_add_if() calls netdev_master_upper_dev_link()
                        |
                        v                    bridge waiting:
              call_netdevice_notifiers           ^  huh, switchdev_bridge_port_offload
                        |                        |  wasn't called, okay, I'll use a
                        v                        |  hwdom of zero for this one.
             dsa_slave_netdevice_event           :  Then packets received on swp0 will
                        |                        :  not be software-forwarded towards
                        v                        :  swp1, but they will towards bond0.
               it's not for me, but
             bond0 is an upper of swp3
            and swp4, but their dp->lag_dev
             is NULL because they couldn't
                  offload it.
      
      Basically we can draw the conclusion that the lowers of a bridge port
      can come and go, so depending on the configuration of lowers for a
      bridge port, it can dynamically toggle between offloaded and unoffloaded.
      Therefore, we need an equivalent switchdev_bridge_port_unoffload too.
      
      This patch changes the way any switchdev driver interacts with the
      bridge. From now on, everybody needs to call switchdev_bridge_port_offload
      and switchdev_bridge_port_unoffload, otherwise the bridge will treat the
      port as non-offloaded and allow software flooding to other ports from
      the same ASIC.
      
      Note that these functions lay the ground for a more complex handshake
      between switchdev drivers and the bridge in the future.
      
      For drivers that will request a replay of the switchdev objects when
      they offload and unoffload a bridge port (DSA, dpaa2-switch, ocelot), we
      place the call to switchdev_bridge_port_unoffload() strategically inside
      the NETDEV_PRECHANGEUPPER notifier's code path, and not inside
      NETDEV_CHANGEUPPER. This is because the switchdev object replay helpers
      need the netdev adjacency lists to be valid, and that is only true in
      NETDEV_PRECHANGEUPPER.
      
      Cc: Vadym Kochan <vkochan@marvell.com>
      Cc: Taras Chornyi <tchornyi@marvell.com>
      Cc: Ioana Ciornei <ioana.ciornei@nxp.com>
      Cc: Lars Povlsen <lars.povlsen@microchip.com>
      Cc: Steen Hegelund <Steen.Hegelund@microchip.com>
      Cc: UNGLinuxDriver@microchip.com
      Cc: Claudiu Manoil <claudiu.manoil@nxp.com>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Grygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com> # dpaa2-switch: regression
      Acked-by: Ioana Ciornei <ioana.ciornei@nxp.com> # dpaa2-switch
      Tested-by: Horatiu Vultur <horatiu.vultur@microchip.com> # ocelot-switch
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2f5dc00f
    • V
      net: dpaa2-switch: refactor prechangeupper sanity checks · 45035feb
      Vladimir Oltean 提交于
      Make more room for some extra code in the NETDEV_PRECHANGEUPPER handler
      by moving what already exists into a dedicated function.
      
      Cc: Ioana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Acked-by: NIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      45035feb
    • V
      net: dpaa2-switch: use extack in dpaa2_switch_port_bridge_join · 123338d7
      Vladimir Oltean 提交于
      We need to propagate the extack argument for
      dpaa2_switch_port_bridge_join to use it in a future patch, and it looks
      like there is already an error message there which is currently printed
      to the console. Move it over netlink so it is properly transmitted to
      user space.
      
      Cc: Ioana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: NIoana Ciornei <ioana.ciornei@nxp.com>
      Acked-by: NIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      123338d7
    • L
      ionic: cleanly release devlink instance · c2255ff4
      Leon Romanovsky 提交于
      The failure to register devlink will leave the system with dangled
      devlink resource, which is not cleaned if devlink_port_register() fails.
      
      In order to remove access to ".registered" field of struct devlink_port,
      require both devlink_register and devlink_port_register to success and
      check it through device pointer.
      
      Fixes: fbfb8031 ("ionic: Add hardware init and device commands")
      Reviewed-by: NMoshe Shemesh <moshe@nvidia.com>
      Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
      Acked-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c2255ff4
    • L
      ionic: drop useless check of PCI driver data validity · 524df92c
      Leon Romanovsky 提交于
      The driver core will call to .remove callback only if .probe succeeded
      and it will ensure that driver data has pointer to struct ionic.
      
      There is no need to check it again.
      
      Fixes: fbfb8031 ("ionic: Add hardware init and device commands")
      Signed-off-by: NLeon Romanovsky <leonro@nvidia.com>
      Acked-by: NShannon Nelson <snelson@pensando.io>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      524df92c
  2. 21 7月, 2021 13 次提交
  3. 20 7月, 2021 7 次提交
    • C
      net: marvell: clean up trigraph warning on ??! string · fa660684
      Colin Ian King 提交于
      The character sequence ??! is a trigraph and causes the following
      clang warning:
      
      drivers/net/ethernet/marvell/mvneta.c:2604:39: warning: trigraph ignored [-Wtrigraphs]
      
      Clean this by replacing it with single ?.
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      fa660684
    • R
      net: mvpp2: deny disabling autoneg for 802.3z modes · 635a85ac
      Russell King (Oracle) 提交于
      The documentation for Armada 8040 says:
      
        Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
        When <PortType> = 1 (1000BASE-X) this field must be set to 1.
      
      We presently ignore whether userspace requests autonegotiation or not
      through the ethtool ksettings interface. However, we have some network
      interfaces that wish to do this. To offer a consistent API across
      network interfaces, deny the ability to disable autonegotiation on
      mvpp2 hardware when in 1000BASE-X and 2500BASE-X.
      
      This means the only way to switch between 2500BASE-X and 1000BASE-X
      on SFPs that support this will be:
      
       # ethtool -s ethX advertise 0x20000006000 # 1000BASE-X Pause AsymPause
       # ethtool -s ethX advertise 0xe000        # 2500BASE-X Pause AsymPause
      Signed-off-by: NRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Acked-by: NMarek Behún <kabel@kernel.org>
      Acked-by: NMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      635a85ac
    • R
      net: mvneta: deny disabling autoneg for 802.3z modes · c762b7fa
      Russell King (Oracle) 提交于
      The documentation for Armada 38x says:
      
        Bit 2 Field InBandAnEn In-band Auto-Negotiation enable. ...
        When <PortType> = 1 (1000BASE-X) this field must be set to 1.
      
      We presently ignore whether userspace requests autonegotiation or not
      through the ethtool ksettings interface. However, we have some network
      interfaces that wish to do this. To offer a consistent API across
      network interfaces, deny the ability to disable autonegotiation on
      mvneta hardware when in 1000BASE-X and 2500BASE-X.
      
      This means the only way to switch between 2500BASE-X and 1000BASE-X
      on SFPs that support this will be:
      
       # ethtool -s ethX advertise 0x20000002000 # 1000BASE-X Pause
       # ethtool -s ethX advertise 0xa000        # 2500BASE-X Pause
      Signed-off-by: NRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Acked-by: NMarek Behún <kabel@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c762b7fa
    • K
      Revert "igc: Export LEDs" · edd2e9d5
      Kurt Kanzenbach 提交于
      This reverts commit cf833182.
      
      There are better Linux interfaces to export the different LED modes
      and blinking reasons.
      
      Revert this patch for now and come up with better solution later.
      Suggested-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NKurt Kanzenbach <kurt@linutronix.de>
      Link: https://lore.kernel.org/r/20210719101640.16047-1-kurt@linutronix.deSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      edd2e9d5
    • S
      iavf: fix locking of critical sections · 226d5285
      Stefan Assmann 提交于
      To avoid races between iavf_init_task(), iavf_reset_task(),
      iavf_watchdog_task(), iavf_adminq_task() as well as the shutdown and
      remove functions more locking is required.
      The current protection by __IAVF_IN_CRITICAL_TASK is needed in
      additional places.
      
      - The reset task performs state transitions, therefore needs locking.
      - The adminq task acts on replies from the PF in
        iavf_virtchnl_completion() which may alter the states.
      - The init task is not only run during probe but also if a VF gets stuck
        to reinitialize it.
      - The shutdown function performs a state transition.
      - The remove function performs a state transition and also free's
        resources.
      
      iavf_lock_timeout() is introduced to avoid waiting infinitely
      and cause a deadlock. Rather unlock and print a warning.
      Signed-off-by: NStefan Assmann <sassmann@kpanic.de>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      226d5285
    • S
      iavf: do not override the adapter state in the watchdog task · 22c8fd71
      Stefan Assmann 提交于
      The iavf watchdog task overrides adapter->state to __IAVF_RESETTING
      when it detects a pending reset. Then schedules iavf_reset_task() which
      takes care of the reset.
      
      The reset task is capable of handling the reset without changing
      adapter->state. In fact we lose the state information when the watchdog
      task prematurely changes the adapter state. This may lead to a crash if
      instead of the reset task the iavf_remove() function gets called before
      the reset task.
      In that case (if we were in state __IAVF_RUNNING previously) the
      iavf_remove() function triggers iavf_close() which fails to close the
      device because of the incorrect state information.
      
      This may result in a crash due to pending interrupts.
      kernel BUG at drivers/pci/msi.c:357!
      [...]
      Call Trace:
       [<ffffffffbddf24dd>] pci_disable_msix+0x3d/0x50
       [<ffffffffc08d2a63>] iavf_reset_interrupt_capability+0x23/0x40 [iavf]
       [<ffffffffc08d312a>] iavf_remove+0x10a/0x350 [iavf]
       [<ffffffffbddd3359>] pci_device_remove+0x39/0xc0
       [<ffffffffbdeb492f>] __device_release_driver+0x7f/0xf0
       [<ffffffffbdeb49c3>] device_release_driver+0x23/0x30
       [<ffffffffbddcabb4>] pci_stop_bus_device+0x84/0xa0
       [<ffffffffbddcacc2>] pci_stop_and_remove_bus_device+0x12/0x20
       [<ffffffffbddf361f>] pci_iov_remove_virtfn+0xaf/0x160
       [<ffffffffbddf3bcc>] sriov_disable+0x3c/0xf0
       [<ffffffffbddf3ca3>] pci_disable_sriov+0x23/0x30
       [<ffffffffc0667365>] i40e_free_vfs+0x265/0x2d0 [i40e]
       [<ffffffffc0667624>] i40e_pci_sriov_configure+0x144/0x1f0 [i40e]
       [<ffffffffbddd5307>] sriov_numvfs_store+0x177/0x1d0
      Code: 00 00 e8 3c 25 e3 ff 49 c7 86 88 08 00 00 00 00 00 00 5b 41 5c 41 5d 41 5e 41 5f 5d c3 48 8b 7b 28 e8 0d 44
      RIP  [<ffffffffbbbf1068>] free_msi_irqs+0x188/0x190
      
      The solution is to not touch the adapter->state in iavf_watchdog_task()
      and let the reset task handle the state transition.
      Signed-off-by: NStefan Assmann <sassmann@kpanic.de>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      22c8fd71
    • S
      i40e: improve locking of mac_filter_hash · 8b4b0691
      Stefan Assmann 提交于
      i40e_config_vf_promiscuous_mode() calls
      i40e_getnum_vf_vsi_vlan_filters() without acquiring the
      mac_filter_hash_lock spinlock.
      
      This is unsafe because mac_filter_hash may get altered in another thread
      while i40e_getnum_vf_vsi_vlan_filters() traverses the hashes.
      
      Simply adding the spinlock in i40e_getnum_vf_vsi_vlan_filters() is not
      possible as it already gets called in i40e_get_vlan_list_sync() with the
      spinlock held. Therefore adding a wrapper that acquires the spinlock and
      call the correct function where appropriate.
      
      Fixes: 37d318d7 ("i40e: Remove scheduling while atomic possibility")
      Fix-suggested-by: NPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: NStefan Assmann <sassmann@kpanic.de>
      Tested-by: NKonrad Jankowski <konrad0.jankowski@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      8b4b0691
  4. 17 7月, 2021 7 次提交