From nobody Wed Jun 10 18:53:11 2026 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 CE09539448A for ; Fri, 17 Apr 2026 14:30:05 +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=1776436209; cv=none; b=CBMri9mflBjoaV/HJre5dxCuZLwx3mVjgF8q/BMqhiMMcNJwoSAlsWTG11MTmVnlN/7B3NiMyx1PJd/ItdoXwd9FzjERiNMWtmqIsGnlXhsvi0tJ6V1Bi0KxMHusj126MNGQ/OETWVKPA/hbZ5qZz2IBYqJWPqTY3qlzFlMwK/c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776436209; c=relaxed/simple; bh=b32TMjqpB+Mkbodtfv9qU7P5wtvOpUPeFkkYtVB3N5Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MQkEGASYR7aI3EWJZl1/dZcBWNNsQbxDuTNfJSjfnCT6DYD1KKgSUzkr+O+Knv/zarMVNQ0/R9rneJGk2t6zsOL3JER2YBIsRBzky82c+WcM0+oK0focSbs6svwdkEhrsYYaeEO7a4fvPdbyFwACW7roBNVqvz9xx9Ara2vc4I4= 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=iAkrG0af; 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="iAkrG0af" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776436204; 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: in-reply-to:in-reply-to:references:references; bh=9XufRVi0wGB5ho91Fnl2bIgfWqQRanSan8O19a66JEE=; b=iAkrG0afDhEWnyyZaCruEp9QYbgDg8rI9quC9b7QRHqK4fYy6ZfbH0GfQXT1umnOTGpaPc 5qVrDzB6QY6nXUtqQVIOx+PJ4DOdYSjPZvV6F1C+DYsemwLL0LGhiQ25p6yajh5PqDSzXJ zEoqRo7COfGHxttTCpFRrYRR/B/uvAQ= 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-59-LEoEvaA2MJG6zhlnIHLu1g-1; Fri, 17 Apr 2026 10:29:59 -0400 X-MC-Unique: LEoEvaA2MJG6zhlnIHLu1g-1 X-Mimecast-MFC-AGG-ID: LEoEvaA2MJG6zhlnIHLu1g_1776436197 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 0BDF119560A2; Fri, 17 Apr 2026 14:29:57 +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 76428180047F; Fri, 17 Apr 2026 14:29:52 +0000 (UTC) From: Petr Oros To: netdev@vger.kernel.org Cc: Petr Oros , Aleksandr Loktionov , Rafal Romanowski , 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 1/4] iavf: rename IAVF_VLAN_IS_NEW to IAVF_VLAN_ADDING Date: Fri, 17 Apr 2026 16:29:42 +0200 Message-ID: <6540626e6ac177033834b1679fc0ab5601a4ed55.1776426683.git.poros@redhat.com> In-Reply-To: References: 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Content-Type: text/plain; charset="utf-8" Rename the IAVF_VLAN_IS_NEW state to IAVF_VLAN_ADDING to better describe what the state represents: an ADD request has been sent to the PF and is waiting for a response. This is a pure rename with no behavioral change, preparing for a cleanup of the VLAN filter state machine. Signed-off-by: Petr Oros Reviewed-by: Aleksandr Loktionov Tested-by: Rafal Romanowski Reviewed-by: Przemek Kitszel --- drivers/net/ethernet/intel/iavf/iavf.h | 2 +- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/= intel/iavf/iavf.h index e9fb0a0919e376..47a862ca5e2c3f 100644 --- a/drivers/net/ethernet/intel/iavf/iavf.h +++ b/drivers/net/ethernet/intel/iavf/iavf.h @@ -158,7 +158,7 @@ struct iavf_vlan { enum iavf_vlan_state_t { IAVF_VLAN_INVALID, IAVF_VLAN_ADD, /* filter needs to be added */ - IAVF_VLAN_IS_NEW, /* filter is new, wait for PF answer */ + IAVF_VLAN_ADDING, /* ADD sent to PF, waiting for response */ IAVF_VLAN_ACTIVE, /* filter is accepted by PF */ IAVF_VLAN_DISABLE, /* filter needs to be deleted by PF, then marked INACT= IVE */ IAVF_VLAN_INACTIVE, /* filter is inactive, we are in IFF_DOWN */ diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/= ethernet/intel/iavf/iavf_virtchnl.c index a52c100dcbc56d..6b06ae872a0cdf 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c @@ -746,7 +746,7 @@ static void iavf_vlan_add_reject(struct iavf_adapter *a= dapter) =20 spin_lock_bh(&adapter->mac_vlan_list_lock); list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { - if (f->state =3D=3D IAVF_VLAN_IS_NEW) { + if (f->state =3D=3D IAVF_VLAN_ADDING) { list_del(&f->list); kfree(f); adapter->num_vlan_filters--; @@ -812,7 +812,7 @@ void iavf_add_vlans(struct iavf_adapter *adapter) if (f->state =3D=3D IAVF_VLAN_ADD) { vvfl->vlan_id[i] =3D f->vlan.vid; i++; - f->state =3D IAVF_VLAN_IS_NEW; + f->state =3D IAVF_VLAN_ADDING; if (i =3D=3D count) break; } @@ -874,7 +874,7 @@ void iavf_add_vlans(struct iavf_adapter *adapter) vlan->tpid =3D f->vlan.tpid; =20 i++; - f->state =3D IAVF_VLAN_IS_NEW; + f->state =3D IAVF_VLAN_ADDING; } } =20 @@ -2910,7 +2910,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *ad= apter, =20 spin_lock_bh(&adapter->mac_vlan_list_lock); list_for_each_entry(f, &adapter->vlan_filter_list, list) { - if (f->state =3D=3D IAVF_VLAN_IS_NEW) + if (f->state =3D=3D IAVF_VLAN_ADDING) f->state =3D IAVF_VLAN_ACTIVE; } spin_unlock_bh(&adapter->mac_vlan_list_lock); --=20 2.52.0 From nobody Wed Jun 10 18:53:11 2026 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 EE1DE3B3898 for ; Fri, 17 Apr 2026 14:30:12 +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=1776436214; cv=none; b=faGGcTFYDyxeqQujnCND6s65NOvEDmxNrRE6aA++R0k22wj2ANE2A2FE+TxBOmGhf/cQbNdyeyfK2rT0uJw9C746OHWNheM24jlnUJNCPLY+taY1ClZ6lFKhmycZCgr8pCBhIyQrKx893yT/B1pjGD0d/2lgD4W5PbK3OjzwCFI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776436214; c=relaxed/simple; bh=OeXZTygGdeW/yXGB92JtqKAHSmJIq/9AaxG3VZZtM5s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jVKaE1qauEs1pgxZ6BTogRxPY1Gr1GW5fWY8GMvJ73UYzmpOm9s2XRylh/XP9KU61z524r/c0fY2oUHZH02xk8BMFHHvrBLdKVs/0stWHGwWErLmtms3kzqs0vNcu1Q0yr/42zHKBaX4lFavQyn/Gcq/OcOTx4wFVejM7ZBJfBY= 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=TzRHYEg0; 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="TzRHYEg0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776436212; 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: in-reply-to:in-reply-to:references:references; bh=9yVRVn/zRQuQzeFy5xr25n7quPTdCY6cNbOdP3O2WBA=; b=TzRHYEg0ovndS9WYlH5obSyvsE6vKnNlRuu2z2fFu/4B0AQzJw/ANlhT/EPycrwPEUcW7D qr2WjH5CFboAtRNPSVtiAEAFCcBnSGfAVgy65RqjffyI5hREhZwQIpINcI3G1r8iuhVDrG Nq+Pm/mCjQB5Xv2ic+TxsF9H9CTG2mM= Received: from mx-prod-mc-05.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-117-1qz2CUZyOTmXw6lVQ5aiAA-1; Fri, 17 Apr 2026 10:30:05 -0400 X-MC-Unique: 1qz2CUZyOTmXw6lVQ5aiAA-1 X-Mimecast-MFC-AGG-ID: 1qz2CUZyOTmXw6lVQ5aiAA_1776436202 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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 106A91956094; Fri, 17 Apr 2026 14:30:02 +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 70271180047F; Fri, 17 Apr 2026 14:29:57 +0000 (UTC) From: Petr Oros To: netdev@vger.kernel.org Cc: Petr Oros , Aleksandr Loktionov , Rafal Romanowski , 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 2/4] iavf: stop removing VLAN filters from PF on interface down Date: Fri, 17 Apr 2026 16:29:43 +0200 Message-ID: <7e03c6b17b67453f7c0c3eefce034a8fb9c40b63.1776426683.git.poros@redhat.com> In-Reply-To: References: 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Content-Type: text/plain; charset="utf-8" When a VF goes down, the driver currently sends DEL_VLAN to the PF for every VLAN filter (ACTIVE -> DISABLE -> send DEL -> INACTIVE), then re-adds them all on UP (INACTIVE -> ADD -> send ADD -> ADDING -> ACTIVE). This round-trip is unnecessary because: 1. The PF disables the VF's queues via VIRTCHNL_OP_DISABLE_QUEUES, which already prevents all RX/TX traffic regardless of VLAN filter state. 2. The VLAN filters remaining in PF HW while the VF is down is harmless - packets matching those filters have nowhere to go with queues disabled. 3. The DEL+ADD cycle during down/up creates race windows where the VLAN filter list is incomplete. With spoofcheck enabled, the PF enables TX VLAN filtering on the first non-zero VLAN add, blocking traffic for any VLANs not yet re-added. Remove the entire DISABLE/INACTIVE state machinery: - Remove IAVF_VLAN_DISABLE and IAVF_VLAN_INACTIVE enum values - Remove iavf_restore_filters() and its call from iavf_open() - Remove VLAN filter handling from iavf_clear_mac_vlan_filters(), rename it to iavf_clear_mac_filters() - Remove DEL_VLAN_FILTER scheduling from iavf_down() - Remove all DISABLE/INACTIVE handling from iavf_del_vlans() VLAN filters now stay ACTIVE across down/up cycles. Only explicit user removal (ndo_vlan_rx_kill_vid) or PF/VF reset triggers VLAN filter deletion/re-addition. Fixes: ed1f5b58ea01 ("i40evf: remove VLAN filters on close") Signed-off-by: Petr Oros Reviewed-by: Aleksandr Loktionov Tested-by: Rafal Romanowski Reviewed-by: Przemek Kitszel --- drivers/net/ethernet/intel/iavf/iavf.h | 6 +-- drivers/net/ethernet/intel/iavf/iavf_main.c | 39 ++----------------- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 33 +++------------- 3 files changed, 12 insertions(+), 66 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/= intel/iavf/iavf.h index 47a862ca5e2c3f..5765715914d6b2 100644 --- a/drivers/net/ethernet/intel/iavf/iavf.h +++ b/drivers/net/ethernet/intel/iavf/iavf.h @@ -159,10 +159,8 @@ enum iavf_vlan_state_t { IAVF_VLAN_INVALID, IAVF_VLAN_ADD, /* filter needs to be added */ IAVF_VLAN_ADDING, /* ADD sent to PF, waiting for response */ - IAVF_VLAN_ACTIVE, /* filter is accepted by PF */ - IAVF_VLAN_DISABLE, /* filter needs to be deleted by PF, then marked INACT= IVE */ - IAVF_VLAN_INACTIVE, /* filter is inactive, we are in IFF_DOWN */ - IAVF_VLAN_REMOVE, /* filter needs to be removed from list */ + IAVF_VLAN_ACTIVE, /* PF confirmed, filter is in HW */ + IAVF_VLAN_REMOVE, /* filter queued for DEL from PF */ }; =20 struct iavf_vlan_filter { diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethe= rnet/intel/iavf/iavf_main.c index dad001abc9086b..12e102506011a6 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -801,27 +801,6 @@ static void iavf_del_vlan(struct iavf_adapter *adapter= , struct iavf_vlan vlan) spin_unlock_bh(&adapter->mac_vlan_list_lock); } =20 -/** - * iavf_restore_filters - * @adapter: board private structure - * - * Restore existing non MAC filters when VF netdev comes back up - **/ -static void iavf_restore_filters(struct iavf_adapter *adapter) -{ - struct iavf_vlan_filter *f; - - /* re-add all VLAN filters */ - spin_lock_bh(&adapter->mac_vlan_list_lock); - - list_for_each_entry(f, &adapter->vlan_filter_list, list) { - if (f->state =3D=3D IAVF_VLAN_INACTIVE) - f->state =3D IAVF_VLAN_ADD; - } - - spin_unlock_bh(&adapter->mac_vlan_list_lock); - adapter->aq_required |=3D IAVF_FLAG_AQ_ADD_VLAN_FILTER; -} =20 /** * iavf_get_num_vlans_added - get number of VLANs added @@ -1240,13 +1219,12 @@ static void iavf_up_complete(struct iavf_adapter *a= dapter) } =20 /** - * iavf_clear_mac_vlan_filters - Remove mac and vlan filters not sent to PF - * yet and mark other to be removed. + * iavf_clear_mac_filters - Remove MAC filters not sent to PF yet and mark + * others to be removed. * @adapter: board private structure **/ -static void iavf_clear_mac_vlan_filters(struct iavf_adapter *adapter) +static void iavf_clear_mac_filters(struct iavf_adapter *adapter) { - struct iavf_vlan_filter *vlf, *vlftmp; struct iavf_mac_filter *f, *ftmp; =20 spin_lock_bh(&adapter->mac_vlan_list_lock); @@ -1265,11 +1243,6 @@ static void iavf_clear_mac_vlan_filters(struct iavf_= adapter *adapter) } } =20 - /* disable all VLAN filters */ - list_for_each_entry_safe(vlf, vlftmp, &adapter->vlan_filter_list, - list) - vlf->state =3D IAVF_VLAN_DISABLE; - spin_unlock_bh(&adapter->mac_vlan_list_lock); } =20 @@ -1365,7 +1338,7 @@ void iavf_down(struct iavf_adapter *adapter) iavf_napi_disable_all(adapter); iavf_irq_disable(adapter); =20 - iavf_clear_mac_vlan_filters(adapter); + iavf_clear_mac_filters(adapter); iavf_clear_cloud_filters(adapter); iavf_clear_fdir_filters(adapter); iavf_clear_adv_rss_conf(adapter); @@ -1382,8 +1355,6 @@ void iavf_down(struct iavf_adapter *adapter) */ if (!list_empty(&adapter->mac_filter_list)) adapter->aq_required |=3D IAVF_FLAG_AQ_DEL_MAC_FILTER; - if (!list_empty(&adapter->vlan_filter_list)) - adapter->aq_required |=3D IAVF_FLAG_AQ_DEL_VLAN_FILTER; if (!list_empty(&adapter->cloud_filter_list)) adapter->aq_required |=3D IAVF_FLAG_AQ_DEL_CLOUD_FILTER; if (!list_empty(&adapter->fdir_list_head)) @@ -4488,8 +4459,6 @@ static int iavf_open(struct net_device *netdev) iavf_add_filter(adapter, adapter->hw.mac.addr); spin_unlock_bh(&adapter->mac_vlan_list_lock); =20 - /* Restore filters that were removed with IFF_DOWN */ - iavf_restore_filters(adapter); iavf_restore_fdir_filters(adapter); =20 iavf_configure(adapter); diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/= ethernet/intel/iavf/iavf_virtchnl.c index 6b06ae872a0cdf..4f197d908124e6 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c @@ -911,22 +911,12 @@ void iavf_del_vlans(struct iavf_adapter *adapter) spin_lock_bh(&adapter->mac_vlan_list_lock); =20 list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { - /* since VLAN capabilities are not allowed, we dont want to send - * a VLAN delete request because it will most likely fail and - * create unnecessary errors/noise, so just free the VLAN - * filters marked for removal to enable bailing out before - * sending a virtchnl message - */ if (f->state =3D=3D IAVF_VLAN_REMOVE && !VLAN_FILTERING_ALLOWED(adapter)) { list_del(&f->list); kfree(f); adapter->num_vlan_filters--; - } else if (f->state =3D=3D IAVF_VLAN_DISABLE && - !VLAN_FILTERING_ALLOWED(adapter)) { - f->state =3D IAVF_VLAN_INACTIVE; - } else if (f->state =3D=3D IAVF_VLAN_REMOVE || - f->state =3D=3D IAVF_VLAN_DISABLE) { + } else if (f->state =3D=3D IAVF_VLAN_REMOVE) { count++; } } @@ -959,13 +949,7 @@ void iavf_del_vlans(struct iavf_adapter *adapter) vvfl->vsi_id =3D adapter->vsi_res->vsi_id; vvfl->num_elements =3D count; list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { - if (f->state =3D=3D IAVF_VLAN_DISABLE) { - vvfl->vlan_id[i] =3D f->vlan.vid; - f->state =3D IAVF_VLAN_INACTIVE; - i++; - if (i =3D=3D count) - break; - } else if (f->state =3D=3D IAVF_VLAN_REMOVE) { + if (f->state =3D=3D IAVF_VLAN_REMOVE) { vvfl->vlan_id[i] =3D f->vlan.vid; list_del(&f->list); kfree(f); @@ -1007,8 +991,7 @@ void iavf_del_vlans(struct iavf_adapter *adapter) vvfl_v2->vport_id =3D adapter->vsi_res->vsi_id; vvfl_v2->num_elements =3D count; list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { - if (f->state =3D=3D IAVF_VLAN_DISABLE || - f->state =3D=3D IAVF_VLAN_REMOVE) { + if (f->state =3D=3D IAVF_VLAN_REMOVE) { struct virtchnl_vlan_supported_caps *filtering_support =3D &adapter->vlan_v2_caps.filtering.filtering_support; struct virtchnl_vlan *vlan; @@ -1022,13 +1005,9 @@ void iavf_del_vlans(struct iavf_adapter *adapter) vlan->tci =3D f->vlan.vid; vlan->tpid =3D f->vlan.tpid; =20 - if (f->state =3D=3D IAVF_VLAN_DISABLE) { - f->state =3D IAVF_VLAN_INACTIVE; - } else { - list_del(&f->list); - kfree(f); - adapter->num_vlan_filters--; - } + list_del(&f->list); + kfree(f); + adapter->num_vlan_filters--; i++; if (i =3D=3D count) break; --=20 2.52.0 From nobody Wed Jun 10 18:53:11 2026 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 6F43F39B942 for ; Fri, 17 Apr 2026 14:30:16 +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=1776436217; cv=none; b=Gaejey5ftxGu7KT9qEN7DeKSXIc1V9B0KOkuHb+tEXwAphqiKO7KwpbQaasS/XYBX+2CqwQnqmdi7I6BJ+n93SEco/j64OgUTpGwXUoGLfgGDuXlveN6VVLyyzMvnTuWlRlL2JwHLW4EgJ59iHKJSLDkfg055a9hv+I/o0ix2vY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776436217; c=relaxed/simple; bh=GHG85yc+vpickSG/vzIhMMJO7QueuFKH5tR6RqVbj00=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OgS8y8U0Srw0DRVikQrileumki/qnmJF27kNLz+QfaJ2jo+OUnsjF4puOQdE8f2wV5QHB0E8zXhdO65MqqGsLNXeGkw06zcxk/+NVTZU65cc5ZDO/gUztv8G8GGAz0WH6ZcsvNiAjbcZmE8KvHrIs52Hh85M6Goge3RUn788w/E= 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=caZi4vpG; 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="caZi4vpG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776436215; 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: in-reply-to:in-reply-to:references:references; bh=So3UL4GLmFGEb2cMh3LixTfYDLK8oXuy3PKPaHp8JM4=; b=caZi4vpGtFbAB+KacgBUBgYhx0WAWh8DcZJ7aW7bVYcU8iQaD+t9XRRcDYHXzGtv8YZfxh Ytu+lZIvKtKytZJBIJGf4bXhHp7/g/CTwmrhfupxmmyIRF6Z6yOSmpg9NQpPUTbmmiC9gE vpCc6esiYnDR8wEjG0p+zTMs6fpqgaY= 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-609-qN3pg3HzOBS6RW1OI8S-DA-1; Fri, 17 Apr 2026 10:30:12 -0400 X-MC-Unique: qN3pg3HzOBS6RW1OI8S-DA-1 X-Mimecast-MFC-AGG-ID: qN3pg3HzOBS6RW1OI8S-DA_1776436207 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 1ADA1195609D; Fri, 17 Apr 2026 14:30:07 +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 73678180047F; Fri, 17 Apr 2026 14:30:02 +0000 (UTC) From: Petr Oros To: netdev@vger.kernel.org Cc: Petr Oros , Aleksandr Loktionov , Rafal Romanowski , 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 3/4] iavf: wait for PF confirmation before removing VLAN filters Date: Fri, 17 Apr 2026 16:29:44 +0200 Message-ID: In-Reply-To: References: 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Content-Type: text/plain; charset="utf-8" The VLAN filter DELETE path was asymmetric with the ADD path: ADD waits for PF confirmation (ADD -> ADDING -> ACTIVE), but DELETE immediately frees the filter struct after sending the DEL message without waiting for the PF response. This is problematic because: - If the PF rejects the DEL, the filter remains in HW but the driver has already freed the tracking structure, losing sync. - Race conditions between DEL pending and other operations (add, reset) cannot be properly resolved if the filter struct is already gone. Add IAVF_VLAN_REMOVING state to make the DELETE path symmetric: REMOVE -> REMOVING (send DEL) -> PF confirms -> kfree -> PF rejects -> ACTIVE In iavf_del_vlans(), transition filters from REMOVE to REMOVING instead of immediately freeing them. The new DEL completion handler in iavf_virtchnl_completion() frees filters on success or reverts them to ACTIVE on error. Update iavf_add_vlan() to handle the REMOVING state: if a DEL is pending and the user re-adds the same VLAN, queue it for ADD so it gets re-programmed after the PF processes the DEL. The !VLAN_FILTERING_ALLOWED early-exit path still frees filters directly since no PF message is sent in that case. Also update iavf_del_vlan() to skip filters already in REMOVING state: DEL has been sent to PF and the completion handler will free the filter when PF confirms. Without this guard, the sequence DEL(pending) -> user-del -> second DEL could cause the PF to return an error for the second DEL (filter already gone), causing the completion handler to incorrectly revert a deleted filter back to ACTIVE. Fixes: 968996c070ef ("iavf: Fix VLAN_V2 addition/rejection") Signed-off-by: Petr Oros Reviewed-by: Aleksandr Loktionov Tested-by: Rafal Romanowski Reviewed-by: Przemek Kitszel --- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 13 ++++--- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 37 +++++++++++++------ 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/= intel/iavf/iavf.h index 5765715914d6b2..050f8241ef5e6b 100644 --- a/drivers/net/ethernet/intel/iavf/iavf.h +++ b/drivers/net/ethernet/intel/iavf/iavf.h @@ -161,6 +161,7 @@ enum iavf_vlan_state_t { IAVF_VLAN_ADDING, /* ADD sent to PF, waiting for response */ IAVF_VLAN_ACTIVE, /* PF confirmed, filter is in HW */ IAVF_VLAN_REMOVE, /* filter queued for DEL from PF */ + IAVF_VLAN_REMOVING, /* DEL sent to PF, waiting for response */ }; =20 struct iavf_vlan_filter { diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethe= rnet/intel/iavf/iavf_main.c index 12e102506011a6..d373feee4c7e9c 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -757,10 +757,10 @@ iavf_vlan_filter *iavf_add_vlan(struct iavf_adapter *= adapter, adapter->num_vlan_filters++; iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_ADD_VLAN_FILTER); } else if (f->state =3D=3D IAVF_VLAN_REMOVE) { - /* Re-add the filter since we cannot tell whether the - * pending delete has already been processed by the PF. - * A duplicate add is harmless. - */ + /* DEL not yet sent to PF, cancel it */ + f->state =3D IAVF_VLAN_ACTIVE; + } else if (f->state =3D=3D IAVF_VLAN_REMOVING) { + /* DEL already sent to PF, re-add after completion */ f->state =3D IAVF_VLAN_ADD; iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_ADD_VLAN_FILTER); @@ -791,11 +791,14 @@ static void iavf_del_vlan(struct iavf_adapter *adapte= r, struct iavf_vlan vlan) list_del(&f->list); kfree(f); adapter->num_vlan_filters--; - } else { + } else if (f->state !=3D IAVF_VLAN_REMOVING) { f->state =3D IAVF_VLAN_REMOVE; iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_DEL_VLAN_FILTER); } + /* If REMOVING, DEL is already sent to PF; completion + * handler will free the filter when PF confirms. + */ } =20 spin_unlock_bh(&adapter->mac_vlan_list_lock); diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/= ethernet/intel/iavf/iavf_virtchnl.c index 4f197d908124e6..93ca79c3e3b535 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c @@ -948,12 +948,10 @@ void iavf_del_vlans(struct iavf_adapter *adapter) =20 vvfl->vsi_id =3D adapter->vsi_res->vsi_id; vvfl->num_elements =3D count; - list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { + list_for_each_entry(f, &adapter->vlan_filter_list, list) { if (f->state =3D=3D IAVF_VLAN_REMOVE) { vvfl->vlan_id[i] =3D f->vlan.vid; - list_del(&f->list); - kfree(f); - adapter->num_vlan_filters--; + f->state =3D IAVF_VLAN_REMOVING; i++; if (i =3D=3D count) break; @@ -990,7 +988,7 @@ void iavf_del_vlans(struct iavf_adapter *adapter) =20 vvfl_v2->vport_id =3D adapter->vsi_res->vsi_id; vvfl_v2->num_elements =3D count; - list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, list) { + list_for_each_entry(f, &adapter->vlan_filter_list, list) { if (f->state =3D=3D IAVF_VLAN_REMOVE) { struct virtchnl_vlan_supported_caps *filtering_support =3D &adapter->vlan_v2_caps.filtering.filtering_support; @@ -1005,9 +1003,7 @@ void iavf_del_vlans(struct iavf_adapter *adapter) vlan->tci =3D f->vlan.vid; vlan->tpid =3D f->vlan.tpid; =20 - list_del(&f->list); - kfree(f); - adapter->num_vlan_filters--; + f->state =3D IAVF_VLAN_REMOVING; i++; if (i =3D=3D count) break; @@ -2370,10 +2366,6 @@ void iavf_virtchnl_completion(struct iavf_adapter *a= dapter, ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); wake_up(&adapter->vc_waitqueue); break; - case VIRTCHNL_OP_DEL_VLAN: - dev_err(&adapter->pdev->dev, "Failed to delete VLAN filter, error %s\n", - iavf_stat_str(&adapter->hw, v_retval)); - break; case VIRTCHNL_OP_DEL_ETH_ADDR: dev_err(&adapter->pdev->dev, "Failed to delete MAC filter, error %s\n", iavf_stat_str(&adapter->hw, v_retval)); @@ -2895,6 +2887,27 @@ void iavf_virtchnl_completion(struct iavf_adapter *a= dapter, spin_unlock_bh(&adapter->mac_vlan_list_lock); } break; + case VIRTCHNL_OP_DEL_VLAN: + case VIRTCHNL_OP_DEL_VLAN_V2: { + struct iavf_vlan_filter *f, *ftmp; + + spin_lock_bh(&adapter->mac_vlan_list_lock); + list_for_each_entry_safe(f, ftmp, &adapter->vlan_filter_list, + list) { + if (f->state =3D=3D IAVF_VLAN_REMOVING) { + if (v_retval) { + /* PF rejected DEL, keep filter */ + f->state =3D IAVF_VLAN_ACTIVE; + } else { + list_del(&f->list); + kfree(f); + adapter->num_vlan_filters--; + } + } + } + spin_unlock_bh(&adapter->mac_vlan_list_lock); + } + break; case VIRTCHNL_OP_ENABLE_VLAN_STRIPPING: /* PF enabled vlan strip on this VF. * Update netdev->features if needed to be in sync with ethtool. --=20 2.52.0 From nobody Wed Jun 10 18:53:11 2026 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 39AFC3B38AE for ; Fri, 17 Apr 2026 14:30:21 +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=1776436222; cv=none; b=Kdo80NEPBWYNPa96gElp6D53hyXdzWfl/PQEhSU3rutJNeT5LzlqcsZBpc8DWeNfqhEaHi8iUYm3QDsTdm6YKgeC4K6bAJ/7nyKWlJziJMacB0sw0+kutJ6kMWhc9XfW6x+ir1Jxtl27VBCzumfSP7mG+zeEb4nfTl1Ebw99mfw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776436222; c=relaxed/simple; bh=4rvXAXust12iMgVgAEayfqL6sG2E1wsGCOW+0XrTxMw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V7uwXUUCKYp3eyMdBBlTfp7kt6MMyyNHxUu0HUAOeAq341u5HZlv9uDFhfieMUGw6aBoRrMLuACE4IqT88ATvayuUJ/65rItigafj2b7V/UddPhKME6IUYkp1TtSbfrsJJw36HvP4X4fIpYpRXQ+EsayS9Oh3PNvXdKttg4yiz8= 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=T3gvUF+r; 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="T3gvUF+r" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1776436220; 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: in-reply-to:in-reply-to:references:references; bh=qRDouEYakfTZkhMNAyg/NTmNR2IdKqr6QrkWdzUnTo4=; b=T3gvUF+rr84ilymokzAVT9fQflWHYJKAHojLQrZy/Q28pf21qoLlmh3sMdAyx1vGhdXi9i a0RkZt/1AWzC3vNlFRiG1nHTup+P+nUaKHF6rAPXUah5gGU0J2MbNi68JQE3P60r7D2fD/ zGpGx6H2T3qpP5n83HDTg31DEes6mEY= Received: from mx-prod-mc-03.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-99-RMI_5dtWPXyyCSXpo-w3Xg-1; Fri, 17 Apr 2026 10:30:14 -0400 X-MC-Unique: RMI_5dtWPXyyCSXpo-w3Xg-1 X-Mimecast-MFC-AGG-ID: RMI_5dtWPXyyCSXpo-w3Xg_1776436212 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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4BA7C1955DDB; Fri, 17 Apr 2026 14:30:12 +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 7DBCB180047F; Fri, 17 Apr 2026 14:30:07 +0000 (UTC) From: Petr Oros To: netdev@vger.kernel.org Cc: Petr Oros , Aleksandr Loktionov , Rafal Romanowski , 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 4/4] iavf: add VIRTCHNL_OP_ADD_VLAN to success completion handler Date: Fri, 17 Apr 2026 16:29:45 +0200 Message-ID: In-Reply-To: References: 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 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 Content-Type: text/plain; charset="utf-8" The V1 ADD_VLAN opcode had no success handler; filters sent via V1 stayed in ADDING state permanently. Add a fallthrough case so V1 filters also transition ADDING -> ACTIVE on PF confirmation. Critically, add an `if (v_retval) break` guard: the error switch in iavf_virtchnl_completion() does NOT return after handling errors, it falls through to the success switch. Without this guard, a PF-rejected ADD would incorrectly mark ADDING filters as ACTIVE, creating a driver/HW mismatch where the driver believes the filter is installed but the PF never accepted it. For V2, this is harmless: iavf_vlan_add_reject() in the error block already kfree'd all ADDING filters, so the success handler finds nothing to transition. Fixes: 968996c070ef ("iavf: Fix VLAN_V2 addition/rejection") Signed-off-by: Petr Oros Reviewed-by: Aleksandr Loktionov Tested-by: Rafal Romanowski Reviewed-by: Przemek Kitszel --- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c b/drivers/net/= ethernet/intel/iavf/iavf_virtchnl.c index 93ca79c3e3b535..4f2defd2331b17 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +++ b/drivers/net/ethernet/intel/iavf/iavf_virtchnl.c @@ -2876,9 +2876,13 @@ void iavf_virtchnl_completion(struct iavf_adapter *a= dapter, spin_unlock_bh(&adapter->adv_rss_lock); } break; + case VIRTCHNL_OP_ADD_VLAN: case VIRTCHNL_OP_ADD_VLAN_V2: { struct iavf_vlan_filter *f; =20 + if (v_retval) + break; + spin_lock_bh(&adapter->mac_vlan_list_lock); list_for_each_entry(f, &adapter->vlan_filter_list, list) { if (f->state =3D=3D IAVF_VLAN_ADDING) --=20 2.52.0