From patchwork Wed Aug 23 09:31:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Junfeng" X-Patchwork-Id: 13361933 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56996883A for ; Wed, 23 Aug 2023 09:32:23 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F22026BC for ; Wed, 23 Aug 2023 02:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1692783136; x=1724319136; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=K9x8FDf/YdpQXwHLWBnorxtFd/JUNWyZ5i86X1WOEOs=; b=Jm1MhefNKOxbcSdVAKFZDIqLXZB/JS5a8QqMQ5Sz7cCE2NOzZQMo6di7 uCbOHlWwWg6ObbLjHGIlxxizBIDNMRnlRMz7ZKEDMBpm/c8hR9eUMoRFl vWIYbHlMMBk06VeyUP+/j2KZozJ8r+2xZUPqkvIu3kklnjsurxJmgfZsh qe9yFeAoPT4tWCa2J/ET0X0ASUZVgzKRB1Wb8GrociFaEBSWiuWdi0xgm 5dyiuKRU0QkWugevINsvn+uOqBR7Rjs9L1PA280sLCo38gv+rqzp8x2Hy W7SeGQxsmyUKv9wBD9SaJQ5bEC7KweZJnY9WO+eiJCtTNtFOesN6BKrzo g==; X-IronPort-AV: E=McAfee;i="6600,9927,10810"; a="359100457" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="359100457" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Aug 2023 02:32:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10810"; a="713507420" X-IronPort-AV: E=Sophos;i="6.01,195,1684825200"; d="scan'208";a="713507420" Received: from dpdk-jf-ntb-v2.sh.intel.com ([10.67.119.19]) by orsmga006.jf.intel.com with ESMTP; 23 Aug 2023 02:32:04 -0700 From: Junfeng Guo To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com, jesse.brandeburg@intel.com, qi.z.zhang@intel.com, ivecera@redhat.com, sridhar.samudrala@intel.com, horms@kernel.org, Junfeng Guo Subject: [PATCH iwl-next v7 01/15] ice: add parser create and destroy skeleton Date: Wed, 23 Aug 2023 17:31:44 +0800 Message-Id: <20230823093158.782802-2-junfeng.guo@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230823093158.782802-1-junfeng.guo@intel.com> References: <20230821081438.2937934-1-junfeng.guo@intel.com> <20230823093158.782802-1-junfeng.guo@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add new parser module which can parse a packet in binary and generate information like ptype, protocol/offset pairs and flags which can be used to feed the FXP profile creation directly. The patch added skeleton of the create and destroy APIs: ice_parser_create ice_parser_destroy Signed-off-by: Junfeng Guo --- drivers/net/ethernet/intel/ice/ice_common.h | 4 +++ drivers/net/ethernet/intel/ice/ice_ddp.c | 10 +++---- drivers/net/ethernet/intel/ice/ice_ddp.h | 13 ++++++++ drivers/net/ethernet/intel/ice/ice_parser.c | 33 +++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_parser.h | 13 ++++++++ 5 files changed, 68 insertions(+), 5 deletions(-) create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.c create mode 100644 drivers/net/ethernet/intel/ice/ice_parser.h diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h index 8ba5f935a092..528dde976373 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.h +++ b/drivers/net/ethernet/intel/ice/ice_common.h @@ -9,10 +9,14 @@ #include "ice_type.h" #include "ice_nvm.h" #include "ice_flex_pipe.h" +#include "ice_parser.h" #include #include "ice_switch.h" #include "ice_fdir.h" +#define BITS_PER_WORD 16 +#define BITMAP_MASK(n) GENMASK(((n) - 1), 0) + #define ICE_SQ_SEND_DELAY_TIME_MS 10 #define ICE_SQ_SEND_MAX_EXECUTE 3 diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.c b/drivers/net/ethernet/intel/ice/ice_ddp.c index d71ed210f9c4..3bdf03b9ee71 100644 --- a/drivers/net/ethernet/intel/ice/ice_ddp.c +++ b/drivers/net/ethernet/intel/ice/ice_ddp.c @@ -288,11 +288,11 @@ void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state, * indicates a base offset of 10, and the index for the entry is 2, then * section handler function should set the offset to 10 + 2 = 12. */ -static void *ice_pkg_enum_entry(struct ice_seg *ice_seg, - struct ice_pkg_enum *state, u32 sect_type, - u32 *offset, - void *(*handler)(u32 sect_type, void *section, - u32 index, u32 *offset)) +void *ice_pkg_enum_entry(struct ice_seg *ice_seg, + struct ice_pkg_enum *state, u32 sect_type, + u32 *offset, + void *(*handler)(u32 sect_type, void *section, + u32 index, u32 *offset)) { void *entry; diff --git a/drivers/net/ethernet/intel/ice/ice_ddp.h b/drivers/net/ethernet/intel/ice/ice_ddp.h index 37eadb3d27a8..da5dfeed3b1f 100644 --- a/drivers/net/ethernet/intel/ice/ice_ddp.h +++ b/drivers/net/ethernet/intel/ice/ice_ddp.h @@ -238,10 +238,18 @@ struct ice_meta_sect { #define ICE_SID_CDID_KEY_BUILDER_RSS 47 #define ICE_SID_CDID_REDIR_RSS 48 +#define ICE_SID_RXPARSER_CAM 50 +#define ICE_SID_RXPARSER_NOMATCH_CAM 51 +#define ICE_SID_RXPARSER_IMEM 52 #define ICE_SID_RXPARSER_MARKER_PTYPE 55 #define ICE_SID_RXPARSER_BOOST_TCAM 56 +#define ICE_SID_RXPARSER_PROTO_GRP 57 #define ICE_SID_RXPARSER_METADATA_INIT 58 +#define ICE_SID_TXPARSER_NOMATCH_CAM 61 #define ICE_SID_TXPARSER_BOOST_TCAM 66 +#define ICE_SID_RXPARSER_MARKER_GRP 72 +#define ICE_SID_RXPARSER_PG_SPILL 76 +#define ICE_SID_RXPARSER_NOMATCH_SPILL 78 #define ICE_SID_XLT0_PE 80 #define ICE_SID_XLT_KEY_BUILDER_PE 81 @@ -437,6 +445,11 @@ int ice_update_pkg(struct ice_hw *hw, struct ice_buf *bufs, u32 count); int ice_pkg_buf_reserve_section(struct ice_buf_build *bld, u16 count); u16 ice_pkg_buf_get_active_sections(struct ice_buf_build *bld); +void * +ice_pkg_enum_entry(struct ice_seg *ice_seg, struct ice_pkg_enum *state, + u32 sect_type, u32 *offset, + void *(*handler)(u32 sect_type, void *section, + u32 index, u32 *offset)); void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state, u32 sect_type); diff --git a/drivers/net/ethernet/intel/ice/ice_parser.c b/drivers/net/ethernet/intel/ice/ice_parser.c new file mode 100644 index 000000000000..747dfad66db2 --- /dev/null +++ b/drivers/net/ethernet/intel/ice/ice_parser.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2023 Intel Corporation */ + +#include "ice_common.h" + +/** + * ice_parser_create - create a parser instance + * @hw: pointer to the hardware structure + * @psr: output parameter for a new parser instance be created + */ +int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr) +{ + struct ice_parser *p; + + p = devm_kzalloc(ice_hw_to_dev(hw), sizeof(struct ice_parser), + GFP_KERNEL); + if (!p) + return -ENOMEM; + + p->hw = hw; + + *psr = p; + return 0; +} + +/** + * ice_parser_destroy - destroy a parser instance + * @psr: pointer to a parser instance + */ +void ice_parser_destroy(struct ice_parser *psr) +{ + devm_kfree(ice_hw_to_dev(psr->hw), psr); +} diff --git a/drivers/net/ethernet/intel/ice/ice_parser.h b/drivers/net/ethernet/intel/ice/ice_parser.h new file mode 100644 index 000000000000..85c470235e67 --- /dev/null +++ b/drivers/net/ethernet/intel/ice/ice_parser.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2023 Intel Corporation */ + +#ifndef _ICE_PARSER_H_ +#define _ICE_PARSER_H_ + +struct ice_parser { + struct ice_hw *hw; /* pointer to the hardware structure */ +}; + +int ice_parser_create(struct ice_hw *hw, struct ice_parser **psr); +void ice_parser_destroy(struct ice_parser *psr); +#endif /* _ICE_PARSER_H_ */