From patchwork Wed Feb 4 04:44:12 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Slepecki X-Patchwork-Id: 2193050 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=S/35ylQH; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4f5l5y2wVDz1xpg for ; Thu, 05 Feb 2026 02:44:38 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 73277610B7; Wed, 4 Feb 2026 15:44:34 +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 3ybdZ42Su0rS; Wed, 4 Feb 2026 15:44:33 +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 DFDD261054 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1770219871; bh=7bTL/IL5JLOqTt0ruWIiRy8lRZlpcI5tPVzOHeLHfYQ=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=S/35ylQH6az2ckSfTTmrAmIZDuuCudcwpJXjxGYM/iaup2gOrNLqGFdY7z1WEGHIW QIPDVCCIkLQEutYTOKUhXrXoe3AR504q8K89sRyrnI2/8K4HK9RZMZiIObsokgfpP0 ugAmjYEkt7+enT6ThJ1M0S4GovZpIsPQt2Q7FFTMI3UFzWT8ffd9B60fzXD+bd8b4p A9zR7oEDhlU7IfI+xiWWm8DMDw3DmhuBkXmd6L9yerFu/bL7hafMxiAO8LxnQMrhhK c249kuY9/k+M8eqTQVlJfBl5+IoqMswaF0vutJRTgTp5LMqVLVP/yOR+auh9TyHant Wr5Mki6O3Om9Q== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id DFDD261054; Wed, 4 Feb 2026 15:44:30 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id BA251F5 for ; Wed, 4 Feb 2026 15:44:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B1D5483F00 for ; Wed, 4 Feb 2026 15:44:24 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 9-o1fEAaErbY for ; Wed, 4 Feb 2026 15:44:23 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.8; helo=mgamail.intel.com; envelope-from=jakub.slepecki@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org B760A83E9A DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org B760A83E9A Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by smtp1.osuosl.org (Postfix) with ESMTPS id B760A83E9A for ; Wed, 4 Feb 2026 15:44:23 +0000 (UTC) X-CSE-ConnectionGUID: 3E5f0XtaRQaRy7hMgXEELw== X-CSE-MsgGUID: 0KF5+6fVS+yqr6SgIYvY9A== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="88987087" X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="88987087" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 07:44:23 -0800 X-CSE-ConnectionGUID: CiN9cfT+QQ6oak+3mG5LwA== X-CSE-MsgGUID: yzzJF2+6RhKZB9/RP/OxhA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="209494108" Received: from hpe-dl385gen10.igk.intel.com ([10.91.240.117]) by orviesa010.jf.intel.com with ESMTP; 04 Feb 2026 07:44:21 -0800 From: Jakub Slepecki To: intel-wired-lan@lists.osuosl.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, michal.swiatkowski@linux.intel.com, jakub.slepecki@intel.com, aleksandr.loktionov@intel.com Date: Wed, 4 Feb 2026 16:44:12 +0100 Message-ID: <20260204154418.1285309-2-jakub.slepecki@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260204154418.1285309-1-jakub.slepecki@intel.com> References: <20260204154418.1285309-1-jakub.slepecki@intel.com> MIME-Version: 1.0 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770219864; x=1801755864; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dwcyIJF8VgjcMQ3xJeX68AIy1NtJFyfUkiIvEZTRHPw=; b=ZV6XuF1O2iiX2/VgOs3Zry092byxM1rCGAT6Fh9VhgAI/SkWFPP/0Dr/ 2UqIQ7FCrlPez/iD+FzesjpJ6YVpdEPUPrCqmkE2Bt2VITiR++S8zm+zi oZDosId0ZIBtEg46kIPnC69Yj7B6jo/Fv4O5l1m34q1Tmy5BFfRxmM5WI 2nhCRkXT8FQHp2AGJt6Zyi+FYEoEwwBvPcbwk/J6/Bh2zAc7tbZbp3nvV gLlZ8hlyeCl2UoxoDo5oknQz6yO4sDRWzfq6RH9ldS8rxvlUa3+Ff2DYQ wKC1J3ArDdVirM6MrGQhfV2cuUI90AuO+HlgJqteTsLzOrqGW/ad9dEyL g==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ZV6XuF1O Subject: [Intel-wired-lan] [PATCH iwl-next v4 1/7] ice: in dvm, use outer VLAN in MAC, VLAN lookup 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" In double VLAN mode (DVM), outer VLAN is located a word earlier in the field vector compared to the single VLAN mode. We already modify ICE_SW_LKUP_VLAN to use it but ICE_SW_LKUP_MAC_VLAN was left untouched, causing the lookup to match any packet with one or no layer of Dot1q. This change enables to fix cross-vlan loopback traffic using MAC,VLAN lookups. Reviewed-by: Aleksandr Loktionov Reviewed-by: Michal Swiatkowski Signed-off-by: Jakub Slepecki Tested-by: Rafal Romanowski --- No changes in v4. No changes in v3. No changes in v2. --- drivers/net/ethernet/intel/ice/ice_vlan_mode.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c index fb526cb84776..68a7b05de44e 100644 --- a/drivers/net/ethernet/intel/ice/ice_vlan_mode.c +++ b/drivers/net/ethernet/intel/ice/ice_vlan_mode.c @@ -198,6 +198,7 @@ static bool ice_is_dvm_supported(struct ice_hw *hw) #define ICE_SW_LKUP_VLAN_LOC_LKUP_IDX 1 #define ICE_SW_LKUP_VLAN_PKT_FLAGS_LKUP_IDX 2 #define ICE_SW_LKUP_PROMISC_VLAN_LOC_LKUP_IDX 2 +#define ICE_SW_LKUP_MAC_VLAN_LOC_LKUP_IDX 4 #define ICE_PKT_FLAGS_0_TO_15_FV_IDX 1 static struct ice_update_recipe_lkup_idx_params ice_dvm_dflt_recipes[] = { { @@ -234,6 +235,17 @@ static struct ice_update_recipe_lkup_idx_params ice_dvm_dflt_recipes[] = { .mask_valid = false, /* use pre-existing mask */ .lkup_idx = ICE_SW_LKUP_PROMISC_VLAN_LOC_LKUP_IDX, }, + { + /* Similarly to ICE_SW_LKUP_VLAN, change to outer/single VLAN in + * DVM + */ + .rid = ICE_SW_LKUP_MAC_VLAN, + .fv_idx = ICE_EXTERNAL_VLAN_ID_FV_IDX, + .ignore_valid = true, + .mask = 0, + .mask_valid = false, + .lkup_idx = ICE_SW_LKUP_MAC_VLAN_LOC_LKUP_IDX, + }, }; /** From patchwork Wed Feb 4 04:44:13 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Slepecki X-Patchwork-Id: 2193052 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=M1VA3zPr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4f5l622sTMz1xpg for ; Thu, 05 Feb 2026 02:44:42 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C032860DC2; Wed, 4 Feb 2026 15:44:37 +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 ypZaLO0qoNB7; Wed, 4 Feb 2026 15:44:35 +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 760A561090 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1770219872; bh=rB+NF6Lj31wNmcslNxJOtoJ6P4iw8UYoPZpsfE3bJaI=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=M1VA3zPrIrHxr6adWldv59ZpJW+iV4g56yoOhOIx6jjoM5FbcIXmd2R+Aa/9V6FOB 4zPCWV6tgOkFu7IrLry81Qw8xfdLaSrGQPwNlVc6ogdM6HgMdBC++IrdmaKwtVOcH4 ub2j3XPkvWDmBuFiZg3U8rLm2tqZKZV6Jr2RKblbj32S1aT2uchtWS3+EkPkTG5U5e DCJp0BqqMtDTIQw1bTI8w/eC2u0x99BAyx4kcLQDSkF3FiXKSiLqcRqO7+CNSx+tcu 4ZD6V7yueudaURxpkCA9aSDRbU4zdZ6tGnp01J7pQyIKjmIF1Tj0IfyMcGKfFOkODw EiioV/+CmQzWw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 760A561090; Wed, 4 Feb 2026 15:44:32 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id 3B8F5F4 for ; Wed, 4 Feb 2026 15:44:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 033018032C for ; Wed, 4 Feb 2026 15:44:27 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 8Tlw7dMmRUFu for ; Wed, 4 Feb 2026 15:44:26 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.8; helo=mgamail.intel.com; envelope-from=jakub.slepecki@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 0A16483E9A DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 0A16483E9A Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by smtp1.osuosl.org (Postfix) with ESMTPS id 0A16483E9A for ; Wed, 4 Feb 2026 15:44:25 +0000 (UTC) X-CSE-ConnectionGUID: c7oMCQINSxmFFfzTs3YHgw== X-CSE-MsgGUID: ej25iwf/RyaMc+JxQoKsUA== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="88987091" X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="88987091" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 07:44:26 -0800 X-CSE-ConnectionGUID: 6jqfFe4nRtKo1bJylNkOEA== X-CSE-MsgGUID: AKljs61XQ7SXqFBlobG3LA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="209494118" Received: from hpe-dl385gen10.igk.intel.com ([10.91.240.117]) by orviesa010.jf.intel.com with ESMTP; 04 Feb 2026 07:44:23 -0800 From: Jakub Slepecki To: intel-wired-lan@lists.osuosl.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, michal.swiatkowski@linux.intel.com, jakub.slepecki@intel.com, aleksandr.loktionov@intel.com Date: Wed, 4 Feb 2026 16:44:13 +0100 Message-ID: <20260204154418.1285309-3-jakub.slepecki@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260204154418.1285309-1-jakub.slepecki@intel.com> References: <20260204154418.1285309-1-jakub.slepecki@intel.com> MIME-Version: 1.0 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770219866; x=1801755866; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JWmvUqaxGBDpmxTflwTsgJtVOJVahu8eyBgHP2/Rcdo=; b=LE6/xRd6KnwS4BIC3dG0IiWxf0uJUkQYZ1a24hgPxh9ynzh85C3UpRPR J08gK9XuCFC4+pOrCgq59KcNv6zzAPXz6dIdr7GkeUg540Lssal79Y+o1 sf+XR1+Cg2fclaWo1wMUK48tq7XWpFe7+q9iDo5iYTT4f3iQ4/HEczu6m 2k2LRrExMXwLeV1tMtE4SbZxxK5z68s3nDfl1d6ikSgodrqvNQ3q6IP7q 8+2Qr/5C4+x0R+DJg+1teQXl6oundqwGZxEKpTxwBqL91ovxM3tKi063C daMub3zyvnEWhZFSv/Kvg1Ys/leX9kueKlVLlWEceM2MvcSrkWJSG0lqx Q==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=LE6/xRd6 Subject: [Intel-wired-lan] [PATCH iwl-next v4 2/7] ice: allow creating mac, vlan filters along mac filters 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" Among other uses, MAC filters are currently used to forward loopback traffic between VSIs. However, they only match destination MAC addresses making them prone to mistakes when handling traffic within multiple VLANs and especially across the boundaries. Allows the driver to create MAC,VLAN filters in the same flow as MAC-only filters completely interchangeably. This is intended to be used to forward the loopback traffic only within the boundaries of particular VLANs. Reviewed-by: Michal Swiatkowski Reviewed-by: Aleksandr Loktionov Signed-off-by: Jakub Slepecki Tested-by: Rafal Romanowski --- No changes in v4. No changes in v3. No changes in v2. --- drivers/net/ethernet/intel/ice/ice_switch.c | 48 ++++++++++++++++----- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 84848f0123e7..0275e2910c6b 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -3606,6 +3606,29 @@ bool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle) return false; } +/** + * ice_fltr_mac_address - Find MAC in filter + * @dst: output MAC address + * @info: information struct for the filter in question + * + * Return: 0 for success, %-ENXIO if no address was found in the filter + * information. + */ +static +int ice_fltr_mac_address(u8 *dst, struct ice_fltr_info *info) +{ + switch (info->lkup_type) { + case ICE_SW_LKUP_MAC: + ether_addr_copy(dst, info->l_data.mac.mac_addr); + return 0; + case ICE_SW_LKUP_MAC_VLAN: + ether_addr_copy(dst, info->l_data.mac_vlan.mac_addr); + return 0; + default: + return -ENXIO; + } +} + /** * ice_add_mac - Add a MAC address based filter rule * @hw: pointer to the hardware structure @@ -3614,16 +3637,19 @@ bool ice_vlan_fltr_exist(struct ice_hw *hw, u16 vlan_id, u16 vsi_handle) int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) { struct ice_fltr_list_entry *m_list_itr; - int status = 0; + int err; if (!m_list || !hw) return -EINVAL; list_for_each_entry(m_list_itr, m_list, list_entry) { - u8 *add = &m_list_itr->fltr_info.l_data.mac.mac_addr[0]; + u8 addr[ETH_ALEN]; u16 vsi_handle; u16 hw_vsi_id; + err = ice_fltr_mac_address(addr, &m_list_itr->fltr_info); + if (err || is_zero_ether_addr(addr)) + return -EINVAL; m_list_itr->fltr_info.flag = ICE_FLTR_TX; vsi_handle = m_list_itr->fltr_info.vsi_handle; if (!ice_is_vsi_valid(hw, vsi_handle)) @@ -3634,17 +3660,19 @@ int ice_add_mac(struct ice_hw *hw, struct list_head *m_list) if (m_list_itr->fltr_info.src_id != ICE_SRC_ID_VSI) return -EINVAL; m_list_itr->fltr_info.src = hw_vsi_id; - if (m_list_itr->fltr_info.lkup_type != ICE_SW_LKUP_MAC || - is_zero_ether_addr(add)) + if (m_list_itr->fltr_info.lkup_type != ICE_SW_LKUP_MAC && + m_list_itr->fltr_info.lkup_type != ICE_SW_LKUP_MAC_VLAN) return -EINVAL; - m_list_itr->status = ice_add_rule_internal(hw, ICE_SW_LKUP_MAC, - m_list_itr); + m_list_itr->status = + ice_add_rule_internal(hw, + m_list_itr->fltr_info.lkup_type, + m_list_itr); if (m_list_itr->status) return m_list_itr->status; } - return status; + return 0; } /** @@ -4055,7 +4083,7 @@ int ice_remove_mac(struct ice_hw *hw, struct list_head *m_list) enum ice_sw_lkup_type l_type = list_itr->fltr_info.lkup_type; u16 vsi_handle; - if (l_type != ICE_SW_LKUP_MAC) + if (l_type != ICE_SW_LKUP_MAC && l_type != ICE_SW_LKUP_MAC_VLAN) return -EINVAL; vsi_handle = list_itr->fltr_info.vsi_handle; @@ -4066,7 +4094,7 @@ int ice_remove_mac(struct ice_hw *hw, struct list_head *m_list) ice_get_hw_vsi_num(hw, vsi_handle); list_itr->status = ice_remove_rule_internal(hw, - ICE_SW_LKUP_MAC, + l_type, list_itr); if (list_itr->status) return list_itr->status; @@ -4507,6 +4535,7 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, switch (lkup) { case ICE_SW_LKUP_MAC: + case ICE_SW_LKUP_MAC_VLAN: ice_remove_mac(hw, &remove_list_head); break; case ICE_SW_LKUP_VLAN: @@ -4516,7 +4545,6 @@ ice_remove_vsi_lkup_fltr(struct ice_hw *hw, u16 vsi_handle, case ICE_SW_LKUP_PROMISC_VLAN: ice_remove_promisc(hw, lkup, &remove_list_head); break; - case ICE_SW_LKUP_MAC_VLAN: case ICE_SW_LKUP_ETHERTYPE: case ICE_SW_LKUP_ETHERTYPE_MAC: case ICE_SW_LKUP_DFLT: From patchwork Wed Feb 4 04:44:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Slepecki X-Patchwork-Id: 2193053 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=1gBM8+6S; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4f5l646fypz1xpg for ; Thu, 05 Feb 2026 02:44:44 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4F6E96105A; Wed, 4 Feb 2026 15:44:38 +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 XM2ZVlJlNuC2; Wed, 4 Feb 2026 15:44:35 +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 F1455610B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1770219874; bh=kNSPUkMn+4jd2EtoaMs0Jl1E0LSfQYPIgtw85UsoAQ0=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=1gBM8+6S6xA46BMJhTTJUWIFf/1ju7eE1Qf44HIg4YiVx1BYYBNlEY+2YDk/4I07M vO/WjgJgIKyJdFekQvaZTRaNI9EqeMPDwcfPrukRFmuNaEpvqvUq60JCIDyfuJoEnT 1tC7ygWKPOsvmIqHkqbw08xpmMUMyagWRqFq9QDN6FLGI36MLHHRSgSCln5LLcngwL OKS4ANhzQGwownSX5lGDidGOv81TxP1ro+GhOii9rwoLrm/8Np7oDmXbQ4Mj6u8CAp xW5Ps+j06V8uVkyg/0Ndz6ANHBf1cwZoVwFVpYG5qkE8wV3qlSVgw2+UF39T/iVS9q 5wq48if3yp0DQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id F1455610B1; Wed, 4 Feb 2026 15:44:33 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id 9F647F5 for ; Wed, 4 Feb 2026 15:44:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 8019480B3F for ; Wed, 4 Feb 2026 15:44:29 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id jPvAbDoj0F7c for ; Wed, 4 Feb 2026 15:44:28 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.8; helo=mgamail.intel.com; envelope-from=jakub.slepecki@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 484F380A79 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 484F380A79 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by smtp1.osuosl.org (Postfix) with ESMTPS id 484F380A79 for ; Wed, 4 Feb 2026 15:44:28 +0000 (UTC) X-CSE-ConnectionGUID: Qg6jo6xeQme0OwRNmIk6rA== X-CSE-MsgGUID: LaMve96lTcqQ3JgN+a51JA== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="88987095" X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="88987095" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 07:44:28 -0800 X-CSE-ConnectionGUID: yBmta7mfQ8+a1p3dhQUvbA== X-CSE-MsgGUID: +nldAG6bQ7Cu9jKtAMF2nw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="209494121" Received: from hpe-dl385gen10.igk.intel.com ([10.91.240.117]) by orviesa010.jf.intel.com with ESMTP; 04 Feb 2026 07:44:26 -0800 From: Jakub Slepecki To: intel-wired-lan@lists.osuosl.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, michal.swiatkowski@linux.intel.com, jakub.slepecki@intel.com, aleksandr.loktionov@intel.com Date: Wed, 4 Feb 2026 16:44:14 +0100 Message-ID: <20260204154418.1285309-4-jakub.slepecki@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260204154418.1285309-1-jakub.slepecki@intel.com> References: <20260204154418.1285309-1-jakub.slepecki@intel.com> MIME-Version: 1.0 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770219868; x=1801755868; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Jlx1HM4WhK92C63jv0PewtEGzcL37nDTi+iriH0kgzk=; b=aHcPivog6DkbdZVRUsMKPFsEvsUj8O4TkpCI278ljLOBTC3XPvujT4u8 5znGPm1SfgNPxSKEORRwGs0ZnHcjiLHLiOW8H6fu3X+jOVpAJzbfXZ86H 85nZRI1Gi5z1lfbno9nqdoRf+RHRI3c461LgY0YOTT8/+V0vtdMbn8fDq rdUhu99h6/mrbM5KdM5yJeUACGpAXFhbRQ7zYo1jcqsarlpmF8kefZ7ue pRAbttuk+Eqaei2V8nS47Ikms2sm1vBrMHNRAn/oDb+1GFYpBrOcdGQTr LEU9tLxNciNAglRg7CNV85rYJZg8JLWGpXVsupxxQmbcOm9DbOtNWNsGG Q==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=aHcPivog Subject: [Intel-wired-lan] [PATCH iwl-next v4 3/7] ice: allow overriding lan_en, lb_en in switch 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" Currently, lan_en and lb_en are determined based on switching mode, destination MAC, and the lookup type, action type and flags of the rule in question. This gives little to no options for the user (such as ice_fltr.c) to enforce rules to behave in a specific way. Such functionality is needed to work with pairs of rules, for example, when handling MAC forward to LAN together with MAC,VLAN forward to loopback rules pair. This case could not be easily deduced in a context of a single filter without adding some guessing logic or a specialized flag. Add a slightly more generic flag to the lan_en and lb_en themselves for the ice_fltr.c to request specific destination flags later on, for example, to override both values: struct ice_fltr_info fi; fi.lb_en = ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED; fi.lan_en = ICE_FLTR_INFO_LB_LAN_FORCE_DISABLED; Reviewed-by: Aleksandr Loktionov Signed-off-by: Jakub Slepecki Tested-by: Rafal Romanowski --- Added R-B from Aleksandr as we talked live and he reviewed the changes. No changes in v4. Changes in v3: - LB_LAN masks and values no longer rely on boolean promotion. - ice_fill_sw_info() deals with u8 the entire time instead of building building lb_en and lan_en values at the end from booleans. Changes in v2: - Use FIELD_GET et al. when handling fi.lb_en and fi.lan_en. - Rename /LB_LAN/s/_MASK/_M/ because one of uses would need to break line --- drivers/net/ethernet/intel/ice/ice_switch.c | 25 +++++++++++++-------- drivers/net/ethernet/intel/ice/ice_switch.h | 19 +++++++++++++--- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 04e5d653efce..3caccd798220 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -2534,12 +2534,14 @@ int ice_get_initial_sw_cfg(struct ice_hw *hw) * * This helper function populates the lb_en and lan_en elements of the provided * ice_fltr_info struct using the switch's type and characteristics of the - * switch rule being configured. + * switch rule being configured. Elements are updated only if their FORCE bit + * is not set. */ static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi) { - fi->lb_en = false; - fi->lan_en = false; + u8 lan_en = fi->lan_en; + u8 lb_en = fi->lb_en; + if ((fi->flag & ICE_FLTR_TX) && (fi->fltr_act == ICE_FWD_TO_VSI || fi->fltr_act == ICE_FWD_TO_VSI_LIST || @@ -2549,7 +2551,7 @@ static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi) * packets to the internal switch that will be dropped. */ if (fi->lkup_type != ICE_SW_LKUP_VLAN) - fi->lb_en = true; + FIELD_MODIFY(ICE_FLTR_INFO_LB_LAN_VALUE_M, &lb_en, 1); /* Set lan_en to TRUE if * 1. The switch is a VEB AND @@ -2578,14 +2580,19 @@ static void ice_fill_sw_info(struct ice_hw *hw, struct ice_fltr_info *fi) !is_unicast_ether_addr(fi->l_data.mac.mac_addr)) || (fi->lkup_type == ICE_SW_LKUP_MAC_VLAN && !is_unicast_ether_addr(fi->l_data.mac.mac_addr))) - fi->lan_en = true; + FIELD_MODIFY(ICE_FLTR_INFO_LB_LAN_VALUE_M, + &lan_en, 1); } else { - fi->lan_en = true; + FIELD_MODIFY(ICE_FLTR_INFO_LB_LAN_VALUE_M, &lan_en, 1); } } if (fi->flag & ICE_FLTR_TX_ONLY) - fi->lan_en = false; + FIELD_MODIFY(ICE_FLTR_INFO_LB_LAN_VALUE_M, &lan_en, 0); + if (!FIELD_GET(ICE_FLTR_INFO_LB_LAN_FORCE_M, lb_en)) + fi->lb_en = lb_en; + if (!FIELD_GET(ICE_FLTR_INFO_LB_LAN_FORCE_M, lan_en)) + fi->lan_en = lan_en; } /** @@ -2669,9 +2676,9 @@ ice_fill_sw_rule(struct ice_hw *hw, struct ice_fltr_info *f_info, return; } - if (f_info->lb_en) + if (FIELD_GET(ICE_FLTR_INFO_LB_LAN_VALUE_M, f_info->lb_en)) act |= ICE_SINGLE_ACT_LB_ENABLE; - if (f_info->lan_en) + if (FIELD_GET(ICE_FLTR_INFO_LB_LAN_VALUE_M, f_info->lan_en)) act |= ICE_SINGLE_ACT_LAN_ENABLE; switch (f_info->lkup_type) { diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h index 671d7a5f359f..137eae878ab1 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.h +++ b/drivers/net/ethernet/intel/ice/ice_switch.h @@ -72,6 +72,14 @@ enum ice_src_id { ICE_SRC_ID_LPORT, }; +#define ICE_FLTR_INFO_LB_LAN_VALUE_M BIT(0) +#define ICE_FLTR_INFO_LB_LAN_FORCE_M BIT(1) +#define ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED \ + (FIELD_PREP_CONST(ICE_FLTR_INFO_LB_LAN_VALUE_M, 1) | \ + FIELD_PREP_CONST(ICE_FLTR_INFO_LB_LAN_FORCE_M, 1)) +#define ICE_FLTR_INFO_LB_LAN_FORCE_DISABLED \ + (FIELD_PREP_CONST(ICE_FLTR_INFO_LB_LAN_FORCE_M, 1)) + struct ice_fltr_info { /* Look up information: how to look up packet */ enum ice_sw_lkup_type lkup_type; @@ -131,9 +139,14 @@ struct ice_fltr_info { */ u8 qgrp_size; - /* Rule creations populate these indicators basing on the switch type */ - u8 lb_en; /* Indicate if packet can be looped back */ - u8 lan_en; /* Indicate if packet can be forwarded to the uplink */ + /* Following members have two bits: VALUE and FORCE. Rule creation will + * populate VALUE bit of these members based on switch type, but only if + * their FORCE bit is not set. + * + * See ICE_FLTR_INFO_LB_LAN_VALUE_M and ICE_FLTR_INFO_LB_LAN_FORCE_M. + */ + u8 lb_en; /* VALUE bit: packet can be looped back */ + u8 lan_en; /* VALUE bit: packet can be forwarded to the uplink */ }; struct ice_update_recipe_lkup_idx_params { From patchwork Wed Feb 4 04:44:15 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Slepecki X-Patchwork-Id: 2193054 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=O6BHHk27; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4f5l676jFTz1xpg for ; Thu, 05 Feb 2026 02:44:47 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2A8DE60FA2; Wed, 4 Feb 2026 15:44:39 +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 Z96c4hz0SOwM; Wed, 4 Feb 2026 15:44:37 +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 2F6B2610C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1770219875; bh=uKyNx8lMoHJQ/Jfxt76k9bG+ZskJPSeHH3I+fJIkJSA=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=O6BHHk27RB6R9cypMisO40VB2NsUtw+yM0UL3/x+K9waRh6TKPvNj10HYdeuH47SE 6K5MvHRbEXthvsgPD52FN8BDwOq5j7vaHFXW8ParSw9d/K06edViXg1v9NvZYQCoWM 5FRTVV10XYgmXEwArui4jI4y9sbtevVwBbSOP6gfsKfO/GYZ0pZyNSl2/jLGf8D2DY fqpq09Yqx7Igo41yV/HHSgp50U4rTkeoDWfioTEd03Dg4EeAoxvzlyhAm6xENv98VH 2WrPEklahq7Iw1ruOdvu5rfk/bNkO1WdCsLAkvFnldJkYBw2W5dY50GRhbRrpDzG8O VbX5OQVOURM9g== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 2F6B2610C3; Wed, 4 Feb 2026 15:44:35 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id 8C206F5 for ; Wed, 4 Feb 2026 15:44:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7C0A280CA6 for ; Wed, 4 Feb 2026 15:44:31 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id c1Vk3Puay-f4 for ; Wed, 4 Feb 2026 15:44:30 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.8; helo=mgamail.intel.com; envelope-from=jakub.slepecki@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 79C6980B3F DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 79C6980B3F Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by smtp1.osuosl.org (Postfix) with ESMTPS id 79C6980B3F for ; Wed, 4 Feb 2026 15:44:30 +0000 (UTC) X-CSE-ConnectionGUID: cn7EktiQS0uVa7OJvTxKqg== X-CSE-MsgGUID: ZjYNE0WxS/iRhN/4cRc2Dw== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="88987101" X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="88987101" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 07:44:30 -0800 X-CSE-ConnectionGUID: cFOsk7zVSginhXY31HNwMw== X-CSE-MsgGUID: a+e4FSwITle8ySiOHsA5fQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="209494127" Received: from hpe-dl385gen10.igk.intel.com ([10.91.240.117]) by orviesa010.jf.intel.com with ESMTP; 04 Feb 2026 07:44:28 -0800 From: Jakub Slepecki To: intel-wired-lan@lists.osuosl.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, michal.swiatkowski@linux.intel.com, jakub.slepecki@intel.com, aleksandr.loktionov@intel.com Date: Wed, 4 Feb 2026 16:44:15 +0100 Message-ID: <20260204154418.1285309-5-jakub.slepecki@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260204154418.1285309-1-jakub.slepecki@intel.com> References: <20260204154418.1285309-1-jakub.slepecki@intel.com> MIME-Version: 1.0 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770219870; x=1801755870; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VtWdhFUE9gOJbP7DjdO6rFEgJIeaxW8Qh0Bpnc0ITuA=; b=JjJyxBH/oeAHWOikgpSSFyKEG++wECuThyfIkD1Uy9+m/DBhdtBHLIbI AHOmZ8LAKImtBWnCHjaXVzf04rlOdffZtJcQ3lEb3TkC5N3OQR7K/LKhE Dz2n71eoNchcKC4JgCg5qitzFlZaXHBr5DaBsTPL8dHw+A42LJ/yZdx23 MXwLYNrOfDjFz8WIj6rR9s+N9tptk0ko1Hs1OfWzWiRpNxD/8VqR0Scg4 T1eud4btzML/i+gnz9K6dtjbfm/17Mv3tWnpXTHLaRNtTYYKrHsWMdrLX 3VAEFHr6f/9sPNoeU+XqyYeBT/Ts3TioVKiiLgWoroJW2x1SLvGzo7tpf g==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=JjJyxBH/ Subject: [Intel-wired-lan] [PATCH iwl-next v4 4/7] ice: update mac, vlan rules when toggling between VEB and VEPA 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" When changing into VEPA mode MAC rules are modified to forward all traffic to the wire instead of allowing some packets to go into the loopback. MAC,VLAN rules may and will also be used to forward loopback traffic in VEB, so when we switch to VEPA, we want them to behave similarly to MAC-only rules. ice_vsi_update_bridge_mode() will now attempt a rollback of switch filters in case an update fails. If the rollback also fails, we will now return the rollback error instead of the initial error. Reviewed-by: Aleksandr Loktionov Signed-off-by: Jakub Slepecki Tested-by: Rafal Romanowski --- Testing hints: MAC,VLAN rules are created only if entire series is applied. The easiest way to test that rules were adjusted is to run traffic and observe what packets are sent to LAN. VEPA is expected to behave same as before the series. VEB is expected to (a) behave like VEPA if loopback traffic would cross VLANs, or (b) behave as before. Traffic from/to external hosts is expected to remain unchanged. Refer to cover letter (0/7) for full network configuration. To change hwmode use: # bridge link set dev $pf hwmode {veb,vepa} No changes in v4. Changes in v3: - Refer to reproduction in cover letter in current 4/7. Changes in v2: - Close open parenthesis in ice_vsi_update_bridge_mode() description. - Explain returns in ice_vsi_update_bridge_mode(). --- drivers/net/ethernet/intel/ice/ice_main.c | 48 +++++++++++++++++---- drivers/net/ethernet/intel/ice/ice_switch.c | 8 ++-- drivers/net/ethernet/intel/ice/ice_switch.h | 3 +- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index cb80b77d29fd..7b3ab69b8300 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -8208,8 +8208,16 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode) * * Sets the bridge mode (VEB/VEPA) of the switch to which the netdev (VSI) is * hooked up to. Iterates through the PF VSI list and sets the loopback mode (if - * not already set for all VSIs connected to this switch. And also update the + * not already set for all VSIs connected to this switch). And also update the * unicast switch filter rules for the corresponding switch of the netdev. + * + * Return: + * * %0 if mode was set, propagated to VSIs, and changes to filters were all + * successful, + * * %-EINVAL if requested netlink attributes or bridge mode were invalid, + * * otherwise an error from VSI update, filter rollback, or filter update is + * forwarded. This may include %-EINVAL. See ice_vsi_update_bridge_mode() and + * ice_update_sw_rule_bridge_mode(). */ static int ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, @@ -8219,8 +8227,8 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, struct ice_pf *pf = ice_netdev_to_pf(dev); struct nlattr *attr, *br_spec; struct ice_hw *hw = &pf->hw; + int rem, v, rb_err, err = 0; struct ice_sw *pf_sw; - int rem, v, err = 0; pf_sw = pf->first_sw; /* find the attribute in the netlink message */ @@ -8230,6 +8238,7 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, nla_for_each_nested_type(attr, IFLA_BRIDGE_MODE, br_spec, rem) { __u16 mode = nla_get_u16(attr); + u8 old_evb_veb = hw->evb_veb; if (mode != BRIDGE_MODE_VEPA && mode != BRIDGE_MODE_VEB) return -EINVAL; @@ -8251,17 +8260,38 @@ ice_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh, /* Update the unicast switch filter rules for the corresponding * switch of the netdev */ - err = ice_update_sw_rule_bridge_mode(hw); + err = ice_update_sw_rule_bridge_mode(hw, ICE_SW_LKUP_MAC); + if (err) { + /* evb_veb is expected to be already reverted in error + * path because of the potential rollback. + */ + hw->evb_veb = old_evb_veb; + goto err_without_rollback; + } + err = ice_update_sw_rule_bridge_mode(hw, ICE_SW_LKUP_MAC_VLAN); if (err) { - netdev_err(dev, "switch rule update failed, mode = %d err %d aq_err %s\n", - mode, err, + /* ice_update_sw_rule_bridge_mode looks this up, so we + * must revert it before attempting a rollback. + */ + hw->evb_veb = old_evb_veb; + goto err_rollback_mac; + } + pf_sw->bridge_mode = mode; + continue; + +err_rollback_mac: + rb_err = ice_update_sw_rule_bridge_mode(hw, ICE_SW_LKUP_MAC); + if (rb_err) { + netdev_err(dev, "switch rule update failed, mode = %d err %d; rollback failed, err %d aq_err %s\n", + mode, err, rb_err, libie_aq_str(hw->adminq.sq_last_status)); - /* revert hw->evb_veb */ - hw->evb_veb = (pf_sw->bridge_mode == BRIDGE_MODE_VEB); - return err; + return rb_err; } - pf_sw->bridge_mode = mode; +err_without_rollback: + netdev_err(dev, "switch rule update failed, mode = %d err %d aq_err %s\n", + mode, err, libie_aq_str(hw->adminq.sq_last_status)); + return err; } return 0; diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 3caccd798220..3b526383b8ed 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -3067,10 +3067,12 @@ ice_update_pkt_fwd_rule(struct ice_hw *hw, struct ice_fltr_info *f_info) /** * ice_update_sw_rule_bridge_mode * @hw: pointer to the HW struct + * @lkup: recipe/lookup type to update * * Updates unicast switch filter rules based on VEB/VEPA mode */ -int ice_update_sw_rule_bridge_mode(struct ice_hw *hw) +int ice_update_sw_rule_bridge_mode(struct ice_hw *hw, + enum ice_sw_lkup_type lkup) { struct ice_switch_info *sw = hw->switch_info; struct ice_fltr_mgmt_list_entry *fm_entry; @@ -3078,8 +3080,8 @@ int ice_update_sw_rule_bridge_mode(struct ice_hw *hw) struct mutex *rule_lock; /* Lock to protect filter rule list */ int status = 0; - rule_lock = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rule_lock; - rule_head = &sw->recp_list[ICE_SW_LKUP_MAC].filt_rules; + rule_lock = &sw->recp_list[lkup].filt_rule_lock; + rule_head = &sw->recp_list[lkup].filt_rules; mutex_lock(rule_lock); list_for_each_entry(fm_entry, rule_head, list_entry) { diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h index 137eae878ab1..b442db4a2ce5 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.h +++ b/drivers/net/ethernet/intel/ice/ice_switch.h @@ -366,7 +366,8 @@ int ice_add_adv_rule(struct ice_hw *hw, struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, struct ice_adv_rule_info *rinfo, struct ice_rule_query_data *added_entry); -int ice_update_sw_rule_bridge_mode(struct ice_hw *hw); +int ice_update_sw_rule_bridge_mode(struct ice_hw *hw, + enum ice_sw_lkup_type lkup); int ice_add_vlan(struct ice_hw *hw, struct list_head *m_list); int ice_remove_vlan(struct ice_hw *hw, struct list_head *v_list); int ice_add_mac(struct ice_hw *hw, struct list_head *m_lst); From patchwork Wed Feb 4 04:44:16 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Slepecki X-Patchwork-Id: 2193055 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=aKo25fd8; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4f5l6B2zZQz1xpg for ; Thu, 05 Feb 2026 02:44:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0AD2E60D7E; Wed, 4 Feb 2026 15:44:40 +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 TqCGowNSN2Dh; Wed, 4 Feb 2026 15:44:38 +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 8E59A610C8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1770219876; bh=C7FZGuDQTohwXgeGisHnQZD2kRajNLxYDyMBOWiC/SI=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=aKo25fd8nLSyxBdifWopqScc/ZMcfkGexEF69UjKbdHldgMROCEVs+tdoF4R6F5NP ZhLdu0pRclMPQqfgWWxAB5cAhzYGnEb2vSqpdNlJHfLmly4ARMFPJaP+8ESlMjZcDA Q6Q2ocUDCdHdt1FT5QqWGqgIS+lmAUIKV3S5Nki5kRIKhyS903xb2S6NDMaQufru61 vwNuPfgxFLO7ybKpqlvJj2yYge4BXDaNkHCIIcvpNNvKi3Gf6BgwgaLkG1e1qJIqiB JFeNB9X2+F5Uof+I/geN5A5nEGY1a3LtSQ35eK1WblOBVZr1yJwVruN8rxIzhkEZg8 3aXz32tjCQANw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 8E59A610C8; Wed, 4 Feb 2026 15:44:36 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id C97EFF4 for ; Wed, 4 Feb 2026 15:44:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C10F280DA2 for ; Wed, 4 Feb 2026 15:44:33 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 6LDaFNYyxlSw for ; Wed, 4 Feb 2026 15:44:32 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.8; helo=mgamail.intel.com; envelope-from=jakub.slepecki@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org C042980CA6 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org C042980CA6 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by smtp1.osuosl.org (Postfix) with ESMTPS id C042980CA6 for ; Wed, 4 Feb 2026 15:44:32 +0000 (UTC) X-CSE-ConnectionGUID: zuve9o+ERdSHj+X39DvloA== X-CSE-MsgGUID: LvlSFiaGTXGQsErcpvq3aw== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="88987108" X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="88987108" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 07:44:32 -0800 X-CSE-ConnectionGUID: NQERNJTwRwGdCp99zs+DDQ== X-CSE-MsgGUID: bt0nrMdZRry52fO+LEIbvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="209494131" Received: from hpe-dl385gen10.igk.intel.com ([10.91.240.117]) by orviesa010.jf.intel.com with ESMTP; 04 Feb 2026 07:44:30 -0800 From: Jakub Slepecki To: intel-wired-lan@lists.osuosl.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, michal.swiatkowski@linux.intel.com, jakub.slepecki@intel.com, aleksandr.loktionov@intel.com Date: Wed, 4 Feb 2026 16:44:16 +0100 Message-ID: <20260204154418.1285309-6-jakub.slepecki@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260204154418.1285309-1-jakub.slepecki@intel.com> References: <20260204154418.1285309-1-jakub.slepecki@intel.com> MIME-Version: 1.0 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770219873; x=1801755873; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e/SbG2tv+Vp5aAA6qUNCeSUnTaIUvHurv8Z6KAFxvRs=; b=mk7k41lMtXL30OhLHUAq3KwkkoZxYYZTomwKDGZerIcg1EsFstx5RVSe t177+39i178bkh1iTQh6u70QjV7ifxesNV6n9CP50pkzh+7Bt2HuKlhJA ydJRwfA4CYNZ48Au1OsRpaACH9fgd2zvdFQGs69qbs/I7U+0htQYiUlyv xv8gFyxyKznzcDrJLTSVkp0Bn6wGjFbhOEKM8ag9xhyt4u7O6TqV5euxU XwAyPFcH+WFwNocIS4/FFCjcawLg6+4YGgA+4jekScC5A08JzTQ5GvGK2 T8wL4Jm6tGRhmIA+3H1L+3qTbLkzzQBN1gc+XaVDl9UN2RweM8h4tKxp3 w==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=mk7k41lM Subject: [Intel-wired-lan] [PATCH iwl-next v4 5/7] ice: add functions to query for vsi's pvids 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" PVID information is set across two structs and several members depending primarily on DVM support and VSI type. Add function that guess whether PVID is set and where and allow to access raw VLAN ID set. This is intended to be used later on to decide what MAC{,VLAN} filters to set for a VSI. Reviewed-by: Michal Swiatkowski Reviewed-by: Aleksandr Loktionov Signed-off-by: Jakub Slepecki Tested-by: Rafal Romanowski --- No changes iv v4. No changes in v3. No changes in v2. --- drivers/net/ethernet/intel/ice/ice_lib.c | 56 ++++++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_lib.h | 2 + 2 files changed, 58 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index 041278caf8e3..ff4763cea2e5 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -4136,3 +4136,59 @@ void ice_vsi_update_l2tsel(struct ice_vsi *vsi, enum ice_l2tsel l2tsel) wr32(hw, qrx_context_offset, regval); } } + +/** + * ice_vsi_has_outer_pvid - check if VSI has outer Port VLAN ID assigned + * @info: props of VSI in question + * + * Return: true if VSI has outer PVID, false otherwise. + */ +static bool +ice_vsi_has_outer_pvid(const struct ice_aqc_vsi_props *info) +{ + return info->outer_vlan_flags & ICE_AQ_VSI_OUTER_VLAN_PORT_BASED_INSERT; +} + +/** + * ice_vsi_has_inner_pvid - check if VSI has inner Port VLAN ID assigned + * @info: props of VSI in question + * + * Return: true if VSI has inner PVID, false otherwise. + */ +static bool +ice_vsi_has_inner_pvid(const struct ice_aqc_vsi_props *info) +{ + return info->inner_vlan_flags & ICE_AQ_VSI_INNER_VLAN_INSERT_PVID; +} + +/** + * ice_vsi_has_pvid - check if VSI has Port VLAN ID assigned + * @vsi: VSI in question + * + * Return: true if VSI has either outer or inner PVID, false otherwise. + */ +bool +ice_vsi_has_pvid(struct ice_vsi *vsi) +{ + return ice_vsi_has_outer_pvid(&vsi->info) || + ice_vsi_has_inner_pvid(&vsi->info); +} + +/** + * ice_vsi_pvid - retrieve VSI's Port VLAN ID + * @vsi: VSI in question + * + * Return: VSI's PVID; it is valid only if ice_vsi_has_pvid is true. + */ +u16 +ice_vsi_pvid(struct ice_vsi *vsi) +{ + __le16 vlan_info = 0; + + if (ice_vsi_has_outer_pvid(&vsi->info)) + vlan_info = vsi->info.port_based_outer_vlan; + else if (ice_vsi_has_inner_pvid(&vsi->info)) + vlan_info = vsi->info.port_based_inner_vlan; + + return le16_to_cpu(vlan_info) & VLAN_VID_MASK; +} diff --git a/drivers/net/ethernet/intel/ice/ice_lib.h b/drivers/net/ethernet/intel/ice/ice_lib.h index 2d3168458891..46152e26a995 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.h +++ b/drivers/net/ethernet/intel/ice/ice_lib.h @@ -134,6 +134,8 @@ void ice_clear_feature_support(struct ice_pf *pf, enum ice_feature f); void ice_init_feature_support(struct ice_pf *pf); bool ice_vsi_is_rx_queue_active(struct ice_vsi *vsi); void ice_vsi_update_l2tsel(struct ice_vsi *vsi, enum ice_l2tsel l2tsel); +bool ice_vsi_has_pvid(struct ice_vsi *vsi); +u16 ice_vsi_pvid(struct ice_vsi *vsi); extern const struct netdev_queue_mgmt_ops ice_queue_mgmt_ops; From patchwork Wed Feb 4 04:44:17 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Slepecki X-Patchwork-Id: 2193056 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=3F1t35Ox; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4f5l6D3gclz1xpg for ; Thu, 05 Feb 2026 02:44:52 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 801D761073; Wed, 4 Feb 2026 15:44:41 +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 ImI21J3iH1dj; Wed, 4 Feb 2026 15:44:39 +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 E67E7610D0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1770219878; bh=8BXPZzJV0ibu0eH7V/NXqC/A1pBOBRP67oboFdk1MVA=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=3F1t35Oxy5MCPUdJkbbQCX7Y2Oe+/3malHHE044+V7gj0X944GAVwzQ1PQjBZb+7G IPdBFGvGtg006KTtSvgpEf02i+aoTdxukl5AjJcoD1fh0SVBnCCF+SG9LKEk1sYuCx lwdF7/McXZNTpFQDVej+gVkEB31CMmf3hg4RCkfnvObAS+IxZODEMVAv09/+VxX9Jx DheyPAH6LTLgnNS+pYegd8XtG8vsdSZYoUQq32t1MtGKf97b/G+T7TANRw4Q5AxLsn KTJneErsxnMHDIaft1TM1KPbtITNtAUXByn3up1DBdroKmrAymIpjn3RP4q1Jqy/ok XIhGI4S8uvj+g== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id E67E7610D0; Wed, 4 Feb 2026 15:44:37 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id 2E7C5F5 for ; Wed, 4 Feb 2026 15:44:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 19BF180E50 for ; Wed, 4 Feb 2026 15:44:36 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id pSFZwwI0TSdZ for ; Wed, 4 Feb 2026 15:44:35 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.8; helo=mgamail.intel.com; envelope-from=jakub.slepecki@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 16F6D80CA6 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 16F6D80CA6 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by smtp1.osuosl.org (Postfix) with ESMTPS id 16F6D80CA6 for ; Wed, 4 Feb 2026 15:44:35 +0000 (UTC) X-CSE-ConnectionGUID: /06/kmwESHqaIq/tW5Pvmg== X-CSE-MsgGUID: BMwYmS+WTXmI+6z8W7cK1A== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="88987114" X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="88987114" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 07:44:35 -0800 X-CSE-ConnectionGUID: dSAUQIflSTuYohwg3SIPYg== X-CSE-MsgGUID: Qp/7AQxdSsOPPRzlbTZHfQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="209494136" Received: from hpe-dl385gen10.igk.intel.com ([10.91.240.117]) by orviesa010.jf.intel.com with ESMTP; 04 Feb 2026 07:44:32 -0800 From: Jakub Slepecki To: intel-wired-lan@lists.osuosl.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, michal.swiatkowski@linux.intel.com, jakub.slepecki@intel.com, aleksandr.loktionov@intel.com Date: Wed, 4 Feb 2026 16:44:17 +0100 Message-ID: <20260204154418.1285309-7-jakub.slepecki@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260204154418.1285309-1-jakub.slepecki@intel.com> References: <20260204154418.1285309-1-jakub.slepecki@intel.com> MIME-Version: 1.0 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770219875; x=1801755875; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K0E7+UMYGPTimqdt5ibfjpZFUmqBu3rV8ubOJ6pR7tc=; b=i7HS1P/yUSO5GwgnChNqglh3qnciJeXHEpAjx0kG8tQtqwoQ/nUi3wM5 Mbozutd8SO0qha3UT0jWO28s90OXMjROkAPY91wXk+rfp+7wBzZNsstEd M+1Y9SmZyLad4tPNdIYfv1JgW8o/IlwmegKBv+SROWsB636CGtPMRfyrH qXKaXdoM7UvCpKcsb/a68jLvJpnJmIX/+GmDSLLqeRd3PqFQ218vRDHot oyBlrZ2a8OVooyaNvFc80QkU1W7xRRtvZDDu8PTj6IszwA6Rr42arZLuK niDybjSx/My5oUYe4/bW2P2p7V7aKmE0Sf67nxTLNqNUpKDJWjpdH08nn g==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=i7HS1P/y Subject: [Intel-wired-lan] [PATCH iwl-next v4 6/7] ice: add mac vlan to filter API 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: Michal Swiatkowski Allow mac vlan filters to be managed by filters API in ice driver. Together with mac-only filters they will be used to forward traffic intended for loopback in VEB mode. Signed-off-by: Michal Swiatkowski Reviewed-by: Aleksandr Loktionov Signed-off-by: Jakub Slepecki Tested-by: Rafal Romanowski --- No changes in v4. No changes in v3. No changes in v2. --- drivers/net/ethernet/intel/ice/ice_fltr.c | 33 +++++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_fltr.h | 4 +++ 2 files changed, 37 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.c b/drivers/net/ethernet/intel/ice/ice_fltr.c index aff7a141c30d..96a4e4b1b3fc 100644 --- a/drivers/net/ethernet/intel/ice/ice_fltr.c +++ b/drivers/net/ethernet/intel/ice/ice_fltr.c @@ -240,6 +240,39 @@ ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list, list); } +/** + * ice_fltr_add_mac_vlan_to_list - add MAC VLAN filter info to + * existing list + * @vsi: pointer to VSI struct + * @list: list to add filter info to + * @mac: MAC address to add + * @vlan_id: VLAN id to add + * @action: filter action + * + * Return: + * * 0 if entry for filter was added, or + * * %-ENOMEM if entry could not be allocated. + */ +int +ice_fltr_add_mac_vlan_to_list(struct ice_vsi *vsi, struct list_head *list, + const u8 *mac, u16 vlan_id, + enum ice_sw_fwd_act_type action) +{ + struct ice_fltr_info info = {}; + + info.flag = ICE_FLTR_TX; + info.src_id = ICE_SRC_ID_VSI; + info.lkup_type = ICE_SW_LKUP_MAC_VLAN; + info.fltr_act = action; + info.vsi_handle = vsi->idx; + + info.l_data.mac_vlan.vlan_id = vlan_id; + ether_addr_copy(info.l_data.mac_vlan.mac_addr, mac); + + return ice_fltr_add_entry_to_list(ice_pf_to_dev(vsi->back), &info, + list); +} + /** * ice_fltr_add_vlan_to_list - add VLAN filter info to exsisting list * @vsi: pointer to VSI struct diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.h b/drivers/net/ethernet/intel/ice/ice_fltr.h index 0f3dbc308eec..fb9ffb39be50 100644 --- a/drivers/net/ethernet/intel/ice/ice_fltr.h +++ b/drivers/net/ethernet/intel/ice/ice_fltr.h @@ -23,6 +23,10 @@ int ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list, const u8 *mac, enum ice_sw_fwd_act_type action); int +ice_fltr_add_mac_vlan_to_list(struct ice_vsi *vsi, struct list_head *list, + const u8 *mac, u16 vlan_id, + enum ice_sw_fwd_act_type action); +int ice_fltr_add_mac(struct ice_vsi *vsi, const u8 *mac, enum ice_sw_fwd_act_type action); int From patchwork Wed Feb 4 04:44:18 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Slepecki X-Patchwork-Id: 2193057 X-Patchwork-Delegate: anthony.l.nguyen@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=xjT0uY8m; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4f5l6H2Nw5z1xpg for ; Thu, 05 Feb 2026 02:44:55 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id E399361054; Wed, 4 Feb 2026 15:44:41 +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 HczJggumIhc1; Wed, 4 Feb 2026 15:44:41 +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 DD12D610B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1770219880; bh=+91DrlpujevDnrl1CdRDW34p13is/6pm1oMCd0UEwoo=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=xjT0uY8mGULOVK9LCCc8IiH6pZdbOcw7D8L/6L7kyhUAV2BTtOhqqYKiQG/WuAEsk 6hKpaSCkn3E1Vn1A1jJVmq6cWedIixndpo7T/fqP0o6DTCPDUl3OHX/jrw6zFmBUzq ooFJHUpn5mQHMmkToTOquE7Jcco34CAI0OJA6b3f02Me6V9Le0EA7ejBCuGrTxuC5p idEOZH2jg634jbUmlv+foUNWtcJGC+sgbHeJr3sUTW9ZoVdYPg9znkmeT9NpKXsk5C rBWZcyea2DP5BasiuZRvmjBXn/F0ClaekKfntTWqooDnVM2aontSFaUGrfewYvCmZI 5ZraMh1KJuuWQ== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id DD12D610B7; Wed, 4 Feb 2026 15:44:40 +0000 (UTC) X-Original-To: intel-wired-lan@lists.osuosl.org Delivered-To: intel-wired-lan@lists.osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists1.osuosl.org (Postfix) with ESMTP id E68EDF4 for ; Wed, 4 Feb 2026 15:44:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C808D80F9E for ; Wed, 4 Feb 2026 15:44:38 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gV1ugm-XlnOW for ; Wed, 4 Feb 2026 15:44:37 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=192.198.163.8; helo=mgamail.intel.com; envelope-from=jakub.slepecki@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 6B74D80EAB DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6B74D80EAB Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6B74D80EAB for ; Wed, 4 Feb 2026 15:44:37 +0000 (UTC) X-CSE-ConnectionGUID: oSnQUOitTF6fNwuc0tBF9A== X-CSE-MsgGUID: 4A94CRy2Rkm+YKZzc/JJzA== X-IronPort-AV: E=McAfee;i="6800,10657,11691"; a="88987119" X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="88987119" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2026 07:44:37 -0800 X-CSE-ConnectionGUID: qCR+cfYxTIezkzzbHzI5gw== X-CSE-MsgGUID: DE2VbgKGToqCRUb1ZvS2vQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,272,1763452800"; d="scan'208";a="209494139" Received: from hpe-dl385gen10.igk.intel.com ([10.91.240.117]) by orviesa010.jf.intel.com with ESMTP; 04 Feb 2026 07:44:35 -0800 From: Jakub Slepecki To: intel-wired-lan@lists.osuosl.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com, michal.swiatkowski@linux.intel.com, jakub.slepecki@intel.com, aleksandr.loktionov@intel.com Date: Wed, 4 Feb 2026 16:44:18 +0100 Message-ID: <20260204154418.1285309-8-jakub.slepecki@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260204154418.1285309-1-jakub.slepecki@intel.com> References: <20260204154418.1285309-1-jakub.slepecki@intel.com> MIME-Version: 1.0 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1770219877; x=1801755877; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OA7YBST+ChqQeXkJf5U12UWy57MshL8mMIrA8YW0jwA=; b=UqT3ljVQ0lArQddvcXNBNhtdhB3G3Vb7PLjik/WI0Ic8lvQUmJXDhWr3 GGB5x7EU4GdhzErbg7PqxWafzOrpTyYuxx7Rcfc+8CsdN6ZSyeZsoLFsh X/8phonWXyb6csnJlfcZHCucK9iRiegaAyPSlYGEtFk0anD8d8oiKRrx9 Z9JWMzmP3AHo3F9PHKFGvBE6uaq4Q0NwMscdYw+TOWNUBR3GMD7TMX9sZ kkn7VzaAUn99BaYNS4bFnMqCyFkHHEGzDJkJv051ihOqKnrlDvgq5LdiM y4iknEgZ5wtYlyVkS2Av0iufsNPhoR5ZGoUJiH2U1hd/uS1iU6P3bfY81 Q==; X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=UqT3ljVQ Subject: [Intel-wired-lan] [PATCH iwl-next v4 7/7] ice: in VEB, prevent "cross-vlan" traffic from hitting loopback 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" In Virtual Ethernet Bridge (VEB) mode, we use MAC filters to forward traffic between two VFs. We also use VLAN filters to prune potential destinations, so that they don't cross VLANs. In case a VF in VLAN X sends a packet to a MAC address matching another VF but in VLAN Y, both these filters will be hit. Packet will be sent to loopback-only to VF in VLAN Y, but VLAN filter will prune its VSI from the destination list leaving the packet stranded in the internal switch and thus dropped. Since there is no destination for the packet in the VLAN X, it should instead be sent to the wire. To fix this, we introduce MAC,VLAN filters in place of MAC-only filters if VSI is part of any VLAN. We consider VSI part of a VLAN if it has a PVID set, or if it has a specific VLAN filter and does not have a VLAN 0 filter. This approach does not attempt to fix interactions with upper devices. If an upper vlan device requests a separate MAC address filter resulting in a call to __dev_uc_sync, the VSI will start receiving all packets destined for this MAC and not just within the VLAN. I don't see a straight-forward way to resolve this: information about MAC and VLAN filters coming from kernel to driver is disconnected from one another and from the device that requests it. It could be worked around by, for example, tracking all upper devices with netdev notifications and adjusting the filters there. Hence, the scope is limited to VF traffic. Following situations were considered for VLAN filters additions, removal, or changes: 1. ice changes VF's vlan 2. VF is reset and rebuilt 3. vlan device attaches above a PF or a VF And same for MAC filters: 4. PF's MAC is changed 5. PF changes MAC of a VF 6. VF's MAC is changed 7. ndo_set_rx_mode et al When VLAN is assigned to a VF in (1), the affected VF is reset and rebuild. This makes (1) the same as (2). We end up with two cases where VLAN filters are added: (2) and (3). To correctly handle (1-2), we move the VLAN filters initialization before the MAC filters initialization, since MAC filters now depend on VLAN filters presence. These two handle PVID (or lack of thereof) and because they are always associated with a reset, we don't need to consider updating MAC and MAC,VLAN filters afterwards. In (3), we will always have a lower device that is expected to receive all packets for its MAC regardless of VLAN tag. Because of the caveat described above, we will do the same for each MAC address associated with the interface regardless of VLANs. The result is we only have MAC-only filters in this case. When we create MAC filters in (4-7) we now check for existing VLAN filters and depending on PVID and VLAN 0 presence we decide to create, respectively, a MAC and MAC,VLAN filter pair, or a MAC filter. This is done implicitly when requesting to remove old MAC and add new MAC, so no change is required to this flow. Reviewed-by: Michal Swiatkowski Reviewed-by: Aleksandr Loktionov Signed-off-by: Jakub Slepecki Tested-by: Rafal Romanowski --- Note the /a.s. dead/ branch in ice_fltr.c. I decided to make it explicit, but it can be merged into VLAN 0 branch as well (with or without a comment), because their final effect is exactly the same. No changes in v4. No changes in v3. No changes in v2. --- drivers/net/ethernet/intel/ice/ice_fltr.c | 71 +++++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_fltr.h | 6 +- drivers/net/ethernet/intel/ice/ice_main.c | 8 +-- drivers/net/ethernet/intel/ice/ice_switch.c | 2 +- drivers/net/ethernet/intel/ice/ice_switch.h | 2 + drivers/net/ethernet/intel/ice/ice_vf_lib.c | 8 +-- 6 files changed, 83 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.c b/drivers/net/ethernet/intel/ice/ice_fltr.c index 96a4e4b1b3fc..c0fc1bced167 100644 --- a/drivers/net/ethernet/intel/ice/ice_fltr.c +++ b/drivers/net/ethernet/intel/ice/ice_fltr.c @@ -3,6 +3,7 @@ #include "ice.h" #include "ice_fltr.h" +#include "ice_lib.h" /** * ice_fltr_free_list - free filter lists helper @@ -221,10 +222,12 @@ void ice_fltr_remove_all(struct ice_vsi *vsi) * @list: list to add filter info to * @mac: MAC address to add * @action: filter action + * @external: force the filter to enable lan destination */ int ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list, - const u8 *mac, enum ice_sw_fwd_act_type action) + const u8 *mac, enum ice_sw_fwd_act_type action, + bool external) { struct ice_fltr_info info = { 0 }; @@ -233,6 +236,10 @@ ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list, info.lkup_type = ICE_SW_LKUP_MAC; info.fltr_act = action; info.vsi_handle = vsi->idx; + if (external) { + info.lb_en = ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED; + info.lan_en = ICE_FLTR_INFO_LB_LAN_FORCE_ENABLED; + } ether_addr_copy(info.l_data.mac.mac_addr, mac); @@ -273,6 +280,62 @@ ice_fltr_add_mac_vlan_to_list(struct ice_vsi *vsi, struct list_head *list, list); } +/** + * ice_fltr_add_macs_to_list - add MAC and MAC,VLAN filters info to an existing + * list + * @vsi: pointer to VSI struct + * @list: list to add filter info to + * @mac: MAC address to add + * @action: filter action + * + * Return: + * * 0 on success, or + * * %-ENOMEM if entry for filter could not be allocated. + */ +int +ice_fltr_add_macs_to_list(struct ice_vsi *vsi, struct list_head *list, + const u8 *mac, enum ice_sw_fwd_act_type action) +{ + if (is_multicast_ether_addr(mac)) { + /* There is no point in doing the same gymnastics as below + * because multicast addresses are sent to both lan and lb then + * pruned as necessary. + */ + return ice_fltr_add_mac_to_list(vsi, list, mac, action, false); + } else if (ice_vsi_has_pvid(vsi)) { + u16 pvid = ice_vsi_pvid(vsi); + int ret; + + ret = ice_fltr_add_mac_to_list(vsi, list, mac, action, true); + if (ret) + return ret; + + return ice_fltr_add_mac_vlan_to_list(vsi, list, mac, pvid, + action); + } else if (vsi->num_vlan != ice_vsi_num_non_zero_vlans(vsi)) { + /* If VSI has VLAN 0 filters, then the interface is prepared to + * receive untagged packets. As of now, we simply don't have + * heuristics to decide which MAC is and is not part of which + * VLAN so we put them all in the same bucket. + */ + return ice_fltr_add_mac_to_list(vsi, list, mac, action, false); + } + + /* This branch is a.s. dead. There are three cases that may happen: + * + * - no vlans in sight; this is the VLAN 0 branch, + * - VF is assigned PVID; this is ice_vsi_has_pvid branch, + * - PF or VF is under vlan device; this is the VLAN 0 branch. + * + * This is where you would implement support for multiple VLANs but + * without the VLAN 0. This could happen if vlan upper device is + * assigned a MAC that is unique compared to lower ice device that is + * forced to accept any VLAN. This would imply MAC-only filter for one + * MAC address (PF) and MAC,VLAN+MAC filters for another (vlan). + */ + return ice_fltr_add_mac_to_list(vsi, list, mac, action, false); +} + /** * ice_fltr_add_vlan_to_list - add VLAN filter info to exsisting list * @vsi: pointer to VSI struct @@ -343,7 +406,7 @@ ice_fltr_prepare_mac(struct ice_vsi *vsi, const u8 *mac, LIST_HEAD(tmp_list); int result; - if (ice_fltr_add_mac_to_list(vsi, &tmp_list, mac, action)) { + if (ice_fltr_add_macs_to_list(vsi, &tmp_list, mac, action)) { ice_fltr_free_list(ice_pf_to_dev(vsi->back), &tmp_list); return -ENOMEM; } @@ -371,8 +434,8 @@ ice_fltr_prepare_mac_and_broadcast(struct ice_vsi *vsi, const u8 *mac, int result; eth_broadcast_addr(broadcast); - if (ice_fltr_add_mac_to_list(vsi, &tmp_list, mac, action) || - ice_fltr_add_mac_to_list(vsi, &tmp_list, broadcast, action)) { + if (ice_fltr_add_macs_to_list(vsi, &tmp_list, mac, action) || + ice_fltr_add_macs_to_list(vsi, &tmp_list, broadcast, action)) { ice_fltr_free_list(ice_pf_to_dev(vsi->back), &tmp_list); return -ENOMEM; } diff --git a/drivers/net/ethernet/intel/ice/ice_fltr.h b/drivers/net/ethernet/intel/ice/ice_fltr.h index fb9ffb39be50..ed3371b0a71f 100644 --- a/drivers/net/ethernet/intel/ice/ice_fltr.h +++ b/drivers/net/ethernet/intel/ice/ice_fltr.h @@ -21,12 +21,16 @@ ice_fltr_set_vsi_promisc(struct ice_hw *hw, u16 vsi_handle, u8 promisc_mask, u16 vid); int ice_fltr_add_mac_to_list(struct ice_vsi *vsi, struct list_head *list, - const u8 *mac, enum ice_sw_fwd_act_type action); + const u8 *mac, enum ice_sw_fwd_act_type action, + bool external); int ice_fltr_add_mac_vlan_to_list(struct ice_vsi *vsi, struct list_head *list, const u8 *mac, u16 vlan_id, enum ice_sw_fwd_act_type action); int +ice_fltr_add_macs_to_list(struct ice_vsi *vsi, struct list_head *list, + const u8 *mac, enum ice_sw_fwd_act_type action); +int ice_fltr_add_mac(struct ice_vsi *vsi, const u8 *mac, enum ice_sw_fwd_act_type action); int diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 7b3ab69b8300..b712e0c29fc2 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -212,8 +212,8 @@ static int ice_add_mac_to_sync_list(struct net_device *netdev, const u8 *addr) struct ice_netdev_priv *np = netdev_priv(netdev); struct ice_vsi *vsi = np->vsi; - if (ice_fltr_add_mac_to_list(vsi, &vsi->tmp_sync_list, addr, - ICE_FWD_TO_VSI)) + if (ice_fltr_add_macs_to_list(vsi, &vsi->tmp_sync_list, addr, + ICE_FWD_TO_VSI)) return -EINVAL; return 0; @@ -242,8 +242,8 @@ static int ice_add_mac_to_unsync_list(struct net_device *netdev, const u8 *addr) if (ether_addr_equal(addr, netdev->dev_addr)) return 0; - if (ice_fltr_add_mac_to_list(vsi, &vsi->tmp_unsync_list, addr, - ICE_FWD_TO_VSI)) + if (ice_fltr_add_macs_to_list(vsi, &vsi->tmp_unsync_list, addr, + ICE_FWD_TO_VSI)) return -EINVAL; return 0; diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c index 3b526383b8ed..13dd3448aec6 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.c +++ b/drivers/net/ethernet/intel/ice/ice_switch.c @@ -4018,7 +4018,7 @@ ice_cfg_dflt_vsi(struct ice_port_info *pi, u16 vsi_handle, bool set, * @fm_entry: filter entry to inspect * @vsi_handle: VSI handle to compare with filter info */ -static bool +bool ice_vsi_uses_fltr(struct ice_fltr_mgmt_list_entry *fm_entry, u16 vsi_handle) { return ((fm_entry->fltr_info.fltr_act == ICE_FWD_TO_VSI && diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h index b442db4a2ce5..a295130e96f3 100644 --- a/drivers/net/ethernet/intel/ice/ice_switch.h +++ b/drivers/net/ethernet/intel/ice/ice_switch.h @@ -346,6 +346,8 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); void ice_clear_all_vsi_ctx(struct ice_hw *hw); +bool ice_vsi_uses_fltr(struct ice_fltr_mgmt_list_entry *fm_entry, + u16 vsi_handle); /* Switch config */ int ice_get_initial_sw_cfg(struct ice_hw *hw); diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethernet/intel/ice/ice_vf_lib.c index de9e81ccee66..1031ce20bb60 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -501,14 +501,14 @@ static void ice_vf_rebuild_host_cfg(struct ice_vf *vf) ice_vf_set_host_trust_cfg(vf); - if (ice_vf_rebuild_host_mac_cfg(vf)) - dev_err(dev, "failed to rebuild default MAC configuration for VF %d\n", - vf->vf_id); - if (ice_vf_rebuild_host_vlan_cfg(vf, vsi)) dev_err(dev, "failed to rebuild VLAN configuration for VF %u\n", vf->vf_id); + if (ice_vf_rebuild_host_mac_cfg(vf)) + dev_err(dev, "failed to rebuild default MAC configuration for VF %d\n", + vf->vf_id); + if (ice_vf_rebuild_host_tx_rate_cfg(vf)) dev_err(dev, "failed to rebuild Tx rate limiting configuration for VF %u\n", vf->vf_id);