5727962a0b851b9bfd73ff74b3cf1e77bed1f6f8
[dpdk.git] / drivers / net / sfc / sfc_mae.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright(c) 2019-2020 Xilinx, Inc.
4  * Copyright(c) 2019 Solarflare Communications Inc.
5  *
6  * This software was jointly developed between OKTET Labs (under contract
7  * for Solarflare) and Solarflare Communications, Inc.
8  */
9
10 #ifndef _SFC_MAE_H
11 #define _SFC_MAE_H
12
13 #include <stdbool.h>
14
15 #include "efx.h"
16
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20
21 /** Action set registry entry */
22 struct sfc_mae_action_set {
23         TAILQ_ENTRY(sfc_mae_action_set) entries;
24         unsigned int                    refcnt;
25         efx_mae_actions_t               *spec;
26 };
27
28 TAILQ_HEAD(sfc_mae_action_sets, sfc_mae_action_set);
29
30 /** Options for MAE support status */
31 enum sfc_mae_status {
32         SFC_MAE_STATUS_UNKNOWN = 0,
33         SFC_MAE_STATUS_UNSUPPORTED,
34         SFC_MAE_STATUS_SUPPORTED
35 };
36
37 struct sfc_mae {
38         /** NIC support for MAE status */
39         enum sfc_mae_status             status;
40         /** Priority level limit for MAE action rules */
41         unsigned int                    nb_action_rule_prios_max;
42         /** Action set registry */
43         struct sfc_mae_action_sets      action_sets;
44 };
45
46 struct sfc_adapter;
47 struct sfc_flow_spec;
48
49 struct sfc_mae_parse_ctx {
50         efx_mae_match_spec_t            *match_spec_action;
51 };
52
53 int sfc_mae_attach(struct sfc_adapter *sa);
54 void sfc_mae_detach(struct sfc_adapter *sa);
55 sfc_flow_cleanup_cb_t sfc_mae_flow_cleanup;
56 int sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,
57                                const struct rte_flow_item pattern[],
58                                struct sfc_flow_spec_mae *spec,
59                                struct rte_flow_error *error);
60 int sfc_mae_rule_parse_actions(struct sfc_adapter *sa,
61                                const struct rte_flow_action actions[],
62                                struct sfc_mae_action_set **action_setp,
63                                struct rte_flow_error *error);
64 sfc_flow_verify_cb_t sfc_mae_flow_verify;
65
66 #ifdef __cplusplus
67 }
68 #endif
69 #endif /* _SFC_MAE_H */