From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (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 E80B23E122D for ; Fri, 8 May 2026 12:59:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778245191; cv=none; b=ubV6KG1e3PGet3g41/GKvGKomYO6lpL1+mCbxK4K5n9M5o4ig3u4HkgoUFGyO0iax9Yq6zt3EhUSXC5NK4y/UHAVd2RoSoyHZJD6JPDDB9jsDflliydwPp4B+fW5DvzExUmrfUlI3GIhJRAKq3sxCTX/WukSJ4Neo0RavccAbOc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778245191; c=relaxed/simple; bh=748h7Xx8q52MKpfWxfAmxkATQ+6j/9UMHqUMByZ1RCg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rVxll7iX+5Hfs1SBofWaK1AqpN974qyl769Shn4FSpDDvZhBzylqqBH/H5qZwmas22EhR+D8qFhSSwln8blyAvUgLnJXKt/jSw1WJH4cJF2euTu96yv8t49vNmOyr+BBwbFonIiimXzs+BSHLmc1XqwNocFX9n0GcRY0d1lNzX0= 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=KQUcCuf4; arc=none smtp.client-ip=198.175.65.17 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="KQUcCuf4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778245189; x=1809781189; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=748h7Xx8q52MKpfWxfAmxkATQ+6j/9UMHqUMByZ1RCg=; b=KQUcCuf4y+rUeEDN+D4KzhKX60bYnXSHk116TsT2OY6yioGMZ3tBNHbn l2BUAoR4tbK0EHfflRRdDJUr+tEhzYsRiC3GX+me78o5x/NJ95XLpmSOW vRU3fWlz18kmF/NuIWb6YZRxgOgQqMY+KK067bXok0d9EHHXILNMEyvY+ JkSWYGeQWXOkYnzBaJrynwNmgwOq+OP4Y3GWIAx9xsQC57CP6gmEf1YUr fwUT1S7lLxo0mR8J/3kWE7pCg4nkBxtPXBmWWHNU3s4IqXJeSMbDpurLs AiSMbt5nW6HqRsBWcfoeVYf1mfcjEqUWcPO3PwL/7CxdJUft7GiP31JEr g==; X-CSE-ConnectionGUID: nblD3cLFSBeC/pBqiXGs9Q== X-CSE-MsgGUID: uJF4i2o8SsCMj7ug64lZNg== X-IronPort-AV: E=McAfee;i="6800,10657,11779"; a="79199882" X-IronPort-AV: E=Sophos;i="6.23,223,1770624000"; d="scan'208";a="79199882" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 May 2026 05:59:49 -0700 X-CSE-ConnectionGUID: QdjmrR3XRauMd4Hx955Iaw== X-CSE-MsgGUID: Q/BjC+khSZ6c8iMpu/HHsQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,223,1770624000"; d="scan'208";a="241730112" Received: from irvmail002.ir.intel.com ([10.43.11.120]) by fmviesa005.fm.intel.com with ESMTP; 08 May 2026 05:59:43 -0700 Received: from vecna.igk.intel.com (vecna.igk.intel.com [10.123.220.17]) by irvmail002.ir.intel.com (Postfix) with ESMTP id DBA4E2FC40; Fri, 8 May 2026 13:59:40 +0100 (IST) From: Przemek Kitszel To: intel-wired-lan@lists.osuosl.org, Michal Schmidt , Jakub Kicinski , Jiri Pirko Cc: netdev@vger.kernel.org, Simon Horman , Tony Nguyen , Michal Swiatkowski , bruce.richardson@intel.com, Vladimir Medvedkin , padraig.j.connolly@intel.com, ananth.s@intel.com, timothy.miskell@intel.com, Jacob Keller , Lukasz Czapnik , Aleksandr Loktionov , Andrew Lunn , "David S. Miller" , Eric Dumazet , Paolo Abeni , Saeed Mahameed , Leon Romanovsky , Tariq Toukan , Mark Bloch , Przemek Kitszel , Wojciech Drewek , Jedrzej Jagielski Subject: [PATCH iwl-next v1 04/15] ice: add VF queue ena/dis helper functions Date: Fri, 8 May 2026 14:41:57 +0200 Message-Id: <20260508124208.11622-5-przemyslaw.kitszel@intel.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20260508124208.11622-1-przemyslaw.kitszel@intel.com> References: <20260508124208.11622-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 Signed-off-by: Przemek Kitszel --- drivers/net/ethernet/intel/ice/virt/queues.c | 111 ++++++++++++++----- 1 file changed, 84 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/virt/queues.c b/drivers/net/ethernet/intel/ice/virt/queues.c index 6e4ec681fd07..28adc24197b8 100644 --- a/drivers/net/ethernet/intel/ice/virt/queues.c +++ b/drivers/net/ethernet/intel/ice/virt/queues.c @@ -224,6 +224,57 @@ void ice_vf_ena_rxq_interrupt(struct ice_vsi *vsi, u32 q_idx) wr32(hw, QINT_RQCTL(pfq), reg | QINT_RQCTL_CAUSE_ENA_M); } +/** + * 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 configurated/enabled in VIRTCHNL_OP_CONFIG_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 @@ -272,34 +323,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 */ @@ -351,6 +388,36 @@ 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. + */ +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; + } + + /* Clear enabled queues flag */ + clear_bit(q_id, vf->rxq_ena); + + return 0; +} + /** * ice_vc_dis_qs_msg * @vf: pointer to the VF info @@ -415,20 +482,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; } - - /* Clear enabled queues flag */ - clear_bit(vf_q_id, vf->rxq_ena); } } -- 2.39.3