[{"id":3683314,"web_url":"http://patchwork.ozlabs.org/comment/3683314/","msgid":"<f9fbc8c3-3b1d-456c-a389-4f95bf07822a@molgen.mpg.de>","list_archive_url":null,"date":"2026-04-28T09:44:50","subject":"Re: [Intel-wired-lan] [RFC PATCH] ice: allow creating VFs when\n !CONFIG_ICE_SWITCHDEV","submitter":{"id":70275,"url":"http://patchwork.ozlabs.org/api/people/70275/","name":"Paul Menzel","email":"pmenzel@molgen.mpg.de"},"content":"Dear Vincent,\n\n\nThank you for your patch.\n\nAm 27.04.26 um 05:11 schrieb Vincent Chen via Intel-wired-lan:\n> Currently ice_eswitch_attach_vf() is called unconditionally in\n> ice_start_vfs() and ice_reset_all_vfs(), which causes VF creation\n> to fail when CONFIG_ICE_SWITCHDEV is not defined or switchdev mode\n> is not enabled at runtime.\n\nI’d add a blank line between paragraphs.\n\n> Fix this by adding switchdev mode checks at the call sites before\n> calling ice_eswitch_attach_vf(), consistent with how\n> ice_eswitch_attach_sf() is already handled in ice_devlink_port_new().\n> Also remove the redundant check inside ice_eswitch_attach_vf() itself.\n\n*Also* is a good indicator to make it a separate patch. I’d favor this \nin this case.\n\n> This is similar to commit aacca7a83b97 (\"ice: allow creating VFs for\n> !CONFIG_NET_SWITCHDEV\") which fixed the same issue for the previous\n> ice_eswitch_configure() API.\n> \n> Signed-off-by: Vincent Chen <vincent.chen@sifive.com>\n> ---\n>   drivers/net/ethernet/intel/ice/ice_eswitch.c |  3 ---\n>   drivers/net/ethernet/intel/ice/ice_sriov.c   | 14 ++++++++------\n>   drivers/net/ethernet/intel/ice/ice_vf_lib.c  |  3 ++-\n>   3 files changed, 10 insertions(+), 10 deletions(-)\n> \n> diff --git a/drivers/net/ethernet/intel/ice/ice_eswitch.c b/drivers/net/ethernet/intel/ice/ice_eswitch.c\n> index 2e4f0969035f..c709decb26d5 100644\n> --- a/drivers/net/ethernet/intel/ice/ice_eswitch.c\n> +++ b/drivers/net/ethernet/intel/ice/ice_eswitch.c\n> @@ -512,9 +512,6 @@ int ice_eswitch_attach_vf(struct ice_pf *pf, struct ice_vf *vf)\n>   \tstruct ice_repr *repr;\n>   \tint err;\n>   \n> -\tif (!ice_is_eswitch_mode_switchdev(pf))\n> -\t\treturn 0;\n> -\n>   \trepr = ice_repr_create_vf(vf);\n>   \tif (IS_ERR(repr))\n>   \t\treturn PTR_ERR(repr);\n> diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ethernet/intel/ice/ice_sriov.c\n> index 843e82fd3bf9..6a0b724e46f9 100644\n> --- a/drivers/net/ethernet/intel/ice/ice_sriov.c\n> +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c\n> @@ -484,12 +484,14 @@ static int ice_start_vfs(struct ice_pf *pf)\n>   \t\t\tgoto teardown;\n>   \t\t}\n>   \n> -\t\tretval = ice_eswitch_attach_vf(pf, vf);\n> -\t\tif (retval) {\n> -\t\t\tdev_err(ice_pf_to_dev(pf), \"Failed to attach VF %d to eswitch, error %d\",\n> -\t\t\t\tvf->vf_id, retval);\n> -\t\t\tice_vf_vsi_release(vf);\n> -\t\t\tgoto teardown;\n> +\t\tif (ice_is_eswitch_mode_switchdev(pf)) {\n> +\t\t\tretval = ice_eswitch_attach_vf(pf, vf);\n> +\t\t\tif (retval) {\n> +\t\t\t\tdev_err(ice_pf_to_dev(pf), \"Failed to attach VF %d to eswitch, error %d\",\n> +\t\t\t\t\tvf->vf_id, retval);\n> +\t\t\t\tice_vf_vsi_release(vf);\n> +\t\t\t\tgoto teardown;\n> +\t\t\t}\n>   \t\t}\n>   \n>   \t\tset_bit(ICE_VF_STATE_INIT, vf->vf_states);\n> diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c\n> index de9e81ccee66..71595410174c 100644\n> --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c\n> +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c\n> @@ -807,7 +807,8 @@ void ice_reset_all_vfs(struct ice_pf *pf)\n>   \t\tice_vf_rebuild_vsi(vf);\n>   \t\tice_vf_post_vsi_rebuild(vf);\n>   \n> -\t\tice_eswitch_attach_vf(pf, vf);\n> +\t\tif (ice_is_eswitch_mode_switchdev(pf))\n> +\t\t\tice_eswitch_attach_vf(pf, vf);\n>   \n>   \t\tmutex_unlock(&vf->cfg_lock);\n>   \t}\n\nThe diff looks good.\n\n\nKind regards,\n\nPaul","headers":{"Return-Path":"<intel-wired-lan-bounces@osuosl.org>","X-Original-To":["incoming@patchwork.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","intel-wired-lan@lists.osuosl.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256\n header.s=default header.b=fNHkeRlF;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4bC624gyz1yHX\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 19:45:20 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 6EBF3406F6;\n\tTue, 28 Apr 2026 09:45:18 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id iLPGV36YtYS6; Tue, 28 Apr 2026 09:45:17 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id A3E3F406DD;\n\tTue, 28 Apr 2026 09:45:17 +0000 (UTC)","from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136])\n by lists1.osuosl.org (Postfix) with ESMTP id 3A58923D\n for <intel-wired-lan@lists.osuosl.org>; Tue, 28 Apr 2026 09:45:16 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp3.osuosl.org (Postfix) with ESMTP id 37D0460F63\n for <intel-wired-lan@lists.osuosl.org>; Tue, 28 Apr 2026 09:45:16 +0000 (UTC)","from smtp3.osuosl.org ([127.0.0.1])\n by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id VRjLaQ3oJzhR for <intel-wired-lan@lists.osuosl.org>;\n Tue, 28 Apr 2026 09:45:14 +0000 (UTC)","from mx3.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11])\n by smtp3.osuosl.org (Postfix) with ESMTPS id 4737C60F60\n for <intel-wired-lan@lists.osuosl.org>; Tue, 28 Apr 2026 09:45:13 +0000 (UTC)","from [141.14.220.42] (g42.guest.molgen.mpg.de [141.14.220.42])\n (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested) (Authenticated sender: pmenzel)\n by mx.molgen.mpg.de (Postfix) with ESMTPSA id 0A9F34C288718F;\n Tue, 28 Apr 2026 11:44:51 +0200 (CEST)"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp4.osuosl.org A3E3F406DD","OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4737C60F60"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org;\n\ts=default; t=1777369517;\n\tbh=hXPiyDd0ZkUo1HEJIGDPriqEgPNiky49ElRO6OeQArk=;\n\th=Date:To:Cc:References:From:In-Reply-To:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=fNHkeRlFiKVew9iwfi122F8ZZeZG9ECO3b6GljUslLr0RJ/kHUjSzIR1XqbQG4i1M\n\t 6Vo6c9wzzf+8/FMoKfLkChaLppozVzCbEYJQRifEJl3X6jzDnhA7BZbu+SZTThUX9R\n\t W5gQtEHegohiqmHlDQL/GTzKLTC30LJVJx5GvO9seyPyB+ZcpFl21UxPppIgg6ATll\n\t ikUKtGT9yZZjqLCLbM5Nv9qjUTzbOaemWH8xJrekrCl8Uyll5Z6cJTon6p5CpPk0wT\n\t gfLgSrmMaFtbCjSzyaGZ0GC5E00eusphpL54jNlaqV0zNN1z+yhPopI6Dda1dq7io1\n\t 3wgvohSwFdK+g==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=141.14.17.11;\n helo=mx3.molgen.mpg.de; envelope-from=pmenzel@molgen.mpg.de;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp3.osuosl.org 4737C60F60","Message-ID":"<f9fbc8c3-3b1d-456c-a389-4f95bf07822a@molgen.mpg.de>","Date":"Tue, 28 Apr 2026 11:44:50 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","To":"Vincent Chen <vincent.chen@sifive.com>","Cc":"anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,\n andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,\n kuba@kernel.org, pabeni@redhat.com, intel-wired-lan@lists.osuosl.org,\n netdev@vger.kernel.org","References":"<20260427031158.2665916-1-vincent.chen@sifive.com>","Content-Language":"en-US","From":"Paul Menzel <pmenzel@molgen.mpg.de>","In-Reply-To":"<20260427031158.2665916-1-vincent.chen@sifive.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","X-Mailman-Original-Authentication-Results":"smtp3.osuosl.org;\n dmarc=none (p=none dis=none)\n header.from=molgen.mpg.de","Subject":"Re: [Intel-wired-lan] [RFC PATCH] ice: allow creating VFs when\n !CONFIG_ICE_SWITCHDEV","X-BeenThere":"intel-wired-lan@osuosl.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>","List-Unsubscribe":"<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>","List-Archive":"<http://lists.osuosl.org/pipermail/intel-wired-lan/>","List-Post":"<mailto:intel-wired-lan@osuosl.org>","List-Help":"<mailto:intel-wired-lan-request@osuosl.org?subject=help>","List-Subscribe":"<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>","Errors-To":"intel-wired-lan-bounces@osuosl.org","Sender":"\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"}}]