From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B415BC5AD49 for ; Wed, 4 Jun 2025 00:54:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6DFC961459; Wed, 4 Jun 2025 00:54:52 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id HKAg1RywQUIF; Wed, 4 Jun 2025 00:54:51 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org BA102616A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1748998491; bh=H8aMXgc0hhgKJEZLDozgsDPBDV2Csxfsy9NnkVPWBls=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fHkNbvQN5uO+s6JQzeyn9pLTbIfGVqhhnbbAJAwC87mfAO84SNLnFqRvQu1Qzq0G0 RjildfCyWxlHE7h2nc4mO9VEt1b2G1gcbJ4yq2PB+ugdGoj0NTcZo2yehkPLJuY3P1 LlPKx+nwSSs7VNbFOvd1Tfc26Rd+FSWpOHb7s79ENQsu0aQbR/gjDKf3UsA1iMNvAP UFrq1vV3PnAiG0FcbvR0r6Ybeg3P6O+5AFgaF6mXXFPapYhzMRfcJuN4fZqhUYKFnz E2P+z677hYpTRqseypNICwadRUljqEtJL63w0w98cVuLbWYdkqWDVdu2+JUBZABMtl iuVCgb4x0f8ag== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id BA102616A2; Wed, 4 Jun 2025 00:54:51 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists1.osuosl.org (Postfix) with ESMTP id C2231DA for ; Wed, 4 Jun 2025 00:54:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id A8F2A41A0A for ; Wed, 4 Jun 2025 00:54:50 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id bXPbPG3jGIfW for ; Wed, 4 Jun 2025 00:54:50 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.252.31; helo=sea.source.kernel.org; envelope-from=sashal@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org F29B8419DC DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org F29B8419DC Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by smtp4.osuosl.org (Postfix) with ESMTPS id F29B8419DC for ; Wed, 4 Jun 2025 00:54:49 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id A6CC844D7A; Wed, 4 Jun 2025 00:54:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A4F1C4CEEF; Wed, 4 Jun 2025 00:54:48 +0000 (UTC) From: Sasha Levin To: patches@lists.linux.dev, stable@vger.kernel.org Cc: Mateusz Pacuszka , Przemek Kitszel , Michal Swiatkowski , Larysa Zaremba , Simon Horman , Rafal Romanowski , Tony Nguyen , Sasha Levin , intel-wired-lan@lists.osuosl.org Date: Tue, 3 Jun 2025 20:50:35 -0400 Message-Id: <20250604005049.4147522-104-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250604005049.4147522-1-sashal@kernel.org> References: <20250604005049.4147522-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.15 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748998489; bh=DYvO1IWNV102sNCif/OsB29SxDK2hKQlLwmPFz61b5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qy8IorMWI6BbVnKz2LyFzgCf3XGWuXzdVzk+vs++u/Azgakaay9XSZSxi980d+L0m 9zJIOV22lN/6fgg0CYmoF1ChhsvBx127Lu2R0d2x6+htFF8brzBNn945rprj5AQP7G hiCHvIGbF7gl6ZYOs72cxWOzKIX/MAGuaDZCHUlPKHq8RJ/EajuZgzXUItwGwWuMPS KFN5rouzEY8u+ioS82jy6/Q5BGPHXjIqr+yy2WGsOnsEIZrPxGetw9uShPN1k1OPER nZ+wGcxOc2Bn9ymLMM9arXC37Pya9AK6BKGQFThtdWcemv7UJp6+UN2+WHFzWFiyvA 5C0xb8OIosnkg== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Qy8IorMW Subject: [Intel-wired-lan] [PATCH AUTOSEL 6.15 104/118] ice: fix check for existing switch rule X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" From: Mateusz Pacuszka [ Upstream commit a808691df39b52cd9db861b118e88e18b63e2299 ] In case the rule already exists and another VSI wants to subscribe to it new VSI list is being created and both VSIs are moved to it. Currently, the check for already existing VSI with the same rule is done based on fdw_id.hw_vsi_id, which applies only to LOOKUP_RX flag. Change it to vsi_handle. This is software VSI ID, but it can be applied here, because vsi_map itself is also based on it. Additionally change return status in case the VSI already exists in the VSI map to "Already exists". Such case should be handled by the caller. Signed-off-by: Mateusz Pacuszka Reviewed-by: Przemek Kitszel Reviewed-by: Michal Swiatkowski Signed-off-by: Larysa Zaremba Reviewed-by: Simon Horman Tested-by: Rafal Romanowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- **YES** This commit should be backported to stable kernel trees. Here's my detailed analysis: ## Bug Fix Nature This commit fixes a legitimate bug in the Intel ice driver's switch rule handling logic. The issue involves incorrect VSI (Virtual Station Interface) identification when checking for existing switch rules, which can lead to: 1. **Incorrect duplicate detection**: Using `fwd_id.hw_vsi_id` instead of `vsi_handle` for comparison 2. **Inconsistent error handling**: Returning `0` instead of `-EEXIST` when a VSI already exists in the VSI map ## Code Analysis ### Primary Fix (Line 3149): ```c -if (cur_fltr->fwd_id.hw_vsi_id == new_fltr->fwd_id.hw_vsi_id) +if (cur_fltr->vsi_handle == new_fltr->vsi_handle) ``` This change fixes the comparison logic to use `vsi_handle` (software VSI ID) instead of `hw_vsi_id` (hardware VSI ID). The commit message explains that `hw_vsi_id` only applies to `LOOKUP_RX` flag, while `vsi_handle` is the correct identifier since `vsi_map` is based on it. ### Secondary Fix (Line 5981): ```c -return 0; +return -EEXIST; ``` This change ensures consistent error reporting when a VSI already exists in the VSI map, allowing callers to handle this case appropriately. ## Comparison with Similar Commits Looking at the provided similar commits: - **Similar Commit #2** (Status: YES): Also fixes switchdev rules book keeping with proper VSI handling - **Similar Commit #5** (Status: YES): Removes unnecessary duplicate VSI ID checks Both approved commits deal with VSI identification and handling issues, similar to this commit. ## Backport Suitability Criteria ✅ **Fixes a bug affecting users**: VSI rule management is critical for network functionality ✅ **Small and contained**: Only 4 lines changed across 2 functions ✅ **No architectural changes**: Simply corrects existing logic ✅ **Minimal regression risk**: Changes are targeted and well-understood ✅ **Critical subsystem**: Network drivers are important for system stability ✅ **Clear side effects**: The changes have predictable behavior improvements ## Risk Assessment - **Low risk**: The changes are surgical fixes to specific comparison logic - **Well-tested**: The commit includes "Tested-by" tag from Intel QA - **Subsystem-confined**: Changes are isolated to ice driver switch handling - **Backwards compatible**: No API or behavioral changes for users The commit follows stable tree rules perfectly: it's an important bugfix with minimal risk that improves the reliability of network switch rule handling in the Intel ice driver. drivers/net/ethernet/intel/ice/ice_switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 4a91e0aaf0a5e..9d9a7edd3618a 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -3146,7 +3146,7 @@ ice_add_update_vsi_list(struct ice_hw *hw, u16 vsi_handle_arr[2]; /* A rule already exists with the new VSI being added */ - if (cur_fltr->fwd_id.hw_vsi_id == new_fltr->fwd_id.hw_vsi_id) + if (cur_fltr->vsi_handle == new_fltr->vsi_handle) return -EEXIST; vsi_handle_arr[0] = cur_fltr->vsi_handle; @@ -5978,7 +5978,7 @@ ice_adv_add_update_vsi_list(struct ice_hw *hw, /* A rule already exists with the new VSI being added */ if (test_bit(vsi_handle, m_entry->vsi_list_info->vsi_map)) - return 0; + return -EEXIST; /* Update the previously created VSI list set with * the new VSI ID passed in -- 2.39.5 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1431D145B16; Wed, 4 Jun 2025 00:54:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748998490; cv=none; b=lbGhZkUcK+/sfBbXuL/W7p/P0TNJWSBT9qiL33/pn/yyWfwGw5J232MFpaTgiiw7bs9cipNymeb1ReI69W5QEpxv8Ue4e4Rr0I887a45xO3PKPmxbsK/m8B32ZLMwbDV1qrol2VEDC5J9vNqFnOFwhvTRS3XUuifW08Z/CXjt+Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748998490; c=relaxed/simple; bh=DYvO1IWNV102sNCif/OsB29SxDK2hKQlLwmPFz61b5w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=FURZLzi5Fd9zYp5r+LMsnERINoO40heyQA+9WFtWF/f5Wra5JGv9orLQfwapAv0TZdGI3s4vwm0IYC+dmSEH93fR4ichuh5GlXWGGvQF1n8xIQcwp5Z3gUfDt/4hLTDKR+ljTutKTqzLhgdLUuyNZi7dplIM1dnmB/G89Q+YV1o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Qy8IorMW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Qy8IorMW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A4F1C4CEEF; Wed, 4 Jun 2025 00:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748998489; bh=DYvO1IWNV102sNCif/OsB29SxDK2hKQlLwmPFz61b5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qy8IorMWI6BbVnKz2LyFzgCf3XGWuXzdVzk+vs++u/Azgakaay9XSZSxi980d+L0m 9zJIOV22lN/6fgg0CYmoF1ChhsvBx127Lu2R0d2x6+htFF8brzBNn945rprj5AQP7G hiCHvIGbF7gl6ZYOs72cxWOzKIX/MAGuaDZCHUlPKHq8RJ/EajuZgzXUItwGwWuMPS KFN5rouzEY8u+ioS82jy6/Q5BGPHXjIqr+yy2WGsOnsEIZrPxGetw9uShPN1k1OPER nZ+wGcxOc2Bn9ymLMM9arXC37Pya9AK6BKGQFThtdWcemv7UJp6+UN2+WHFzWFiyvA 5C0xb8OIosnkg== From: Sasha Levin To: patches@lists.linux.dev, stable@vger.kernel.org Cc: Mateusz Pacuszka , Przemek Kitszel , Michal Swiatkowski , Larysa Zaremba , Simon Horman , Rafal Romanowski , Tony Nguyen , Sasha Levin , intel-wired-lan@lists.osuosl.org Subject: [PATCH AUTOSEL 6.15 104/118] ice: fix check for existing switch rule Date: Tue, 3 Jun 2025 20:50:35 -0400 Message-Id: <20250604005049.4147522-104-sashal@kernel.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250604005049.4147522-1-sashal@kernel.org> References: <20250604005049.4147522-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.15 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Mateusz Pacuszka [ Upstream commit a808691df39b52cd9db861b118e88e18b63e2299 ] In case the rule already exists and another VSI wants to subscribe to it new VSI list is being created and both VSIs are moved to it. Currently, the check for already existing VSI with the same rule is done based on fdw_id.hw_vsi_id, which applies only to LOOKUP_RX flag. Change it to vsi_handle. This is software VSI ID, but it can be applied here, because vsi_map itself is also based on it. Additionally change return status in case the VSI already exists in the VSI map to "Already exists". Such case should be handled by the caller. Signed-off-by: Mateusz Pacuszka Reviewed-by: Przemek Kitszel Reviewed-by: Michal Swiatkowski Signed-off-by: Larysa Zaremba Reviewed-by: Simon Horman Tested-by: Rafal Romanowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- **YES** This commit should be backported to stable kernel trees. Here's my detailed analysis: ## Bug Fix Nature This commit fixes a legitimate bug in the Intel ice driver's switch rule handling logic. The issue involves incorrect VSI (Virtual Station Interface) identification when checking for existing switch rules, which can lead to: 1. **Incorrect duplicate detection**: Using `fwd_id.hw_vsi_id` instead of `vsi_handle` for comparison 2. **Inconsistent error handling**: Returning `0` instead of `-EEXIST` when a VSI already exists in the VSI map ## Code Analysis ### Primary Fix (Line 3149): ```c -if (cur_fltr->fwd_id.hw_vsi_id == new_fltr->fwd_id.hw_vsi_id) +if (cur_fltr->vsi_handle == new_fltr->vsi_handle) ``` This change fixes the comparison logic to use `vsi_handle` (software VSI ID) instead of `hw_vsi_id` (hardware VSI ID). The commit message explains that `hw_vsi_id` only applies to `LOOKUP_RX` flag, while `vsi_handle` is the correct identifier since `vsi_map` is based on it. ### Secondary Fix (Line 5981): ```c -return 0; +return -EEXIST; ``` This change ensures consistent error reporting when a VSI already exists in the VSI map, allowing callers to handle this case appropriately. ## Comparison with Similar Commits Looking at the provided similar commits: - **Similar Commit #2** (Status: YES): Also fixes switchdev rules book keeping with proper VSI handling - **Similar Commit #5** (Status: YES): Removes unnecessary duplicate VSI ID checks Both approved commits deal with VSI identification and handling issues, similar to this commit. ## Backport Suitability Criteria ✅ **Fixes a bug affecting users**: VSI rule management is critical for network functionality ✅ **Small and contained**: Only 4 lines changed across 2 functions ✅ **No architectural changes**: Simply corrects existing logic ✅ **Minimal regression risk**: Changes are targeted and well-understood ✅ **Critical subsystem**: Network drivers are important for system stability ✅ **Clear side effects**: The changes have predictable behavior improvements ## Risk Assessment - **Low risk**: The changes are surgical fixes to specific comparison logic - **Well-tested**: The commit includes "Tested-by" tag from Intel QA - **Subsystem-confined**: Changes are isolated to ice driver switch handling - **Backwards compatible**: No API or behavioral changes for users The commit follows stable tree rules perfectly: it's an important bugfix with minimal risk that improves the reliability of network switch rule handling in the Intel ice driver. drivers/net/ethernet/intel/ice/ice_switch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 4a91e0aaf0a5e..9d9a7edd3618a 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -3146,7 +3146,7 @@ ice_add_update_vsi_list(struct ice_hw *hw, u16 vsi_handle_arr[2]; /* A rule already exists with the new VSI being added */ - if (cur_fltr->fwd_id.hw_vsi_id == new_fltr->fwd_id.hw_vsi_id) + if (cur_fltr->vsi_handle == new_fltr->vsi_handle) return -EEXIST; vsi_handle_arr[0] = cur_fltr->vsi_handle; @@ -5978,7 +5978,7 @@ ice_adv_add_update_vsi_list(struct ice_hw *hw, /* A rule already exists with the new VSI being added */ if (test_bit(vsi_handle, m_entry->vsi_list_info->vsi_map)) - return 0; + return -EEXIST; /* Update the previously created VSI list set with * the new VSI ID passed in -- 2.39.5