14a6b5d1486f1959a7b43445d70e90e25abf9b20
[dpdk.git] / drivers / net / sfc / sfc_flow.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Copyright (c) 2017-2018 Solarflare Communications Inc.
4  * All rights reserved.
5  *
6  * This software was jointly developed between OKTET Labs (under contract
7  * for Solarflare) and Solarflare Communications, Inc.
8  */
9
10 #ifndef _SFC_FLOW_H
11 #define _SFC_FLOW_H
12
13 #include <rte_tailq.h>
14 #include <rte_flow_driver.h>
15
16 #include "efx.h"
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 /*
23  * The maximum number of fully elaborated hardware filter specifications
24  * which can be produced from a template by means of multiplication, if
25  * missing match flags are needed to be taken into account
26  */
27 #define SF_FLOW_SPEC_NB_FILTERS_MAX 8
28
29 /* RSS configuration storage */
30 struct sfc_flow_rss {
31         unsigned int    rxq_hw_index_min;
32         unsigned int    rxq_hw_index_max;
33         unsigned int    rss_hash_types;
34         uint8_t         rss_key[EFX_RSS_KEY_SIZE];
35         unsigned int    rss_tbl[EFX_RSS_TBL_SIZE];
36 };
37
38 /* Filter specification storage */
39 struct sfc_flow_spec {
40         /* partial specification from flow rule */
41         efx_filter_spec_t template;
42         /* fully elaborated hardware filters specifications */
43         efx_filter_spec_t filters[SF_FLOW_SPEC_NB_FILTERS_MAX];
44         /* number of complete specifications */
45         unsigned int count;
46         /* RSS toggle */
47         boolean_t rss;
48         /* RSS configuration */
49         struct sfc_flow_rss rss_conf;
50 };
51
52 /* PMD-specific definition of the opaque type from rte_flow.h */
53 struct rte_flow {
54         struct sfc_flow_spec spec;      /* flow spec for hardware filter(s) */
55         TAILQ_ENTRY(rte_flow) entries;  /* flow list entries */
56 };
57
58 TAILQ_HEAD(sfc_flow_list, rte_flow);
59
60 extern const struct rte_flow_ops sfc_flow_ops;
61
62 struct sfc_adapter;
63
64 void sfc_flow_init(struct sfc_adapter *sa);
65 void sfc_flow_fini(struct sfc_adapter *sa);
66 int sfc_flow_start(struct sfc_adapter *sa);
67 void sfc_flow_stop(struct sfc_adapter *sa);
68
69 #ifdef __cplusplus
70 }
71 #endif
72 #endif /* _SFC_FLOW_H */