From nobody Thu Sep 11 22:28:10 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1518EB64DD for ; Fri, 11 Aug 2023 08:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233190AbjHKIH7 (ORCPT ); Fri, 11 Aug 2023 04:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbjHKIH5 (ORCPT ); Fri, 11 Aug 2023 04:07:57 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C70C2130 for ; Fri, 11 Aug 2023 01:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691741236; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Xn0qkCPb+OG4etF/4CweACpxkW6uLvMKCcTztxKbaJE=; b=VnfqtzJ9/v7ZZzu2N8yB+eRRQFQoTKA7hd8xQylFY/Upnn4SoLsyv5MdixbWB+rjHXnvO1 b2sxLEwlsphkL/ID8VoVeokDrV7e1vUzNCcbuiaiFgOFxgBTjOMKtEK9hNl0QwJGdy517G 0ynVHDp6vP2eURmlWG8gs+QM0SAhgK8= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-210-qc9bPcduM_ec8uKxwdE44Q-1; Fri, 11 Aug 2023 04:07:09 -0400 X-MC-Unique: qc9bPcduM_ec8uKxwdE44Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 44AF51C06934; Fri, 11 Aug 2023 08:07:08 +0000 (UTC) Received: from swamp.redhat.com (unknown [10.45.224.150]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7C162166B25; Fri, 11 Aug 2023 08:07:05 +0000 (UTC) From: Petr Oros To: netdev@vger.kernel.org Cc: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Jacob.e.keller@intel.com, przemyslawx.patynowski@intel.com, kamil.maziarz@intel.com, dawidx.wesierski@intel.com, mateusz.palczewski@intel.com, slawomirx.laba@intel.com, norbertx.zulinski@intel.com, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, przemyslaw.kitszel@intel.com, horms@kernel.org Subject: [PATCH net v3 1/2] Revert "ice: Fix ice VF reset during iavf initialization" Date: Fri, 11 Aug 2023 10:07:01 +0200 Message-ID: <20230811080702.1254319-2-poros@redhat.com> In-Reply-To: <20230811080702.1254319-1-poros@redhat.com> References: <20230811080702.1254319-1-poros@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This reverts commit 7255355a0636b4eff08d5e8139c77d98f151c4fc. After this commit we are not able to attach VF to VM: virsh attach-interface v0 hostdev --managed 0000:41:01.0 --mac 52:52:52:52:= 52:52 error: Failed to attach interface error: Cannot set interface MAC to 52:52:52:52:52:52 for ifname enp65s0f0np= 0 vf 0: Resource temporarily unavailable ice_check_vf_ready_for_cfg() already contain waiting for reset. New condition in ice_check_vf_ready_for_reset() causing only problems. Fixes: 7255355a0636 ("ice: Fix ice VF reset during iavf initialization") Signed-off-by: Petr Oros Reviewed-by: Simon Horman Reviewed-by: Przemek Kitszel Reviewed-by: Jacob Keller Tested-by: Rafal Romanowski --- v3: added tags from previous reviews --- drivers/net/ethernet/intel/ice/ice_sriov.c | 8 ++++---- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 19 ------------------- drivers/net/ethernet/intel/ice/ice_vf_lib.h | 1 - drivers/net/ethernet/intel/ice/ice_virtchnl.c | 1 - 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_sriov.c b/drivers/net/ether= net/intel/ice/ice_sriov.c index 1f66914c7a202a..31314e7540f8cf 100644 --- a/drivers/net/ethernet/intel/ice/ice_sriov.c +++ b/drivers/net/ethernet/intel/ice/ice_sriov.c @@ -1131,7 +1131,7 @@ int ice_set_vf_spoofchk(struct net_device *netdev, in= t vf_id, bool ena) if (!vf) return -EINVAL; =20 - ret =3D ice_check_vf_ready_for_reset(vf); + ret =3D ice_check_vf_ready_for_cfg(vf); if (ret) goto out_put_vf; =20 @@ -1246,7 +1246,7 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_= id, u8 *mac) goto out_put_vf; } =20 - ret =3D ice_check_vf_ready_for_reset(vf); + ret =3D ice_check_vf_ready_for_cfg(vf); if (ret) goto out_put_vf; =20 @@ -1300,7 +1300,7 @@ int ice_set_vf_trust(struct net_device *netdev, int v= f_id, bool trusted) return -EOPNOTSUPP; } =20 - ret =3D ice_check_vf_ready_for_reset(vf); + ret =3D ice_check_vf_ready_for_cfg(vf); if (ret) goto out_put_vf; =20 @@ -1613,7 +1613,7 @@ ice_set_vf_port_vlan(struct net_device *netdev, int v= f_id, u16 vlan_id, u8 qos, if (!vf) return -EINVAL; =20 - ret =3D ice_check_vf_ready_for_reset(vf); + ret =3D ice_check_vf_ready_for_cfg(vf); if (ret) goto out_put_vf; =20 diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethe= rnet/intel/ice/ice_vf_lib.c index b26ce4425f4559..294e91c3453ccd 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -185,25 +185,6 @@ int ice_check_vf_ready_for_cfg(struct ice_vf *vf) return 0; } =20 -/** - * ice_check_vf_ready_for_reset - check if VF is ready to be reset - * @vf: VF to check if it's ready to be reset - * - * The purpose of this function is to ensure that the VF is not in reset, - * disabled, and is both initialized and active, thus enabling us to safely - * initialize another reset. - */ -int ice_check_vf_ready_for_reset(struct ice_vf *vf) -{ - int ret; - - ret =3D ice_check_vf_ready_for_cfg(vf); - if (!ret && !test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) - ret =3D -EAGAIN; - - return ret; -} - /** * ice_trigger_vf_reset - Reset a VF on HW * @vf: pointer to the VF structure diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.h b/drivers/net/ethe= rnet/intel/ice/ice_vf_lib.h index 67172fdd9bc27f..48fea6fa036210 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.h @@ -215,7 +215,6 @@ u16 ice_get_num_vfs(struct ice_pf *pf); struct ice_vsi *ice_get_vf_vsi(struct ice_vf *vf); bool ice_is_vf_disabled(struct ice_vf *vf); int ice_check_vf_ready_for_cfg(struct ice_vf *vf); -int ice_check_vf_ready_for_reset(struct ice_vf *vf); void ice_set_vf_state_dis(struct ice_vf *vf); bool ice_is_any_vf_in_unicast_promisc(struct ice_pf *pf); void diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c b/drivers/net/et= hernet/intel/ice/ice_virtchnl.c index efbc2968a7bf6a..dcf628b1fccd93 100644 --- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c @@ -3947,7 +3947,6 @@ void ice_vc_process_vf_msg(struct ice_pf *pf, struct = ice_rq_event_info *event, ice_vc_notify_vf_link_state(vf); break; case VIRTCHNL_OP_RESET_VF: - clear_bit(ICE_VF_STATE_ACTIVE, vf->vf_states); ops->reset_vf(vf); break; case VIRTCHNL_OP_ADD_ETH_ADDR: --=20 2.41.0