1. 29 6月, 2022 16 次提交
    • J
      sfc: Encapsulate access to netdev_priv() · 8cb03f4e
      Jonathan Cooper 提交于
      Once we separate struct efx_nic memory from net_device memory the
      existing usage will have to change.
      Apart from the new function efx_netdev_priv() accesses have been
      changed using:
        sed -i 's/netdev_priv/efx_netdev_priv/'
      Signed-off-by: NJonathan Cooper <jonathan.s.cooper@amd.com>
      Co-developed-by: NMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: NMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8cb03f4e
    • J
      sfc: Change BUG_ON to WARN_ON and recovery code. · b3fd0a86
      Jonathan Cooper 提交于
      Pre-emptively fix a checkpatch warning in a subsequent patch.
      Signed-off-by: NJonathan Cooper <jonathan.s.cooper@amd.com>
      Co-developed-by: NMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: NMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b3fd0a86
    • J
      sfc: Remove netdev init from efx_init_struct · 62ac3ce5
      Jonathan Cooper 提交于
      Move functionality involving the struct net_device out of
      efx_init_struct so that we can initialise without a net dev
      for VDPA operation.
      Signed-off-by: NJonathan Cooper <jonathan.s.cooper@amd.com>
      Co-developed-by: NMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: NMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      62ac3ce5
    • J
      sfc: Add a PROBED state for EF100 VDPA use. · 8b39db19
      Jonathan Cooper 提交于
      For VDPA we need to tear down the driver to the point where it
      has various control channels like MCDI, but it no longer has
      a network device. This adds a state corresponding to
      that mode that will be used when VDPA support is added.
      Signed-off-by: NJonathan Cooper <jonathan.s.cooper@amd.com>
      Co-developed-by: NMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: NMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8b39db19
    • J
      sfc: Split STATE_READY in to STATE_NET_DOWN and STATE_NET_UP. · 813cf9d1
      Jonathan Cooper 提交于
      This patch splits the READY state in to NET_UP and NET_DOWN. This
      is to prepare for future work to delay resource allocation until
      interface up so that we can use resources more efficiently in
      SRIOV environments, and also to lay the ground work for an extra
      PROBED state where we don't create a network interface,
      for VDPA operation.
      Signed-off-by: NJonathan Cooper <jonathan.s.cooper@amd.com>
      Acked-by: NMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      813cf9d1
    • A
      mlxsw: spectrum_switchdev: Convert MDB code to use PGT APIs · e28cd993
      Amit Cohen 提交于
      The previous patches added common APIs for maintaining PGT (Port Group
      Table) table. In the legacy model, software did not interact with this
      table directly. Instead, it was accessed by firmware in response to
      registers such as SFTR and SMID. In the new model, software has full
      control over the PGT table using the SMID register.
      
      The configuration of MDB entries is already done via SMID, so the new
      PGT APIs can be used also using the legacy model, the only difference is
      that MID index should be aligned to bridge model. See a previous patch
      which added API for that.
      
      The main changes are:
      - MDB code does not maintain bitmap of ports in MDB entry anymore, instead,
        it stores a list of ports with additional information.
      - MDB code does not configure SMID register directly anymore, it will be
        done via PGT API when port is first added or removed.
      - Today MDB code does not update SMID when port is added/removed while
        multicast is disabled. Instead, it maintains bitmap of ports and once
        multicast is enabled, it rewrite the entry to hardware. Using PGT APIs,
        the entry will be updated also when multicast is disabled, but the
        mapping between {MAC, FID}->{MID} will not appear in SFD register. It
        means that SMID will be updated all the time and disable/enable multicast
        will impact only SFD configuration.
      - For multicast router, today only SMID is updated and the bitmap is not
        updated. Using the new list of ports, there is a reference count for each
        port, so it can be saved in software also. For such port,
        'struct mlxsw_sp_mdb_entry.ports_count' will not be updated and the
        port in the list will be marked as 'mrouter'.
      - Finally, `struct mlxsw_sp_mid.in_hw` is not needed anymore.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      e28cd993
    • A
      mlxsw: spectrum_switchdev: Flush port from MDB entries according to FID index · 4c3f7442
      Amit Cohen 提交于
      Currently, flushing port from all MDB entries is done when the last VLAN
      is removed. This behavior is inaccurate, as port can be removed while there
      is another port which uses the same VLAN, in such case, this is not the
      last port which uses this VLAN and removed, but this port is supposed to be
      removed from the MDB entries.
      
      Flush the port from MDB when it is removed, regardless the state of other
      ports. Flush only the MDB entries which are relevant for the same FID
      index.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4c3f7442
    • A
      mlxsw: spectrum_switchdev: Add support for getting and putting MDB entry · 7434ed61
      Amit Cohen 提交于
      A previous patch added support for init() and fini() for MDB entries. MDB
      entry can be updated, ports can be added and removed from the entry. Add
      get() and put() functions, the first one checks if the entry already exists
      and otherwise initializes the entry. The second removes the entry just in
      case that there are no more ports in this entry.
      
      Use the list of the ports which was added in a previous patch. When the
      list contains only one port which is not multicast router, and this port
      is removed, the MDB entry can be removed. Use
      'struct mlxsw_sp_mdb_entry.ports_count' to know how many ports use the
      entry, regardless the use of multicast router ports.
      
      When mlxsw_sp_mc_mdb_entry_put() is called with specific port which
      supposed to be removed, check if the removal will cause a deletion of
      the entry. If this is the case, call mlxsw_sp_mc_mdb_entry_fini() which
      first deletes the MDB entry and then releases the PGT entry, to avoid a
      temporary situation in which the MDB entry points to an empty PGT entry,
      as otherwise packets will be temporarily dropped instead of being flooded.
      
      The new functions will be used in the next patches.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7434ed61
    • A
      mlxsw: spectrum_switchdev: Implement mlxsw_sp_mc_mdb_entry_{init, fini}() · ea0f58d6
      Amit Cohen 提交于
      The next patches will convert MDB code to use PGT APIs. The change will
      move the responsibility of allocating MID indexes and writing PGT
      configurations to hardware to PGT code. As part of this change, most of the
      MDB code will be changed and improved.
      
      As a preparation for the above mentioned change, implement
      mlxsw_sp_mc_mdb_entry_{init, fini}(). Currently, there is a function
      __mlxsw_sp_mc_alloc(), which does not only allocate MID. In addition,
      there is no an equivalent function to free the MID. When
      mlxsw_sp_port_remove_from_mid() removes the last port, it handles MID
      removal. Instead, add init() and fini() functions, which use PGT APIs.
      
      The differences between the existing and the new functions are as follows:
      1. Today MDB code does not update SMID when port is added/removed while
         multicast is disabled. It maintains a bitmap of ports and once multicast
         is enabled, it writes the entry to hardware. Instead, using PGT APIs,
         the entry will be updated also when multicast is disabled, but the
         mapping between {MAC, FID}->{MID} (is configured using SFD) will be
         updated according to multicast state. It means that SMID will be updated
         all the time and disable/enable multicast will impact only SFD
         configuration.
      
      2. Today the allocation of MID index is done as part of
         mlxsw_sp_mc_write_mdb_entry(). The fact that the entry will be
         written in hardware all the time, moves the allocation of the index to
         be as part of the MDB entry initialization. PGT API is used for the
         allocation.
      
      3. Today the update of multicast router ports is done as part of
         mlxsw_sp_mc_write_mdb_entry(). Instead, add functions to add/remove
         all multicast router ports when entry is first added or removed. When
         new multicast router port will be added/removed, the dedicated API will
         be used to add/remove it from the existing entries.
      
      4. A list of ports will be stored per MDB entry instead of the exiting
         bitmap. The list will contain the multicast router ports and maintain
         reference counter per port.
      
      Add mlxsw_sp_mdb_entry_write() which is almost identical to
      mlxsw_sp_port_mdb_op(). Use more clear name and align the MID index to
      bridge model using PGT API. The existing function will be removed in the
      next patches.
      
      Note that PGT APIs configure the firmware using SMID register, like the
      driver already does today for MDB entries, so PGT APIs can be used also
      using legacy bridge model.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ea0f58d6
    • A
      mlxsw: spectrum_switchdev: Add support for maintaining list of ports per MDB entry · d2994e13
      Amit Cohen 提交于
      As part of converting MDB code to use PGT APIs, PGT code stores which ports
      are mapped to each PGT entry. PGT code is not aware of the type of the port
      (multicast router or not), as it is not relevant there.
      
      To be able to release an MDB entry when the there are no ports which are
      not multicast routers, the entry should be aware of the state of its
      ports. Add support for maintaining list of ports per MDB entry.
      
      Each port will hold a reference count as multiple MDB entries can use the
      same hardware MDB entry. It occurs because MDB entries in the Linux bridge
      are keyed according to their multicast IP, when these entries are notified
      to device drivers via switchdev, the multicast IP is converted to a
      multicast MAC. This conversion might cause collisions, for example,
      ff0e::1 and ff0e:1234::1 are both mapped to the multicast MAC
      33:33:00:00:00:01.
      
      Multicast router port will take a reference once, and will be marked as
      'mrouter', then when port in the list is multicast router and its
      reference value is one, it means that the entry can be removed in case
      that there are no other ports which are not multicast routers. For that,
      maintain a counter per MDB entry to count ports in the list, which were
      added to the multicast group, and not because they are multicast routers.
      When this counter is zero, the entry can be removed.
      
      Add mlxsw_sp_mdb_entry_port_{get,put}() for regular ports and
      mlxsw_sp_mdb_entry_mrouter_port_{get,put}() for multicast router ports.
      Call PGT API to add or remove port from PGT entry when port is first added
      or removed, according to the reference counting.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d2994e13
    • A
      mlxsw: spectrum_switchdev: Add support for maintaining hash table of MDB entries · 5d0512e5
      Amit Cohen 提交于
      Currently MDB entries are stored in a list as part of
      'struct mlxsw_sp_bridge_device'. Storing them in a hash table in
      addition to the list will allow finding a specific entry more efficiently.
      
      Add support for the required hash table, the next patches will insert
      and remove MDB entries from the table. The existing code which adds and
      removes entries will be removed and replaced by new code in the next
      patches, so there is no point to adjust the existing code.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5d0512e5
    • A
      mlxsw: spectrum_switchdev: Save MAC and FID as a key in 'struct mlxsw_sp_mdb_entry' · 0ac98543
      Amit Cohen 提交于
      The next patch will add support for storing all the MDB entries in a hash
      table. As a preparation, save the MAC address and the FID in a
      separate structure. This structure will be used later as a key for the
      hash table.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0ac98543
    • A
      mlxsw: spectrum_switchdev: Rename MIDs list · eaa0791a
      Amit Cohen 提交于
      Currently, the list which stores the MDB entries for a given bridge
      instance is called 'mids_list'.
      
      This name is not accurate as a MID entry stores a bitmap of ports to
      which a packet needs to be replicated and a MDB entry stores the mapping
      from {MAC, FID} to PGT index (MID)
      
      Rename it to 'mdb_list'.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eaa0791a
    • A
      mlxsw: spectrum_switchdev: Rename MID structure · eede53a4
      Amit Cohen 提交于
      Currently the structure which represents MDB entry is called
      'struct mlxsw_sp_mid'. This name is not accurate as a MID entry stores a
      bitmap of ports to which a packet needs to be replicated and a MDB entry
      stores the mapping from {MAC, FID} to PGT index (MID).
      
      Rename the structure to 'struct mlxsw_sp_mdb_entry'. The structure
      'mlxsw_sp_mid' is defined as part of spectrum.h. The only file which
      uses it is spectrum_switchdev.c, so there is no reason to expose it to
      other files. Move the definition to spectrum_switchdev.c.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      eede53a4
    • A
      mlxsw: Align PGT index to legacy bridge model · 4abaa5cc
      Amit Cohen 提交于
      FID code reserves about 15K entries in PGT table for flooding. These
      entries are just allocated and are not used yet because the code that uses
      them is skipped now.
      
      The next patches will convert MDB code to use PGT APIs. The allocation of
      indexes for multicast is done after FID code reserves 15K entries.
      Currently, legacy bridge model is used and firmware manages PGT table. That
      means that the indexes which are allocated using PGT API are too high when
      legacy bridge model is used. To not exceed firmware limitation for MDB
      entries, add an API that returns the correct 'mid_index', based on bridge
      model. For legacy model, subtract the number of flood entries from PGT
      index. Use it to write the correct MID to SMID register. This API will be
      used also from MDB code in the next patches.
      
      PGT should not be aware of MDB and FID different usage, this API is
      temporary and will be removed once unified bridge model will be used.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4abaa5cc
    • D
      net/funeth: Support for ethtool -m · f03c8a1e
      Dimitris Michailidis 提交于
      Add the FW command for reading port module memory pages and implement
      ethtool's get_module_eeprom_by_page operation.
      Signed-off-by: NDimitris Michailidis <dmichail@fungible.com>
      Link: https://lore.kernel.org/r/20220627182000.8198-1-dmichail@fungible.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      f03c8a1e
  2. 28 6月, 2022 20 次提交
  3. 27 6月, 2022 2 次提交
  4. 25 6月, 2022 2 次提交