net/bnxt: aggregate ULP mapper create arguments
[dpdk.git] / drivers / net / bnxt / tf_ulp / ulp_mapper.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2019 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _ULP_MAPPER_H_
7 #define _ULP_MAPPER_H_
8
9 #include <tf_core.h>
10 #include <rte_log.h>
11 #include <rte_flow.h>
12 #include <rte_flow_driver.h>
13 #include "ulp_template_db.h"
14 #include "ulp_template_struct.h"
15 #include "bnxt_ulp.h"
16 #include "ulp_utils.h"
17
18 #define ULP_SZ_BITS2BYTES(x) (((x) + 7) / 8)
19
20 /* Internal Structure for passing the arguments around */
21 struct bnxt_ulp_mapper_parms {
22         uint32_t                                dev_id;
23         enum bnxt_ulp_byte_order                order;
24         uint32_t                                act_tid;
25         struct bnxt_ulp_mapper_act_tbl_info     *atbls;
26         uint32_t                                num_atbls;
27         uint32_t                                class_tid;
28         struct bnxt_ulp_mapper_class_tbl_info   *ctbls;
29         uint32_t                                num_ctbls;
30         struct ulp_rte_act_prop                 *act_prop;
31         struct ulp_rte_act_bitmap               *act_bitmap;
32         struct ulp_rte_hdr_field                *hdr_field;
33         struct ulp_regfile                      *regfile;
34         struct tf                               *tfp;
35         struct bnxt_ulp_context                 *ulp_ctx;
36         uint8_t                                 encap_byte_swap;
37         uint32_t                                fid;
38         enum bnxt_ulp_flow_db_tables            tbl_idx;
39 };
40
41 struct bnxt_ulp_mapper_create_parms {
42         uint32_t                        app_priority;
43         struct ulp_rte_hdr_bitmap       *hdr_bitmap;
44         struct ulp_rte_hdr_field        *hdr_field;
45         struct ulp_rte_act_bitmap       *act;
46         struct ulp_rte_act_prop         *act_prop;
47         uint32_t                        class_tid;
48         uint32_t                        act_tid;
49 };
50
51 /*
52  * Function to handle the mapping of the Flow to be compatible
53  * with the underlying hardware.
54  */
55 int32_t
56 ulp_mapper_flow_create(struct bnxt_ulp_context  *ulp_ctx,
57                        struct bnxt_ulp_mapper_create_parms *parms,
58                        uint32_t *flowid);
59
60 /* Function that frees all resources associated with the flow. */
61 int32_t
62 ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx, uint32_t fid);
63
64 /*
65  * Function that frees all resources and can be called on default or regular
66  * flows
67  */
68 int32_t
69 ulp_mapper_resources_free(struct bnxt_ulp_context       *ulp_ctx,
70                           uint32_t fid,
71                           enum bnxt_ulp_flow_db_tables  tbl_type);
72
73 #endif /* _ULP_MAPPER_H_ */