From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 0A6863A3E70 for ; Fri, 17 Apr 2026 14:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776436201; cv=none; b=jI3/nmezBg4aNT2G7/zcPCxGrYX2XklCJ54YbrQwuQmKnQvTyc5gNVM4My0IPL0BO3iOoYcT4xdj6awoOGoGUIaZBtijWY/ixAe3Xdi7+tIFuLgkHYM1lWr+cMXARdWomW+YdC9Ocuxd+PZWuISJvspIYliObmLyltEG1i0KNag= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776436201; c=relaxed/simple; bh=0/nEBvM4cY5ipeHrSsqnHHf/O8yooGqk2vvyuWHCsRQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KC7O5d2LjcOq6eqhqFXdAxUqNLEMtOSiKNXHLkettGF8yJ+I3CWEd/Rvfdu0nWVd3rsr91nWA/Ex9mF43dRqr9FSgTbb4fvCNtgRbASWOolEywPXtUfBm7oK0DZctiIe+dnIi4EHL5eOejzPHFkHChkuAOCeTLXOs6jlCwMPMzU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=ZR4iWsWe; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="ZR4iWsWe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776436199; 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; bh=QhuUMlw5oI66yhDBof2Uk4e9WvcaXPJJJdM3yIvPUsw=; b=ZR4iWsWe5onFBaYLdnwj7H+oXjE5hpeIjvTjf2vipFdt89zSZwcy4rxWzD2UPrz3zUG9Lx WMAoCS2seBz8LfI33jADh7Uir4uyVQN1Dwb6C4NoVz1U9Bs5JDhn+i9/6uVPZoWFW/Xzxt 3YN/gpevb/qyh2pjHf85iWGX0+lg+Ms= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-209-IUGfYR2MOca36ebwIRMVDg-1; Fri, 17 Apr 2026 10:29:54 -0400 X-MC-Unique: IUGfYR2MOca36ebwIRMVDg-1 X-Mimecast-MFC-AGG-ID: IUGfYR2MOca36ebwIRMVDg_1776436192 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2E861195609E; Fri, 17 Apr 2026 14:29:52 +0000 (UTC) Received: from ShadowPeak.redhat.com (unknown [10.44.32.76]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7438C18004AD; Fri, 17 Apr 2026 14:29:47 +0000 (UTC) From: Petr Oros To: netdev@vger.kernel.org Cc: Petr Oros , Tony Nguyen , Przemek Kitszel , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jesse Brandeburg , Mitch Williams , Aaron Brown , Przemyslaw Patynowski , Jedrzej Jagielski , intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, jacob.e.keller@intel.com Subject: [PATCH iwl-net v2 0/4] iavf: fix VLAN filter state machine races Date: Fri, 17 Apr 2026 16:29:41 +0200 Message-ID: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 The iavf VLAN filter state machine has several design issues that lead to race conditions between userspace add/del calls and the watchdog task's virtchnl processing. Filters can get lost or leak HW resources, especially during interface down/up cycles and namespace moves. The root problems: 1) On interface down, all VLAN filters are sent as DEL to PF and re-added on interface up. This is unnecessary and creates multiple race windows (details below). 2) The DELETE path immediately frees the filter struct after sending the DEL message, without waiting for PF confirmation. If the PF rejects the DEL, the filter remains in HW but the driver lost its tracking structure. Race conditions between a pending DEL and add/reset operations cannot be resolved because the struct is gone. 3) VIRTCHNL_OP_ADD_VLAN (V1) had no success completion handler, so filters stayed in IS_NEW state permanently. Why removing VLAN filters on down/up is unnecessary: Unlike MAC filters, which need to be re-evaluated on up because the PF can administratively change the MAC address during down, VLAN filters are purely user-controlled. The PF cannot change them while the VF is down. When the VF goes down, VIRTCHNL_OP_DISABLE_QUEUES stops all traffic; VLAN filters sitting in PF HW are harmless because no packets flow through the disabled queues. Compare with other filter types in iavf_down(): - MAC filters: only the current MAC is removed (it gets re-read from PF on up in case it was administratively changed) - Cloud filters: left as-is across down/up - FDIR filters: left as-is across down/up VLAN filters were the only type going through a full DEL+ADD cycle, and this caused real problems: - With spoofcheck enabled, the PF activates TX VLAN anti-spoof on the first non-zero VLAN ADD. During the re-add phase after up, the filter list is transiently incomplete; traffic for VLANs not yet re-added gets dropped by anti-spoof. - Rapid down/up can overlap with pending DEL messages. The old code used DISABLE/INACTIVE states to track this, but the DISABLE state could overwrite a concurrent REMOVE from userspace, causing the filter to be restored instead of deleted. - Namespace moves trigger implicit ndo_vlan_rx_kill_vid() calls concurrent with the down/up sequence. The DEL from the namespace teardown races with the DISABLE from iavf_down(), and the filter can end up leaked in num_vlan_filters with no associated netdev. After reset, VF-configured VLAN filters are properly re-added via the VIRTCHNL_OP_GET_VF_RESOURCES / GET_OFFLOAD_VLAN_V2_CAPS response handlers, which unconditionally set all filters to ADD state. This path is unaffected by these changes. This series addresses all three issues: Patch 1 renames IS_NEW to ADDING for clarity. Patch 2 removes the DISABLE/INACTIVE state machinery so VLAN filters stay ACTIVE across down/up cycles. This is the core behavioral change; VLAN filters are no longer sent as DEL to PF on interface down, and iavf_restore_filters() is removed since there is nothing to restore. Patch 3 adds a REMOVING state to make the DELETE path symmetric with ADD; filters are only freed after PF confirms the deletion. If the PF rejects the DEL, the filter reverts to ACTIVE instead of being lost. Patch 4 hardens the remaining race windows: adds V1 ADD success handler and prevents redundant DEL on filters already in REMOVING state. v2: Retarget from iwl-next to iwl-net; these are bug fixes. Rebase on current net tree (conflict resolved). Petr Oros (4): iavf: rename IAVF_VLAN_IS_NEW to IAVF_VLAN_ADDING iavf: stop removing VLAN filters from PF on interface down iavf: wait for PF confirmation before removing VLAN filters iavf: add VIRTCHNL_OP_ADD_VLAN to success completion handler drivers/net/ethernet/intel/iavf/iavf.h | 9 +-- drivers/net/ethernet/intel/iavf/iavf_main.c | 52 +++---------- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 76 +++++++++---------- 3 files changed, 52 insertions(+), 85 deletions(-) -- 2.52.0