From nobody Fri Jul 18 19:16:17 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bkKJy6fmdz62gV6; Fri, 18 Jul 2025 19:16:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bkKJy0XcNz42Fh; Fri, 18 Jul 2025 19:16:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752866178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FWqc6neON3ymTgPmI/9PYIOfplviVSGnKyrW/yZMwws=; b=M9PKbrtHOftyhjw1ecL1oWKmmu9Q+eGo14TkwSU2SmSu3ingTyudPzH6KY6eAwlJ8NIn2i 1HMrDoTLcGrGWk9F6pVn5AfALXInoxqADSMaJSkxKYHO9uYiXhHdkcHEatm7lUwEANat97 NdTLAYFQO3DFTUsiEQwAJyvVLz/VOT+yq2zeNT1HWgAVxLflMRqCylPtnmi2rfYZF4Zsm8 6f94hHEC/7QGBuecEeIm+cmJk0pYk6SkMJh1FUKcVmCF8dpMcJcBP3TTL3+Smb5PSARJGp s5jDhK5TVfUP0m4XIxrWtlWG57kgpVxQfNmgOz6BmFq4OXHJFlBwnUnCzgruxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752866178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=FWqc6neON3ymTgPmI/9PYIOfplviVSGnKyrW/yZMwws=; b=dGn5+QwPYPNrNLHQil18DoKi2ZIvr9jfwF/L1gUoEGTCPpLkWWcf7hH2PPkM4QJ8fo42vK BF4hZDL+Baw3mltxM/leX3PuMAecPJ+VxdlDuoMZ03EZ+42q8HFqArl3nT+TJaURMQlTVj NNl/kmDcYsLInrcpANjasRgFqoT6F71UaF/08zD7qcAEV5V0HeZIddHcPEIZlXvzPalToz fYTQ7NKhueOPfkhA78arvUU3BVKtibzlRPrU3oZDPGHYMJVlfuVRcwPCvqEHjXCNeWxays SocIPhEzbSCSsf8vU83/yvKSAucB9dKcN/kOpUtG8ZUhhvqohb1akZe6U81YyQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752866178; a=rsa-sha256; cv=none; b=Qt5UAxVXfrGIDlHwG+fnqVmJbQXNjRBW0oRVQcC5vVZtaEfuid013+iR5+ksDFVwoIlHeh USAwxNUJZL1LJVXgQg3uFCqa0jPP7X4iS0VHO7/XVqCH0BrfUC00hfChqjC2V+ArKx80og QoN0g9ASTo99a89nvePXSX+vgppsoOkQeOrUg6Xg6dGtkQQHJJ/A14UdNodCGVOZtMmnMb bgY9YJpQFVdrZOZEFW+KJo0nE0p66zkDOZf+AKeC84IL8eSW9CPjvKq5IBAC2P7vWoo7hH cj5Kx7MH3s4X1zPzeVmUne8TH3b14yZGaHrd+Ra9BjMuaYy+seHjxXmPkWHGFA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bkKJx71Ptztl5; Fri, 18 Jul 2025 19:16:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56IJGHRL001015; Fri, 18 Jul 2025 19:16:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56IJGHjt001012; Fri, 18 Jul 2025 19:16:17 GMT (envelope-from git) Date: Fri, 18 Jul 2025 19:16:17 GMT Message-Id: <202507181916.56IJGHjt001012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: d6958f3faec0 - main - ice(4): Fix re-enabling VF queues List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d6958f3faec023dfb7be5c01133c1a70c779e7b5 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d6958f3faec023dfb7be5c01133c1a70c779e7b5 commit d6958f3faec023dfb7be5c01133c1a70c779e7b5 Author: Krzysztof Galazka AuthorDate: 2025-03-06 21:47:31 +0000 Commit: Warner Losh CommitDate: 2025-07-18 19:16:16 +0000 ice(4): Fix re-enabling VF queues On receiving a virtual channel request from VF driver tried to configure and enable Tx and Rx queues without making sure that they were disabled. It caused issue with reloading a VF driver without a reset e.g. in case it crashed. Fix that by always disabling all Rx and Tx queues. While at that make sure that only queues requested by VF driver are enabled. VF driver may use less queues than assigned to the function when it was created. Signed-off-by: Krzysztof Galazka Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1573 --- sys/dev/ice/ice_iov.c | 31 ++++++++++++++++++++++++++----- sys/dev/ice/ice_lib.c | 8 ++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/sys/dev/ice/ice_iov.c b/sys/dev/ice/ice_iov.c index af0bef7bf2f0..3785a6c8dd13 100644 --- a/sys/dev/ice/ice_iov.c +++ b/sys/dev/ice/ice_iov.c @@ -925,7 +925,9 @@ ice_vc_cfg_vsi_qs_msg(struct ice_softc *sc, struct ice_vf *vf, u8 *msg_buf) struct virtchnl_queue_pair_info *vqpi; enum virtchnl_status_code status = VIRTCHNL_STATUS_SUCCESS; struct ice_vsi *vsi = vf->vsi; - int error = 0; + struct ice_tx_queue *txq; + struct ice_rx_queue *rxq; + int i, error = 0; vqci = (struct virtchnl_vsi_queue_config_info *)msg_buf; @@ -935,11 +937,30 @@ ice_vc_cfg_vsi_qs_msg(struct ice_softc *sc, struct ice_vf *vf, u8 *msg_buf) goto done; } - vqpi = vqci->qpair; - for (int i = 0; i < vqci->num_queue_pairs; i++, vqpi++) { - struct ice_tx_queue *txq; - struct ice_rx_queue *rxq; + ice_vsi_disable_tx(vf->vsi); + ice_control_all_rx_queues(vf->vsi, false); + + /* + * Clear TX and RX queues config in case VF + * requests different number of queues. + */ + for (i = 0; i < vsi->num_tx_queues; i++) { + txq = &vsi->tx_queues[i]; + + txq->desc_count = 0; + txq->tx_paddr = 0; + txq->tc = 0; + } + for (i = 0; i < vsi->num_rx_queues; i++) { + rxq = &vsi->rx_queues[i]; + + rxq->desc_count = 0; + rxq->rx_paddr = 0; + } + + vqpi = vqci->qpair; + for (i = 0; i < vqci->num_queue_pairs; i++, vqpi++) { /* Initial parameter validation */ if (vqpi->txq.vsi_id != vf->vsi->idx || vqpi->rxq.vsi_id != vf->vsi->idx || diff --git a/sys/dev/ice/ice_lib.c b/sys/dev/ice/ice_lib.c index 3e8b9c85c5ae..442111e5ffaf 100644 --- a/sys/dev/ice/ice_lib.c +++ b/sys/dev/ice/ice_lib.c @@ -1675,6 +1675,10 @@ ice_cfg_vsi_for_tx(struct ice_vsi *vsi) struct ice_tlan_ctx tlan_ctx = { 0 }; struct ice_tx_queue *txq = &vsi->tx_queues[i]; + /* Last configured queue */ + if (txq->desc_count == 0) + break; + pf_q = vsi->tx_qmap[txq->me]; qg->txqs[0].txq_id = htole16(pf_q); @@ -1803,6 +1807,10 @@ ice_cfg_vsi_for_rx(struct ice_vsi *vsi) for (i = 0; i < vsi->num_rx_queues; i++) { MPASS(vsi->mbuf_sz > 0); + /* Last configured queue */ + if (vsi->rx_queues[i].desc_count == 0) + break; + err = ice_setup_rx_ctx(&vsi->rx_queues[i]); if (err) return err;