net/mlx5: add preliminary flow API support
[dpdk.git] / drivers / net / mlx5 / mlx5_flow.c
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright 2016 6WIND S.A.
5  *   Copyright 2016 Mellanox.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of 6WIND S.A. nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #include <rte_ethdev.h>
35 #include <rte_flow.h>
36 #include <rte_flow_driver.h>
37
38 #include "mlx5.h"
39
40 /**
41  * Validate a flow supported by the NIC.
42  *
43  * @see rte_flow_validate()
44  * @see rte_flow_ops
45  */
46 int
47 mlx5_flow_validate(struct rte_eth_dev *dev,
48                    const struct rte_flow_attr *attr,
49                    const struct rte_flow_item items[],
50                    const struct rte_flow_action actions[],
51                    struct rte_flow_error *error)
52 {
53         (void)dev;
54         (void)attr;
55         (void)items;
56         (void)actions;
57         (void)error;
58         rte_flow_error_set(error, ENOTSUP,
59                            RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
60                            NULL, "not implemented yet");
61         return -rte_errno;
62 }
63
64 /**
65  * Create a flow.
66  *
67  * @see rte_flow_create()
68  * @see rte_flow_ops
69  */
70 struct rte_flow *
71 mlx5_flow_create(struct rte_eth_dev *dev,
72                  const struct rte_flow_attr *attr,
73                  const struct rte_flow_item items[],
74                  const struct rte_flow_action actions[],
75                  struct rte_flow_error *error)
76 {
77         (void)dev;
78         (void)attr;
79         (void)items;
80         (void)actions;
81         (void)error;
82         rte_flow_error_set(error, ENOTSUP,
83                            RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
84                            NULL, "not implemented yet");
85         return NULL;
86 }
87
88 /**
89  * Destroy a flow.
90  *
91  * @see rte_flow_destroy()
92  * @see rte_flow_ops
93  */
94 int
95 mlx5_flow_destroy(struct rte_eth_dev *dev,
96                   struct rte_flow *flow,
97                   struct rte_flow_error *error)
98 {
99         (void)dev;
100         (void)flow;
101         (void)error;
102         rte_flow_error_set(error, ENOTSUP,
103                            RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
104                            NULL, "not implemented yet");
105         return -rte_errno;
106 }
107
108 /**
109  * Destroy all flows.
110  *
111  * @see rte_flow_flush()
112  * @see rte_flow_ops
113  */
114 int
115 mlx5_flow_flush(struct rte_eth_dev *dev,
116                 struct rte_flow_error *error)
117 {
118         (void)dev;
119         (void)error;
120         rte_flow_error_set(error, ENOTSUP,
121                            RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
122                            NULL, "not implemented yet");
123         return -rte_errno;
124 }