net/sfc: support flow items PF and VF in transfer rules
[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 /** FW-allocatable resource context */
22 struct sfc_mae_fw_rsrc {
23         unsigned int                    refcnt;
24         RTE_STD_C11
25         union {
26                 efx_mae_aset_id_t       aset_id;
27         };
28 };
29
30 /** Action set registry entry */
31 struct sfc_mae_action_set {
32         TAILQ_ENTRY(sfc_mae_action_set) entries;
33         unsigned int                    refcnt;
34         efx_mae_actions_t               *spec;
35         struct sfc_mae_fw_rsrc          fw_rsrc;
36 };
37
38 TAILQ_HEAD(sfc_mae_action_sets, sfc_mae_action_set);
39
40 /** Options for MAE support status */
41 enum sfc_mae_status {
42         SFC_MAE_STATUS_UNKNOWN = 0,
43         SFC_MAE_STATUS_UNSUPPORTED,
44         SFC_MAE_STATUS_SUPPORTED
45 };
46
47 struct sfc_mae {
48         /** NIC support for MAE status */
49         enum sfc_mae_status             status;
50         /** Priority level limit for MAE action rules */
51         unsigned int                    nb_action_rule_prios_max;
52         /** Action set registry */
53         struct sfc_mae_action_sets      action_sets;
54 };
55
56 struct sfc_adapter;
57 struct sfc_flow_spec;
58
59 struct sfc_mae_parse_ctx {
60         struct sfc_adapter              *sa;
61         efx_mae_match_spec_t            *match_spec_action;
62         bool                            match_mport_set;
63 };
64
65 int sfc_mae_attach(struct sfc_adapter *sa);
66 void sfc_mae_detach(struct sfc_adapter *sa);
67 sfc_flow_cleanup_cb_t sfc_mae_flow_cleanup;
68 int sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,
69                                const struct rte_flow_item pattern[],
70                                struct sfc_flow_spec_mae *spec,
71                                struct rte_flow_error *error);
72 int sfc_mae_rule_parse_actions(struct sfc_adapter *sa,
73                                const struct rte_flow_action actions[],
74                                struct sfc_mae_action_set **action_setp,
75                                struct rte_flow_error *error);
76 sfc_flow_verify_cb_t sfc_mae_flow_verify;
77 sfc_flow_insert_cb_t sfc_mae_flow_insert;
78 sfc_flow_remove_cb_t sfc_mae_flow_remove;
79
80 #ifdef __cplusplus
81 }
82 #endif
83 #endif /* _SFC_MAE_H */