net/ice/base: add parser create and destroy skeleton
[dpdk.git] / drivers / net / ice / base / ice_parser.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2021 Intel Corporation
3  */
4
5 #include "ice_common.h"
6
7 /**
8  * ice_parser_create - create a parser instance
9  * @hw: pointer to the hardware structure
10  * @psr: output parameter for a new parser instance be created
11  */
12 enum ice_status ice_parser_create(struct ice_hw *hw, struct ice_parser **psr)
13 {
14         struct ice_parser *p;
15
16         p = (struct ice_parser *)ice_malloc(hw, sizeof(struct ice_parser));
17
18         if (!p)
19                 return ICE_ERR_NO_MEMORY;
20
21         p->hw = hw;
22
23         *psr = p;
24         return ICE_SUCCESS;
25 }
26
27 /**
28  * ice_parser_destroy - destroy a parser instance
29  * @psr: pointer to a parser instance
30  */
31 void ice_parser_destroy(struct ice_parser *psr)
32 {
33         ice_free(psr->hw, psr);
34 }