2 * Copyright (c) 2017, Cisco Systems, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
34 #include <rte_ethdev.h>
35 #include <rte_flow_driver.h>
36 #include <rte_ether.h>
40 #include "enic_compat.h"
45 #ifdef RTE_LIBRTE_ENIC_DEBUG_FLOW
46 #define FLOW_TRACE() \
47 RTE_LOG(DEBUG, PMD, "%s()\n", __func__)
48 #define FLOW_LOG(level, fmt, args...) \
49 RTE_LOG(level, PMD, fmt, ## args)
51 #define FLOW_TRACE() do { } while (0)
52 #define FLOW_LOG(level, fmt, args...) do { } while (0)
56 * The following functions are callbacks for Generic flow API.
60 * Validate a flow supported by the NIC.
62 * @see rte_flow_validate()
66 enic_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attrs,
67 const struct rte_flow_item pattern[],
68 const struct rte_flow_action actions[],
69 struct rte_flow_error *error)
83 * Create a flow supported by the NIC.
85 * @see rte_flow_create()
88 static struct rte_flow *
89 enic_flow_create(struct rte_eth_dev *dev,
90 const struct rte_flow_attr *attrs,
91 const struct rte_flow_item pattern[],
92 const struct rte_flow_action actions[],
93 struct rte_flow_error *error)
107 * Destroy a flow supported by the NIC.
109 * @see rte_flow_destroy()
113 enic_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow,
114 __rte_unused struct rte_flow_error *error)
125 * Flush all flows on the device.
127 * @see rte_flow_flush()
131 enic_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
142 * Flow callback registration.
146 const struct rte_flow_ops enic_flow_ops = {
147 .validate = enic_flow_validate,
148 .create = enic_flow_create,
149 .destroy = enic_flow_destroy,
150 .flush = enic_flow_flush,