net/txgbe: add generic flow API
[dpdk.git] / drivers / net / txgbe / txgbe_flow.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2015-2020
3  */
4
5 #include <rte_flow.h>
6 #include <rte_flow_driver.h>
7
8 #include "txgbe_ethdev.h"
9
10 /**
11  * Create or destroy a flow rule.
12  * Theorically one rule can match more than one filters.
13  * We will let it use the filter which it hitt first.
14  * So, the sequence matters.
15  */
16 static struct rte_flow *
17 txgbe_flow_create(struct rte_eth_dev *dev,
18                   const struct rte_flow_attr *attr,
19                   const struct rte_flow_item pattern[],
20                   const struct rte_flow_action actions[],
21                   struct rte_flow_error *error)
22 {
23         struct rte_flow *flow = NULL;
24         return flow;
25 }
26
27 /**
28  * Check if the flow rule is supported by txgbe.
29  * It only checks the format. Don't guarantee the rule can be programmed into
30  * the HW. Because there can be no enough room for the rule.
31  */
32 static int
33 txgbe_flow_validate(struct rte_eth_dev *dev,
34                 const struct rte_flow_attr *attr,
35                 const struct rte_flow_item pattern[],
36                 const struct rte_flow_action actions[],
37                 struct rte_flow_error *error)
38 {
39         int ret = 0;
40
41         return ret;
42 }
43
44 /* Destroy a flow rule on txgbe. */
45 static int
46 txgbe_flow_destroy(struct rte_eth_dev *dev,
47                 struct rte_flow *flow,
48                 struct rte_flow_error *error)
49 {
50         int ret = 0;
51
52         return ret;
53 }
54
55 /*  Destroy all flow rules associated with a port on txgbe. */
56 static int
57 txgbe_flow_flush(struct rte_eth_dev *dev,
58                 struct rte_flow_error *error)
59 {
60         int ret = 0;
61
62         return ret;
63 }
64
65 const struct rte_flow_ops txgbe_flow_ops = {
66         .validate = txgbe_flow_validate,
67         .create = txgbe_flow_create,
68         .destroy = txgbe_flow_destroy,
69         .flush = txgbe_flow_flush,
70 };
71