From nobody Fri Sep 25 07:57:22 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.3]) (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 A3A5039792B; Tue, 15 Sep 2026 10:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789467145; cv=none; b=P3KkmxM8GDwM8SU87Tw0D+mjIGH9Ti/ZxgxvWvA4cxyutvhz6rz6jDru5THadfafDRSKLPgArJJTEvkm+DMYgjvGsuaac7bhO2NfZg7JGvHsSEiiKY+eDUurZxHr1ur3fLxqGmxiGhiMnlfzrCcH22UnUYZSsgT+bVuQMfAnfhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789467145; c=relaxed/simple; bh=Pyaor3OexTPbvVE2eALaC6NSiFgHwqvaYEtSZvsceZA=; h=Content-Type:MIME-Version:From:To:Cc:Subject:Date:Message-ID; b=uKfQ8vCpTtshVKrila4f8udF4uMj3cAqfMA6wf5TtV7IAq3acxXV6TsmbXv7D1jhoyEP0xJz+yvuTGyCm+Lj03LpEdu8YuYHru+UlQ+2j+bnZ5d7luQLZvWnCWXEiXIhuV5+XM/vkHl+L1ZhGgZNaFyPfKAp8JY066dLw3ZXN8I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=DwmM9Wkw; arc=none smtp.client-ip=220.197.31.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="DwmM9Wkw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Content-Type:MIME-Version:From:To:Subject:Date: Message-ID; bh=Pyaor3OexTPbvVE2eALaC6NSiFgHwqvaYEtSZvsceZA=; b=D wmM9WkwbqD6wf+DfxVcx/AiH0NUxH820D/BT0haRQXWkDRBjvjM8JDck/wzDVFtV FPkOvqnsxkAe8g0wOYQDhL1puByb7XnZdMSebxQE2zjMbpQtVZxD44xk3m5ttVXn E0lbfpRPup0bcDMlZZuaIfPQR7KgjdZtOjPlAEDl4M= Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tian Run <15503232150@163.com> To: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org Cc: Tony Nguyen , Przemek Kitszel , Andrew Lunn , David S. Miller , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net-next] i40e: fix VF queue mapping collision with PF queue 0 Date: Tue, 15 Sep 2026 18:11:18 +0800 Message-ID: <178946707899.849053.3626754711268331752@bigrain> X-CM-TRANSID: _____wBn+6vHGalqxkDoAg--.261S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxJryDWF15WrWxtry5Wr1xXwb_yoW8urW3pr WUCryYk34kXF4rW3yjga109Fn3Awn5KrW5WF4ftwn09a9IkF4UXF1UKayagry8ArZ5ta13 tFZrArW7Cr4DJ3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jb189UUUUU= X-CM-SenderInfo: jprvkiqtstjiivq6il2tof0z/xtbC4Ap9cmqpGco7ggAA3M i40e_vsi_setup() limits the queue pairs of an SRIOV VSI to pf->num_lan_msix and fills info.queue_mapping[] only for that many entries, leaving the rest zeroed. i40e_vc_get_pf_queue_id() resolves such an entry to absolute queue 0, which belongs to the PF itself. i40e_config_vsi_tx_queue() then overwrites the PF's queue 0 context with the VF's ring and re-programs QTX_CTL(0) into VF mode. The PF's next transmit on queue 0 wedges the queue: the device stops it, reports a Malicious Driver Detection event without a valid event ID, sets both PF_MDET_TX and VP_MDET_TX and the PF enters a NETDEV WATCHDOG / reset loop. alloc_queue_pairs is set to pf->num_vf_qps, so GET_VF_RESOURCES advertises the full count and a VF with more online CPUs than the PF's num_lan_msix (e.g. a 4-CPU guest on a 3-CPU host) configures the extra queue pair and hits the unprogrammed mapping entry. Clamp alloc_queue_pairs by num_lan_msix like i40e_vsi_setup() does, so the VF is only offered queue pairs whose mapping was programmed. Fixes: 1563f2d2e012 ("i40e: Do not allow use more TC queue pairs than MSI-X= vectors exist") Signed-off-by: Tian Run <15503232150@163.com> --- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethe= rnet/intel/i40e/i40e_main.c index abbc71e81..2934862da 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -11443,6 +11443,12 @@ static int i40e_set_num_rings_in_vsi(struct i40e_v= si *vsi) =20 case I40E_VSI_SRIOV: vsi->alloc_queue_pairs =3D pf->num_vf_qps; + /* i40e_vsi_setup() limits queue pairs to num_lan_msix; + * keep alloc_queue_pairs consistent with that limit. + */ + if (test_bit(I40E_FLAG_MSIX_ENA, pf->flags)) + vsi->alloc_queue_pairs =3D + min_t(u16, pf->num_vf_qps, pf->num_lan_msix); if (!vsi->num_tx_desc) vsi->num_tx_desc =3D ALIGN(I40E_DEFAULT_NUM_DESCRIPTORS, I40E_REQ_DESCRIPTOR_MULTIPLE); --=20 2.43.0