ice: allow creating VFs when !CONFIG_ICE_SWITCHDEV
authorVincent Chen <vincent.chen@sifive.com>
Fri, 17 Jul 2026 18:53:23 +0000 (11:53 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 23 Jul 2026 16:00:50 +0000 (09:00 -0700)
commit99d0f42b0e5c57e4c02070a908aaff082881293a
tree7bd6aa6bf5d9d784af7910a14c42628d709eac9f
parent440e274da4d1b93c7df2cb0ce893c3009dd4db55
ice: allow creating VFs when !CONFIG_ICE_SWITCHDEV

Currently ice_eswitch_attach_vf() is called unconditionally in
ice_start_vfs(), which causes VF creation to fail when CONFIG_ICE_SWITCHDEV
is not defined.

Fix this by adding switchdev mode checks at the call sites before
calling ice_eswitch_attach_vf(), consistent with how
ice_eswitch_attach_sf() is already handled in ice_devlink_port_new().
This is similar to commit aacca7a83b97 ("ice: allow creating VFs for
!CONFIG_NET_SWITCHDEV") which fixed the same issue for the previous
ice_eswitch_configure() API.

Fixes: 415db8399d06 ("ice: make representor code generic")
Signed-off-by: Vincent Chen <vincent.chen@sifive.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Link: https://patch.msgid.link/20260717185340.3595286-2-anthony.l.nguyen@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/intel/ice/ice_eswitch.c
drivers/net/ethernet/intel/ice/ice_sriov.c
drivers/net/ethernet/intel/ice/ice_vf_lib.c