From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 634F94D2ED5 for ; Fri, 9 Oct 2026 12:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791548115; cv=none; b=PyF7LQIf0VoDS7SHsGiCuH1TZJqngPzUD+yImojBBQJPtdHmfsTi/f/F4n8MLl+SiBeLQ/wlZ4a0v/8glFUYmeMA+fGngFwjcDTKXEcU2j7Jde3hNPy1RHF2HKZtebf0Q+KoFHEzHtSsJxkU6adIAetjwyAgFYf3Dd5hSqGLIQw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791548115; c=relaxed/simple; bh=rY0QkeYRoOMZmdDikz46iNQ7y9zutWnesKXcXX6WIeA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UtwK/OcUHhDcSgo60R6ZboLuyxj9QlYr8FXijAKKr/CEarSZ0VTK2aayPKbaxqnReGU0NN6AxBoFePQikUYENyrJax7Qn+pOTY0Usl/glV+Z/fCY5B/XSqAuliGuHoDKtvEJDPmoTmekKb3q7AStb1C7rGyirb9ENfvxJzWlItk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PsUXdF0L; arc=none smtp.client-ip=192.198.163.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PsUXdF0L" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1791548101; x=1823084101; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rY0QkeYRoOMZmdDikz46iNQ7y9zutWnesKXcXX6WIeA=; b=PsUXdF0LV/ow1SVzOeDfOZ03kDMUqWyuUsAYtgwzt3EvkClj37GU9R+2 VfTkmJh+1sERMziG+fsF52Z7P4jalxgaNCDkng0hNF+GXBluj4KO9EbDW dqb8fYh7KEQRGIBqnfzVU24ucwIVCotCsJBlo7Np7Fxl3YoIZ1SeKGUdw 4eaziByOphLauFggaIiwRQaM7X2xweRdoKzdNwU7uycUDKn+w8GvDX4Ay BPKdeG/0UWwPFQXRK0Hnoh+UoKk8Ae72hdvBz2u1TJY/TdVYe67dawHd6 SVUIAGA5kdYCckjwDUa4ZMYrpOusRDQNAGeQFygDfFLOWVeGTAfKiScmc g==; X-CSE-ConnectionGUID: JmAvRlYNRz6Q8TEdvtoXww== X-CSE-MsgGUID: Q4JWGIvRTqKD85BlrDTdcA== X-IronPort-AV: E=McAfee;i="6800,10657,11929"; a="251114" X-IronPort-AV: E=Sophos;i="6.27,148,1787036400"; d="scan'208";a="251114" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2026 05:14:53 -0700 X-CSE-ConnectionGUID: H08yDFpHQa+86x4f97v+5g== X-CSE-MsgGUID: ThWdLRPoQUaax9oLgX6+GQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,148,1787036400"; d="scan'208";a="420400" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa002.fm.intel.com with ESMTP; 09 Oct 2026 05:14:48 -0700 Received: from pkitszel-desk.tendawifi.com (unknown [10.245.245.238]) by irvmail002.ir.intel.com (Postfix) with ESMTP id 7E6E72FC43; Fri, 9 Oct 2026 13:14:44 +0100 (IST) From: Przemek Kitszel To: netdev@vger.kernel.org, Jakub Kicinski , Jiri Pirko Cc: Tony Nguyen , Aleksandr Loktionov , Michal Schmidt , intel-wired-lan@lists.osuosl.org, edumazet@kernel.org, horms@kernel.org, pabeni@redhat.com, davem@davemloft.net, Jonathan Corbet , skhan@linuxfoundation.org, rdunlap@infradead.org, andrew+netdev@lunn.ch, saeedm@nvidia.com, tariqt@nvidia.com, leon@kernel.org, mbloch@nvidia.com, jacob.e.keller@intel.com, jedrzej.jagielski@intel.com, anzaki@gmail.com, brett.creeley@amd.com, jtornosm@redhat.com, ohartoov@nvidia.com, Przemek Kitszel , Wojciech Drewek Subject: [PATCH net-next v2 03/14] ice: add VF queue ena/dis helper functions Date: Fri, 9 Oct 2026 14:04:14 +0200 Message-ID: <20261009121433.30347-4-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20261009121433.30347-1-przemyslaw.kitszel@intel.com> References: <20261009121433.30347-1-przemyslaw.kitszel@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Brett Creeley Add three new functions: - ice_vf_vsi_dis_single_rxq() - ice_vf_vsi_ena_single_rxq() - ice_vf_vsi_ena_single_txq() (ice_vf_vsi_dis_single_txq() was introduced earlier). Those functions wrap operations needed in the processes of enabling and disabling single Tx/Rx VF queue, which are: - check if the queue is not already in desired state - perform the dis/ena operations - bookkeeping of the queue's state. Future commit will use them from another callsite. Signed-off-by: Brett Creeley Signed-off-by: Wojciech Drewek Reviewed-by: Jedrzej Jagielski Reviewed-by: Aleksandr Loktionov Signed-off-by: Przemek Kitszel --- v2: * convert one comment to kdoc (Alex) * fix typos (Sashiko) * rebase: move ice_vf_dis_rxq_interrupt(), added to ice_vc_dis_qs_msg() by commit fb096882095e ("ice: fix VF interrupts cleanup"), into ice_vf_vsi_dis_single_rxq() --- drivers/net/ethernet/intel/ice/virt/queues.c | 117 ++++++++++++++----- 1 file changed, 89 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/virt/queues.c b/drivers/net/ethernet/intel/ice/virt/queues.c index ac7f98479b13..a22780575086 100644 --- a/drivers/net/ethernet/intel/ice/virt/queues.c +++ b/drivers/net/ethernet/intel/ice/virt/queues.c @@ -242,6 +242,57 @@ static void ice_vf_dis_rxq_interrupt(struct ice_vsi *vsi, u32 q_idx) ice_flush(hw); } +/** + * ice_vf_vsi_ena_single_rxq - enable single Rx queue based on relative q_id + * @vf: VF to enable queue for + * @vsi: VSI for the VF + * @q_id: VSI relative (0-based) queue ID + * + * Enable the Rx queue passed in. + * + * Return: 0 on success or negative on error. + */ +static int ice_vf_vsi_ena_single_rxq(struct ice_vf *vf, struct ice_vsi *vsi, + u16 q_id) +{ + int err; + + if (test_bit(q_id, vf->rxq_ena)) + return 0; + + err = ice_vsi_ctrl_one_rx_ring(vsi, true, q_id, true); + if (err) { + dev_err(ice_pf_to_dev(vsi->back), "Failed to enable Rx ring %d on VSI %d\n", + q_id, vsi->vsi_num); + return err; + } + + ice_vf_ena_rxq_interrupt(vsi, q_id); + set_bit(q_id, vf->rxq_ena); + + return 0; +} + +/** + * ice_vf_vsi_ena_single_txq - enable single Tx queue based on relative q_id + * @vf: VF to enable queue for + * @vsi: VSI for the VF + * @q_id: VSI relative (0-based) queue ID + * + * Enable the Tx queue's interrupt. Note that the Tx queue(s) should have + * already been configured/enabled in VIRTCHNL_OP_CONFIG_VSI_QUEUES so this + * function only enables the interrupt associated with the q_id. + */ +static void ice_vf_vsi_ena_single_txq(struct ice_vf *vf, struct ice_vsi *vsi, + u16 q_id) +{ + if (test_bit(q_id, vf->txq_ena)) + return; + + ice_vf_ena_txq_interrupt(vsi, q_id); + set_bit(q_id, vf->txq_ena); +} + /** * ice_vc_ena_qs_msg * @vf: pointer to the VF info @@ -290,34 +341,20 @@ int ice_vc_ena_qs_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - /* Skip queue if enabled */ - if (test_bit(vf_q_id, vf->rxq_ena)) - continue; - - if (ice_vsi_ctrl_one_rx_ring(vsi, true, vf_q_id, true)) { - dev_err(ice_pf_to_dev(vsi->back), "Failed to enable Rx ring %d on VSI %d\n", - vf_q_id, vsi->vsi_num); + if (ice_vf_vsi_ena_single_rxq(vf, vsi, vf_q_id)) { v_ret = VIRTCHNL_STATUS_ERR_PARAM; goto error_param; } - - ice_vf_ena_rxq_interrupt(vsi, vf_q_id); - set_bit(vf_q_id, vf->rxq_ena); } q_map = vqs->tx_queues; for_each_set_bit(vf_q_id, &q_map, ICE_MAX_RSS_QS_PER_VF) { if (!ice_vc_isvalid_q_id(vsi, vf_q_id)) { v_ret = VIRTCHNL_STATUS_ERR_PARAM; goto error_param; } - /* Skip queue if enabled */ - if (test_bit(vf_q_id, vf->txq_ena)) - continue; - - ice_vf_ena_txq_interrupt(vsi, vf_q_id); - set_bit(vf_q_id, vf->txq_ena); + ice_vf_vsi_ena_single_txq(vf, vsi, vf_q_id); } /* Set flag to indicate that queues are enabled */ @@ -369,6 +406,41 @@ int ice_vf_vsi_dis_single_txq(struct ice_vf *vf, struct ice_vsi *vsi, u16 q_id) return 0; } +/** + * ice_vf_vsi_dis_single_rxq - disable a Rx queue for VF on relative queue ID + * @vf: VF to disable queue for + * @vsi: VSI for the VF + * @q_id: VSI relative (0-based) queue ID + * + * Attempt to disable the Rx queue passed in. If the Rx queue was successfully + * disabled then clear q_id bit in the enabled queues bitmap. + * + * Return: 0 when queue was already disabled or disabling succeeded, otherwise + * negative error code. + */ +static int ice_vf_vsi_dis_single_rxq(struct ice_vf *vf, struct ice_vsi *vsi, + u16 q_id) +{ + int err; + + if (!test_bit(q_id, vf->rxq_ena)) + return 0; + + err = ice_vsi_ctrl_one_rx_ring(vsi, false, q_id, true); + if (err) { + dev_err(ice_pf_to_dev(vsi->back), "Failed to stop Rx ring %d on VSI %d\n", + q_id, vsi->vsi_num); + return err; + } + + ice_vf_dis_rxq_interrupt(vsi, q_id); + + /* Clear enabled queues flag */ + clear_bit(q_id, vf->rxq_ena); + + return 0; +} + /** * ice_vc_dis_qs_msg * @vf: pointer to the VF info @@ -433,21 +505,10 @@ int ice_vc_dis_qs_msg(struct ice_vf *vf, u8 *msg) goto error_param; } - /* Skip queue if not enabled */ - if (!test_bit(vf_q_id, vf->rxq_ena)) - continue; - - if (ice_vsi_ctrl_one_rx_ring(vsi, false, vf_q_id, - true)) { - dev_err(ice_pf_to_dev(vsi->back), "Failed to stop Rx ring %d on VSI %d\n", - vf_q_id, vsi->vsi_num); + if (ice_vf_vsi_dis_single_rxq(vf, vsi, vf_q_id)) { v_ret = VIRTCHNL_STATUS_ERR_PARAM; goto error_param; } - - ice_vf_dis_rxq_interrupt(vsi, vf_q_id); - /* Clear enabled queues flag */ - clear_bit(vf_q_id, vf->rxq_ena); } } -- 2.51.1