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 9CD14D2ECF7 for ; Tue, 20 Jan 2026 10:42:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 72D6A6FC8E; Tue, 20 Jan 2026 10:42:04 +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 FnBEng1GTxEE; Tue, 20 Jan 2026 10:42:03 +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 A3D786FC90 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1768905723; bh=DKslMA3PLZ/stWvwmlZQ+7DaMRonrplJb/lzfOCPK3o=; h=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=GrE7qPjLgawG+C9f+tAtK68AahUadAd/37o1mP1ID7Bnc5gfrpn5SNmb70wDCnKii xsAKQYxu8BVkKg62SzHGqFRxc9cInTYLavT8CEjrffmU5OaZ23hwVhJZ+6cC8gwXJ6 57L95hYWhXB2oSmBx/4itxXVsUA9voFERPoDho4bM9+1fqA5mfcfBeApE6fqd709We cDSTSkJJ+LEBTEtR+Dg35B7kV4hdYwG/AYK5BXIjlhj6SZrJKyVmtvDApBJYiTlfvO +H70Cbol23nIGOsLFVqsNN82cKNgcohrB9KAgjKWvTeql+/aJsxJDSjZi23+babxcu T09k+MPg6RgdA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id A3D786FC90; Tue, 20 Jan 2026 10:42:03 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists1.osuosl.org (Postfix) with ESMTP id E96B82A8 for ; Tue, 20 Jan 2026 10:42:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id D89B18587E for ; Tue, 20 Jan 2026 10:42:01 +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 2Qo36VFYCvD9 for ; Tue, 20 Jan 2026 10:42:01 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=198.175.65.18; helo=mgamail.intel.com; envelope-from=jakub.slepecki@intel.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org D701685857 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org D701685857 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by smtp1.osuosl.org (Postfix) with ESMTPS id D701685857 for ; Tue, 20 Jan 2026 10:42:00 +0000 (UTC) X-CSE-ConnectionGUID: C9sVKsO5QrqkTuKRx3fDzQ== X-CSE-MsgGUID: yRuunj6hQJK4CGFeOyBsoQ== X-IronPort-AV: E=McAfee;i="6800,10657,11676"; a="70161760" X-IronPort-AV: E=Sophos;i="6.21,240,1763452800"; d="scan'208";a="70161760" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2026 02:34:54 -0800 X-CSE-ConnectionGUID: aaZi9RX4Qvi+fkH9AuIx7w== X-CSE-MsgGUID: ysbXjQQjQPa08hbaFOLtxg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,240,1763452800"; d="scan'208";a="210935871" Received: from hpe-dl385gen10.igk.intel.com ([10.91.240.117]) by fmviesa004.fm.intel.com with ESMTP; 20 Jan 2026 02:34:53 -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: Tue, 20 Jan 2026 11:34:37 +0100 Message-ID: <20260120103440.892326-7-jakub.slepecki@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260120103440.892326-1-jakub.slepecki@intel.com> References: <20260120103440.892326-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 Content-Transfer-Encoding: 8bit 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=1768905721; x=1800441721; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oHweYp6PS9TtuF1WSau2FriMx/zNUIIprGncg141AXg=; b=nl8e5ZPzwnfqM50lbgBdoa0k516agqE9WvVnexSYJb92/z+RKI2bahhn MV6zMxyE0eNKU+U1S0oQQJe+pFO1ddGxeBZln8e9zCv39guWUCOj1bSUh fIxybS40d0R+c4/kqg/OC123ilHe1g860+eSEL4FV0EsVtNIRtRdqBjJJ KzBfUrMChBBzcK607hwQbli3khVZQYuW8aYHvLL3Upht8w9lrE1yJfrd5 yytl6MiPTTZSI+e4nkgzoBZKMIideOSYAEbbO8g1XqbK3nl0mQ/EJLQnH JvkyLIW2L3N7StZoNbFNiTlmXTHtXAgTn0xo4zpKsh+AGA/Jr7JaM0rcn 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=nl8e5ZPz Subject: [Intel-wired-lan] [PATCH iwl-next v3 6/8] 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 --- 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; -- 2.43.0