fd0d84011b615992af512bfe2d0dfb1cb97f998d
[dpdk.git] / drivers / net / bnxt / tf_ulp / ulp_mark_mgr.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2019 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _ULP_MARK_MGR_H_
7 #define _ULP_MARK_MGR_H_
8
9 #include "bnxt_ulp.h"
10
11 #define BNXT_ULP_MARK_VALID   0x1
12 #define BNXT_ULP_MARK_GLOBAL_HW_FID 0x4
13 #define BNXT_ULP_MARK_LOCAL_HW_FID 0x8
14
15 struct bnxt_lfid_mark_info {
16         uint16_t        mark_id;
17         uint16_t        flags;
18 };
19
20 struct bnxt_gfid_mark_info {
21         uint32_t        mark_id;
22         uint16_t        flags;
23 };
24
25 struct bnxt_ulp_mark_tbl {
26         struct bnxt_lfid_mark_info      *lfid_tbl;
27         struct bnxt_gfid_mark_info      *gfid_tbl;
28         uint32_t                        lfid_num_entries;
29         uint32_t                        gfid_num_entries;
30         uint32_t                        gfid_mask;
31         uint32_t                        gfid_type_bit;
32 };
33
34 /*
35  * Allocate and Initialize all Mark Manager resources for this ulp context.
36  *
37  * Initialize MARK database for GFID & LFID tables
38  * GFID: Global flow id which is based on EEM hash id.
39  * LFID: Local flow id which is the CFA action pointer.
40  * GFID is used for EEM flows, LFID is used for EM flows.
41  *
42  * Flow mapper modules adds mark_id in the MARK database.
43  *
44  * BNXT PMD receive handler extracts the hardware flow id from the
45  * received completion record. Fetches mark_id from the MARK
46  * database using the flow id. Injects mark_id into the packet's mbuf.
47  *
48  * ctxt [in] The ulp context for the mark manager.
49  */
50 int32_t
51 ulp_mark_db_init(struct bnxt_ulp_context *ctxt);
52
53 /*
54  * Release all resources in the Mark Manager for this ulp context
55  *
56  * ctxt [in] The ulp context for the mark manager
57  */
58 int32_t
59 ulp_mark_db_deinit(struct bnxt_ulp_context *ctxt);
60
61 /*
62  * Get a Mark from the Mark Manager
63  *
64  * ctxt [in] The ulp context for the mark manager
65  *
66  * is_gfid [in] The type of fid (GFID or LFID)
67  *
68  * fid [in] The flow id that is returned by HW in BD
69  *
70  * mark [out] The mark that is associated with the FID
71  *
72  */
73 int32_t
74 ulp_mark_db_mark_get(struct bnxt_ulp_context *ctxt,
75                      bool is_gfid,
76                      uint32_t fid,
77                      uint32_t *mark);
78
79 /*
80  * Adds a Mark to the Mark Manager
81  *
82  * ctxt [in] The ulp context for the mark manager
83  *
84  * mark_flag [in] mark flags.
85  *
86  * fid [in] The flow id that is returned by HW in BD
87  *
88  * mark [in] The mark to be associated with the FID
89  *
90  */
91 int32_t
92 ulp_mark_db_mark_add(struct bnxt_ulp_context *ctxt,
93                      uint32_t mark_flag,
94                      uint32_t gfid,
95                      uint32_t mark);
96
97 /*
98  * Removes a Mark from the Mark Manager
99  *
100  * ctxt [in] The ulp context for the mark manager
101  *
102  * mark_flag [in] mark flags
103  *
104  * fid [in] The flow id that is returned by HW in BD
105  *
106  */
107 int32_t
108 ulp_mark_db_mark_del(struct bnxt_ulp_context *ctxt,
109                      uint32_t mark_flag,
110                      uint32_t gfid);
111
112 #endif /* _ULP_MARK_MGR_H_ */