From patchwork Mon May 27 18:57:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ahmed Zaki X-Patchwork-Id: 13675699 X-Patchwork-Delegate: kuba@kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 6B64F15FA93 for ; Mon, 27 May 2024 18:58:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716836319; cv=none; b=AxEocA8RfAVLTt0yzt5sC5xWGUCuS8kB6HZzdrb2u8V5ExyrNTcQ4VBEddbpdf2Jg6geyyLQFNwmIJVCCePrB+/pIhIRZEeiCwU/qUcileo80l8SKIfVTZcQ9vu/0vCl+3idzMy46tds5S1IwTD0tCQTmTHuX1frtdczTaxboB0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716836319; c=relaxed/simple; bh=xlQFhp0T85NA7sgbSIIS/1rCY6QDZA/2u2hCGE4P3FM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=owvSjxn6+XJDWewG67tYiTNRvmPoUWE3yJxFSmeK7FsVljfH2SFPKAXMmxGeUmMOT+CD2yw1975vikM7EEFDVjS6FUFiPyQhIgwlabBIAlnNiRmCYUbn2Wpcu5IT3FNuua8m3b92pQlPMrPPeNEaxrQSYQd1+WQkHST8sj685CQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CQ+WGanL; arc=none smtp.client-ip=192.198.163.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CQ+WGanL" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716836317; x=1748372317; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xlQFhp0T85NA7sgbSIIS/1rCY6QDZA/2u2hCGE4P3FM=; b=CQ+WGanLhMD2oxzJ6QU3w6WV/lb31jwj0n3ejYhvjHART6kYn6/+hTMw oXT93gvWRs6oI1BjIVZBOI0BRmavwD4fUiRFJRHrlJYo22vh7MHGLRZxu zEJPJy69na2BPZz3hJ/0gmwyg+3u5GJZhhMktkNYvV7z4D/CX0vTf6wU8 HrRui24bC0Wxs/ANv0hg1i+2eouzn6YdCBZD5nQTLdF1FZZFfPEUqG2yc z4pOn/qEtql1HClWxibrxQCWkiz4kQXCsTXAnt7ZqO8PIWlTTEQw9iqad aAAsO8kvDdPbhdXIFDa2wCHEMKh0Zuskr6h3oeEm9UyHcKbRlzkF8isrp A==; X-CSE-ConnectionGUID: r/DeOZwQSd62O8BTGGyt7w== X-CSE-MsgGUID: 9Lt7ojG5SVGQk24zrhen7A== X-IronPort-AV: E=McAfee;i="6600,9927,11085"; a="13353916" X-IronPort-AV: E=Sophos;i="6.08,193,1712646000"; d="scan'208";a="13353916" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2024 11:58:37 -0700 X-CSE-ConnectionGUID: rXIz60icQqmYdYdkFMjO9g== X-CSE-MsgGUID: at/1yFPUT1eRngA1AueqyQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,193,1712646000"; d="scan'208";a="34910005" Received: from rfrazer-mobl3.amr.corp.intel.com (HELO azaki-desk1.intel.com) ([10.125.110.208]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2024 11:58:34 -0700 From: Ahmed Zaki To: intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, jacob.e.keller@intel.com, anthony.l.nguyen@intel.com, Junfeng Guo , Marcin Szycik , Wojciech Drewek , Ahmed Zaki Subject: [PATCH iwl-next v2 01/13] ice: add parser create and destroy skeleton Date: Mon, 27 May 2024 12:57:58 -0600 Message-ID: <20240527185810.3077299-2-ahmed.zaki@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240527185810.3077299-1-ahmed.zaki@intel.com> References: <20240527185810.3077299-1-ahmed.zaki@intel.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Junfeng Guo Add new parser module which can parse a packet in binary and generate information like ptype, protocol/offset pairs and flags which can be later used to feed the FXP profile creation directly. Add skeleton of the create and destroy APIs: ice_parser_create() ice_parser_destroy() Reviewed-by: Marcin Szycik Reviewed-by: Wojciech Drewek Signed-off-by: Qi Zhang Signed-off-by: Junfeng Guo Co-developed-by: Ahmed Zaki Signed-off-by: Ahmed Zaki Tested-by: Rafal Romanowski --- drivers/net/ethernet/intel/ice/Makefile | 1 + drivers/net/ethernet/intel/ice/ice_common.h | 1 + drivers/net/ethernet/intel/ice/ice_parser.c | 31 +++++++++++++++++++++ drivers/net/ethernet/intel/ice/ice_parser.h | 13 +++++++++ 4 files changed, 46 insertions(+) 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/Makefile b/drivers/net/ethernet/intel/ice/Makefile index 03500e28ac99..23fa3f7f36ef 100644 --- a/drivers/net/ethernet/intel/ice/Makefile +++ b/drivers/net/ethernet/intel/ice/Makefile @@ -28,6 +28,7 @@ ice-y := ice_main.o \ ice_vlan_mode.o \ ice_flex_pipe.o \ ice_flow.o \ + ice_parser.o \ ice_idc.o \ devlink/devlink.o \ devlink/devlink_port.o \ diff --git a/drivers/net/ethernet/intel/ice/ice_common.h b/drivers/net/ethernet/intel/ice/ice_common.h index 86cc1df469dd..9a91f71ab727 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.h +++ b/drivers/net/ethernet/intel/ice/ice_common.h @@ -10,6 +10,7 @@ #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" 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..b7865b6a0a9b --- /dev/null +++ b/drivers/net/ethernet/intel/ice/ice_parser.c @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright (C) 2024 Intel Corporation */ + +#include "ice_common.h" + +/** + * ice_parser_create - create a parser instance + * @hw: pointer to the hardware structure + * + * Return a pointer to the allocated parser instance + */ +struct ice_parser *ice_parser_create(struct ice_hw *hw) +{ + struct ice_parser *p; + + p = kzalloc(sizeof(*p), GFP_KERNEL); + if (!p) + return ERR_PTR(-ENOMEM); + + p->hw = hw; + return p; +} + +/** + * ice_parser_destroy - destroy a parser instance + * @psr: pointer to a parser instance + */ +void ice_parser_destroy(struct ice_parser *psr) +{ + kfree(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..09ed380eee32 --- /dev/null +++ b/drivers/net/ethernet/intel/ice/ice_parser.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (C) 2024 Intel Corporation */ + +#ifndef _ICE_PARSER_H_ +#define _ICE_PARSER_H_ + +struct ice_parser { + struct ice_hw *hw; /* pointer to the hardware structure */ +}; + +struct ice_parser *ice_parser_create(struct ice_hw *hw); +void ice_parser_destroy(struct ice_parser *psr); +#endif /* _ICE_PARSER_H_ */