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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 538CFC83F2D for ; Mon, 4 Sep 2023 02:16:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 0B8E581E74; Mon, 4 Sep 2023 02:16:11 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 0B8E581E74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1693793771; bh=SwxGCChZn6WbDJnejlBhZwgyLHFN5Fg732jrVeD+y+k=; h=From:To:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=FxsXL2UeIoQNjjWlLzvZEkNWnBdJ6qK7KGL9smr61XFLvFUe9Jpg3kt8NH/70Hjd/ akHC08KftNd4k6jF/kkAEVDe0jAyViE7UNsdWAqa+Q81G4HjXm05O0piI3Wz/kRjOo Ug1GT5171K0JfxEb9EwzoGlrkbPPG634bVGp2D3xWDfQpm/YqnuteEbAOOT0HlJn4a XH2YCG+e5fMdy1uvfzTeZqJ/STXIyeBjVzjSUIeRCR5yisqRqFqsX2OYxvTXUr+n6M lirExcUvEpwE4GS8npvFGSKuOhp8bF0hXwMRExx6B4Y2MLv69uFLjTFNMKkPNjOape mBVnqBNRM5hwQ== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3KJnoqUrgv5R; Mon, 4 Sep 2023 02:16:10 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id F2C1B81EB3; Mon, 4 Sep 2023 02:16:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org F2C1B81EB3 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id B6D0B1BF360 for ; Mon, 4 Sep 2023 02:16:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 901CE81E74 for ; Mon, 4 Sep 2023 02:16:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 901CE81E74 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NNXvzoFAxv7P for ; Mon, 4 Sep 2023 02:16:02 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by smtp1.osuosl.org (Postfix) with ESMTPS id CCEAF81E17 for ; Mon, 4 Sep 2023 02:16:02 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org CCEAF81E17 X-IronPort-AV: E=McAfee;i="6600,9927,10822"; a="379215343" X-IronPort-AV: E=Sophos;i="6.02,225,1688454000"; d="scan'208";a="379215343" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2023 19:16:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10822"; a="769826949" X-IronPort-AV: E=Sophos;i="6.02,225,1688454000"; d="scan'208";a="769826949" Received: from dpdk-jf-ntb-v2.sh.intel.com ([10.67.119.19]) by orsmga008.jf.intel.com with ESMTP; 03 Sep 2023 19:15:58 -0700 From: Junfeng Guo To: intel-wired-lan@lists.osuosl.org Date: Mon, 4 Sep 2023 10:14:53 +0800 Message-Id: <20230904021455.3944605-14-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230904021455.3944605-1-junfeng.guo@intel.com> References: <20230904021455.3944605-1-junfeng.guo@intel.com> MIME-Version: 1.0 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=1693793762; x=1725329762; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/TrelpE8cu6lQnLypFm0G4KTqSDJFZgI/P0bx9U4Zxc=; b=ZHLynxmYK1vpVKZEqvr5cCBHh2mvnJ2W7zbbdvWJJ00a7ABtiR20coJr CSveUihG+TM592Kh9ydunVvPKZy+Eg+r4GpCgwZEI+fK3ru5P8ZW7BdM6 w5Agx/8bCiOSL20TSM/S2PKUoMzJyYTuUKUM4CHKnPHxkVPlrl5l/p0Lu 1vlZKIxFgwS2hxRkTIuZAT6Acnz5fnWrOQV6vkQWeH//5bDtjWb3LzyCC etx5KZBz99B7Wo4osYZBvz5bOoyxooWzvO83BTX+thU4LGuqdVGibSfuL TM1N1hZgd1crYylCWQ/W1aK8P8N92lPFeWsZlHwtamknvD0+H/DwyClMk Q==; 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=ZHLynxmY Subject: [Intel-wired-lan] [PATCH iwl-next v9 13/15] ice: support double vlan mode configure for parser X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ivecera@redhat.com, netdev@vger.kernel.org, qi.z.zhang@intel.com, jesse.brandeburg@intel.com, edumazet@google.com, anthony.l.nguyen@intel.com, horms@kernel.org, kuba@kernel.org, pabeni@redhat.com, davem@davemloft.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Add API ice_parser_dvm_set to support turn on/off parser's double vlan mode. Signed-off-by: Junfeng Guo --- drivers/net/ethernet/intel/ice/ice_bst_tcam.c | 17 +++++++++ drivers/net/ethernet/intel/ice/ice_bst_tcam.h | 4 +++ drivers/net/ethernet/intel/ice/ice_parser.c | 36 +++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_parser.h | 2 ++ 4 files changed, 59 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_bst_tcam.c b/drivers/net/ethernet/intel/ice/ice_bst_tcam.c index 99148f1cf4f1..8d7fda43b24c 100644 --- a/drivers/net/ethernet/intel/ice/ice_bst_tcam.c +++ b/drivers/net/ethernet/intel/ice/ice_bst_tcam.c @@ -334,3 +334,20 @@ ice_bst_tcam_match(struct ice_bst_tcam_item *tcam_table, u8 *pat) return NULL; } + +struct ice_bst_tcam_item * +ice_bst_tcam_search(struct ice_bst_tcam_item *tcam_table, + struct ice_lbl_item *lbl_table, + const char *prefix, u16 *start) +{ + u16 i = *start; + + for (; i < ICE_BST_TCAM_TABLE_SIZE; i++) { + if (strstarts(lbl_table[i].label, prefix)) { + *start = i; + return &tcam_table[lbl_table[i].idx]; + } + } + + return NULL; +} diff --git a/drivers/net/ethernet/intel/ice/ice_bst_tcam.h b/drivers/net/ethernet/intel/ice/ice_bst_tcam.h index 73a46dc56b29..c3ced00b4920 100644 --- a/drivers/net/ethernet/intel/ice/ice_bst_tcam.h +++ b/drivers/net/ethernet/intel/ice/ice_bst_tcam.h @@ -33,4 +33,8 @@ struct ice_lbl_item *ice_bst_lbl_table_get(struct ice_hw *hw); struct ice_bst_tcam_item * ice_bst_tcam_match(struct ice_bst_tcam_item *tcam_table, u8 *pat); +struct ice_bst_tcam_item * +ice_bst_tcam_search(struct ice_bst_tcam_item *tcam_table, + struct ice_lbl_item *lbl_table, + const char *prefix, u16 *start); #endif /*_ICE_BST_TCAM_H_ */ diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c index 1bd1417e32c6..5ce98cd303e1 100644 --- a/drivers/net/ethernet/intel/ice/ice_parser.c +++ b/drivers/net/ethernet/intel/ice/ice_parser.c @@ -325,3 +325,39 @@ void ice_parser_result_dump(struct ice_hw *hw, struct ice_parser_result *rslt) dev_info(ice_hw_to_dev(hw), "flags_fd = 0x%04x\n", rslt->flags_fd); dev_info(ice_hw_to_dev(hw), "flags_rss = 0x%04x\n", rslt->flags_rss); } + +#define ICE_BT_VLD_KEY 0xFF +#define ICE_BT_INV_KEY 0xFE + +static void _ice_bst_vm_set(struct ice_parser *psr, const char *prefix, + bool on) +{ + u16 i = 0; + + while (true) { + struct ice_bst_tcam_item *item; + + item = ice_bst_tcam_search(psr->bst_tcam_table, + psr->bst_lbl_table, + prefix, &i); + if (!item) + break; + + item->key[ICE_BT_VM_OFF] = + (u8)(on ? ICE_BT_VLD_KEY : ICE_BT_INV_KEY); + item->key_inv[ICE_BT_VM_OFF] = + (u8)(on ? ICE_BT_VLD_KEY : ICE_BT_INV_KEY); + i++; + } +} + +/** + * ice_parser_dvm_set - configure double vlan mode for parser + * @psr: pointer to a parser instance + * @on: true to turn on; false to turn off + */ +void ice_parser_dvm_set(struct ice_parser *psr, bool on) +{ + _ice_bst_vm_set(psr, "BOOST_MAC_VLAN_DVM", on); + _ice_bst_vm_set(psr, "BOOST_MAC_VLAN_SVM", !on); +} diff --git a/drivers/net/ethernet/intel/ice/ice_parser.h b/drivers/net/ethernet/intel/ice/ice_parser.h index bfcef4f597bf..c9eee988ebb2 100644 --- a/drivers/net/ethernet/intel/ice/ice_parser.h +++ b/drivers/net/ethernet/intel/ice/ice_parser.h @@ -33,6 +33,7 @@ #define ICE_SID_LBL_ENTRY_SIZE 66 #define ICE_PARSER_PROTO_OFF_PAIR_SIZE 16 +#define ICE_BT_VM_OFF 0 struct ice_parser { struct ice_hw *hw; /* pointer to the hardware structure */ @@ -74,6 +75,7 @@ struct ice_parser { int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr); void ice_parser_destroy(struct ice_parser *psr); +void ice_parser_dvm_set(struct ice_parser *psr, bool on); struct ice_parser_proto_off { u8 proto_id; /* hardware protocol ID */ -- 2.25.1 _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan