net/sfc: support flow item PHY PORT in MAE backend
[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         bool                            match_mport_set;
52 };
53
54 int sfc_mae_attach(struct sfc_adapter *sa);
55 void sfc_mae_detach(struct sfc_adapter *sa);
56 sfc_flow_cleanup_cb_t sfc_mae_flow_cleanup;
57 int sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,
58                                const struct rte_flow_item pattern[],
59                                struct sfc_flow_spec_mae *spec,
60                                struct rte_flow_error *error);
61 int sfc_mae_rule_parse_actions(struct sfc_adapter *sa,
62                                const struct rte_flow_action actions[],
63                                struct sfc_mae_action_set **action_setp,
64                                struct rte_flow_error *error);
65 sfc_flow_verify_cb_t sfc_mae_flow_verify;
66
67 #ifdef __cplusplus
68 }
69 #endif
70 #endif /* _SFC_MAE_H */