aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_parser.c
diff options
context:
space:
mode:
authorJunfeng Guo <[email protected]>2024-07-25 22:07:57 +0000
committerTony Nguyen <[email protected]>2024-08-13 21:51:28 +0000
commit86ff3d79a0ee72b7662ef1cc712ba85336b77c30 (patch)
tree0112c4432d20aa64cb1621fd63434d8f36273103 /drivers/net/ethernet/intel/ice/ice_parser.c
parentnet: hinic: use ethtool_sprintf/puts (diff)
downloadkernel-86ff3d79a0ee72b7662ef1cc712ba85336b77c30.tar.gz
kernel-86ff3d79a0ee72b7662ef1cc712ba85336b77c30.zip
ice: add parser create and destroy skeleton
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: Simon Horman <[email protected]> Reviewed-by: Marcin Szycik <[email protected]> Reviewed-by: Wojciech Drewek <[email protected]> Signed-off-by: Qi Zhang <[email protected]> Signed-off-by: Junfeng Guo <[email protected]> Co-developed-by: Ahmed Zaki <[email protected]> Signed-off-by: Ahmed Zaki <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_parser.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_parser.c32
1 files changed, 32 insertions, 0 deletions
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..6c50164efae0
--- /dev/null
+++ b/drivers/net/ethernet/intel/ice/ice_parser.c
@@ -0,0 +1,32 @@
+// 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 or ERR_PTR
+ * in case of error.
+ */
+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);
+}