Skip to content

ice: convert VF storage to hash table

Jacob Keller intel-wired-lan 2 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 0 repliesNew
  2. v111 patches 0 repliesSuperseded

Changes in v2 from the cover letter

* Add missing ice_put_vf in ice_vc_process_vf_msg, fixing memory leak of VF
* Fix a few checkpatch.pl complaints reported by NIPA

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11ice: refactor unwind cleanup in eswitch modedrivers/net/ethernet/intel/ice/ice_eswitch.c drivers/net/ethernet/intel/ice/ice_repr.c+54 -561 reply
2/11ice: store VF pointer instead of VF IDdrivers/net/ethernet/intel/ice/ice.h drivers/net/ethernet/intel/ice/ice_base.c drivers/net/ethernet/intel/ice/ice_eswitch.c +7 more+142 -951 reply
3/11ice: pass num_vfs to ice_set_per_vf_res()drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c+26 -611 reply
4/11ice: move clear_malvf call in ice_free_vfsdrivers/net/ethernet/intel/ice/ice_virtchnl_pf.c+6 -71 reply
5/11ice: move VFLR acknowledge during ice_free_vfsdrivers/net/ethernet/intel/ice/ice_virtchnl_pf.c+8 -191 reply
6/11ice: remove checks in ice_vc_send_msg_to_vfdrivers/net/ethernet/intel/ice/ice_virtchnl_pf.c+3 -81 reply
7/11ice: use ice_for_each_vf for iteration during removaldrivers/net/ethernet/intel/ice/ice_virtchnl_pf.c+4 -51 reply
8/11ice: convert ice_for_each_vf to include VF entry iteratordrivers/net/ethernet/intel/ice/ice_eswitch.c drivers/net/ethernet/intel/ice/ice_ethtool.c drivers/net/ethernet/intel/ice/ice_lib.c +5 more+162 -1511 reply
9/11ice: factor VF variables to separate structuredrivers/net/ethernet/intel/ice/ice.h drivers/net/ethernet/intel/ice/ice_eswitch.c drivers/net/ethernet/intel/ice/ice_ethtool.c +4 more+83 -681 reply
10/11ice: introduce VF accessor functionsdrivers/net/ethernet/intel/ice/ice_eswitch.c drivers/net/ethernet/intel/ice/ice_ethtool.c drivers/net/ethernet/intel/ice/ice_lib.c +2 more+116 -541 reply
11/11ice: convert VF storage to hash table with krefs and RCUdrivers/net/ethernet/intel/ice/ice_eswitch.c drivers/net/ethernet/intel/ice/ice_ethtool.c drivers/net/ethernet/intel/ice/ice_lib.c +5 more+364 -1251 reply

Reviews trailers per patch

None of the 11 patches has a Reviewed-by or Acked-by.

PatchSandeep PenigalapatiKonrad Jankowski
1/11T-b
2/11T-b
3/11T-b
4/11T-b
5/11T-b
6/11T-b
7/11T-b
8/11T-b
9/11T-b
10/11T-b
11/11T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Intel-wired-lan] [net-next PATCH v2 00/11] ice: convert VF storage to hash table

This series refactors the ice networking driver VF storage from a simple static array to a hash table. It also introduces krefs and proper locking and protection to prevent common use-after-free and concurrency issues.

There are two motivations for this work. First is to make the ice driver more resilient by preventing a whole class of use-after-free bugs that can occur around concurrent access to VF structures while removing VFs.

The second is to prepare the ice driver for future virtualization work to support Scalable IOV, an alternative VF implementation compared to Single Root IOV. The new VF implementation will allow for more dynamic VF creation and removal, necessitating a more robust implementation for VF storage that can't rely on the existing mechanisms to prevent concurrent access violations.

The first few patches are cleanup and preparatory work needed to make the conversion to the hash table safe. Following this preparatory work is a patch to migrate the VF structures and variables to a new sub-structure for code clarity. Next introduce new interface functions to abstract the VF storage. Finally, the driver is actually converted to the hash table and kref implementation.

Changes since v1:
* Add missing ice_put_vf in ice_vc_process_vf_msg, fixing memory leak of VF
* Fix a few checkpatch.pl complaints reported by NIPA

Jacob Keller (11):
ice: refactor unwind cleanup in eswitch mode
ice: store VF pointer instead of VF ID
ice: pass num_vfs to ice_set_per_vf_res()
ice: move clear_malvf call in ice_free_vfs
ice: move VFLR acknowledge during ice_free_vfs
ice: remove checks in ice_vc_send_msg_to_vf
ice: use ice_for_each_vf for iteration during removal
ice: convert ice_for_each_vf to include VF entry iterator
ice: factor VF variables to separate structure
ice: introduce VF accessor functions
ice: convert VF storage to hash table with krefs and RCU

 drivers/net/ethernet/intel/ice/ice.h          |  13 +-
 drivers/net/ethernet/intel/ice/ice_base.c     |   4 +-
 drivers/net/ethernet/intel/ice/ice_eswitch.c  | 161 ++--
 drivers/net/ethernet/intel/ice/ice_ethtool.c  |  20 +-
 drivers/net/ethernet/intel/ice/ice_lib.c      | 203 +++--
 drivers/net/ethernet/intel/ice/ice_lib.h      |   3 +-
 drivers/net/ethernet/intel/ice/ice_main.c     |  64 +-
 drivers/net/ethernet/intel/ice/ice_repr.c     |  70 +-
 drivers/net/ethernet/intel/ice/ice_txrx.c     |   2 +-
 .../ethernet/intel/ice/ice_vf_vsi_vlan_ops.c  |  19 +-
 .../ethernet/intel/ice/ice_virtchnl_fdir.c    |  13 +-
 .../net/ethernet/intel/ice/ice_virtchnl_pf.c  | 784 +++++++++++-------
 .../net/ethernet/intel/ice/ice_virtchnl_pf.h  |  83 +-
 13 files changed, 879 insertions(+), 560 deletions(-)

base-commit: 477606a501d0705cb1bb86fe7aa86f553861ae7f

Signature · 1 line
2.35.1.129.gb80121027d12