git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ethdev: deprecate legacy filter API
[dpdk.git]
/
drivers
/
net
/
mlx5
/
mlx5_flow.c
diff --git
a/drivers/net/mlx5/mlx5_flow.c
b/drivers/net/mlx5/mlx5_flow.c
index
11213e2
..
5115d5b
100644
(file)
--- a/
drivers/net/mlx5/mlx5_flow.c
+++ b/
drivers/net/mlx5/mlx5_flow.c
@@
-21,7
+21,6
@@
#include <rte_common.h>
#include <rte_ether.h>
#include <rte_common.h>
#include <rte_ether.h>
-#include <rte_eth_ctrl.h>
#include <rte_ethdev_driver.h>
#include <rte_flow.h>
#include <rte_flow_driver.h>
#include <rte_ethdev_driver.h>
#include <rte_flow.h>
#include <rte_flow_driver.h>
@@
-30,9
+29,10
@@
#include "mlx5.h"
#include "mlx5_defs.h"
#include "mlx5.h"
#include "mlx5_defs.h"
-#include "mlx5_prm.h"
-#include "mlx5_glue.h"
#include "mlx5_flow.h"
#include "mlx5_flow.h"
+#include "mlx5_glue.h"
+#include "mlx5_prm.h"
+#include "mlx5_rxtx.h"
/* Dev ops structure defined in mlx5.c */
extern const struct eth_dev_ops mlx5_dev_ops;
/* Dev ops structure defined in mlx5.c */
extern const struct eth_dev_ops mlx5_dev_ops;
@@
-315,6
+315,7
@@
static struct mlx5_flow_tunnel_info tunnels_info[] = {
int
mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
{
int
mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
{
+ struct mlx5_priv *priv = dev->data->dev_private;
struct {
struct ibv_flow_attr attr;
struct ibv_flow_spec_eth eth;
struct {
struct ibv_flow_attr attr;
struct ibv_flow_spec_eth eth;
@@
-322,6
+323,7
@@
mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
} flow_attr = {
.attr = {
.num_of_specs = 2,
} flow_attr = {
.attr = {
.num_of_specs = 2,
+ .port = (uint8_t)priv->ibv_port,
},
.eth = {
.type = IBV_FLOW_SPEC_ETH,
},
.eth = {
.type = IBV_FLOW_SPEC_ETH,
@@
-350,6
+352,7
@@
mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
claim_zero(mlx5_glue->destroy_flow(flow));
priority = vprio[i];
}
claim_zero(mlx5_glue->destroy_flow(flow));
priority = vprio[i];
}
+ mlx5_hrxq_drop_release(dev);
switch (priority) {
case 8:
priority = RTE_DIM(priority_map_3);
switch (priority) {
case 8:
priority = RTE_DIM(priority_map_3);
@@
-361,10
+364,9
@@
mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
rte_errno = ENOTSUP;
DRV_LOG(ERR,
"port %u verbs maximum priority: %d expected 8/16",
rte_errno = ENOTSUP;
DRV_LOG(ERR,
"port %u verbs maximum priority: %d expected 8/16",
- dev->data->port_id,
vprio[i]
);
+ dev->data->port_id,
priority
);
return -rte_errno;
}
return -rte_errno;
}
- mlx5_hrxq_drop_release(dev);
DRV_LOG(INFO, "port %u flow maximum priority: %d",
dev->data->port_id, priority);
return priority;
DRV_LOG(INFO, "port %u flow maximum priority: %d",
dev->data->port_id, priority);
return priority;
@@
-387,7
+389,7
@@
uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
uint32_t subpriority)
{
uint32_t res = 0;
uint32_t subpriority)
{
uint32_t res = 0;
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
switch (priv->config.flow_prio) {
case RTE_DIM(priority_map_3):
switch (priv->config.flow_prio) {
case RTE_DIM(priority_map_3):
@@
-536,7
+538,7
@@
flow_rxq_tunnel_ptype_update(struct mlx5_rxq_ctrl *rxq_ctrl)
static void
flow_drv_rxq_flags_set(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow)
{
static void
flow_drv_rxq_flags_set(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
struct rte_flow *flow = dev_flow->flow;
const int mark = !!(flow->actions &
(MLX5_FLOW_ACTION_FLAG | MLX5_FLOW_ACTION_MARK));
struct rte_flow *flow = dev_flow->flow;
const int mark = !!(flow->actions &
(MLX5_FLOW_ACTION_FLAG | MLX5_FLOW_ACTION_MARK));
@@
-599,7
+601,7
@@
flow_rxq_flags_set(struct rte_eth_dev *dev, struct rte_flow *flow)
static void
flow_drv_rxq_flags_trim(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow)
{
static void
flow_drv_rxq_flags_trim(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
struct rte_flow *flow = dev_flow->flow;
const int mark = !!(flow->actions &
(MLX5_FLOW_ACTION_FLAG | MLX5_FLOW_ACTION_MARK));
struct rte_flow *flow = dev_flow->flow;
const int mark = !!(flow->actions &
(MLX5_FLOW_ACTION_FLAG | MLX5_FLOW_ACTION_MARK));
@@
-661,7
+663,7
@@
flow_rxq_flags_trim(struct rte_eth_dev *dev, struct rte_flow *flow)
static void
flow_rxq_flags_clear(struct rte_eth_dev *dev)
{
static void
flow_rxq_flags_clear(struct rte_eth_dev *dev)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
unsigned int i;
for (i = 0; i != priv->rxqs_n; ++i) {
unsigned int i;
for (i = 0; i != priv->rxqs_n; ++i) {
@@
-786,7
+788,7
@@
mlx5_flow_validate_action_mark(const struct rte_flow_action *action,
* Pointer to error structure.
*
* @return
* Pointer to error structure.
*
* @return
- * 0 on success, a negative errno value otherwise and rte_er
n
no is set.
+ * 0 on success, a negative errno value otherwise and rte_er
r
no is set.
*/
int
mlx5_flow_validate_action_drop(uint64_t action_flags,
*/
int
mlx5_flow_validate_action_drop(uint64_t action_flags,
@@
-829,7
+831,7
@@
mlx5_flow_validate_action_drop(uint64_t action_flags,
* Pointer to error structure.
*
* @return
* Pointer to error structure.
*
* @return
- * 0 on success, a negative errno value otherwise and rte_er
n
no is set.
+ * 0 on success, a negative errno value otherwise and rte_er
r
no is set.
*/
int
mlx5_flow_validate_action_queue(const struct rte_flow_action *action,
*/
int
mlx5_flow_validate_action_queue(const struct rte_flow_action *action,
@@
-838,7
+840,7
@@
mlx5_flow_validate_action_queue(const struct rte_flow_action *action,
const struct rte_flow_attr *attr,
struct rte_flow_error *error)
{
const struct rte_flow_attr *attr,
struct rte_flow_error *error)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
const struct rte_flow_action_queue *queue = action->conf;
if (action_flags & MLX5_FLOW_FATE_ACTIONS)
const struct rte_flow_action_queue *queue = action->conf;
if (action_flags & MLX5_FLOW_FATE_ACTIONS)
@@
-879,21
+881,25
@@
mlx5_flow_validate_action_queue(const struct rte_flow_action *action,
* Pointer to the Ethernet device structure.
* @param[in] attr
* Attributes of flow that includes this action.
* Pointer to the Ethernet device structure.
* @param[in] attr
* Attributes of flow that includes this action.
+ * @param[in] item_flags
+ * Items that were detected.
* @param[out] error
* Pointer to error structure.
*
* @return
* @param[out] error
* Pointer to error structure.
*
* @return
- * 0 on success, a negative errno value otherwise and rte_er
n
no is set.
+ * 0 on success, a negative errno value otherwise and rte_er
r
no is set.
*/
int
mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
uint64_t action_flags,
struct rte_eth_dev *dev,
const struct rte_flow_attr *attr,
*/
int
mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
uint64_t action_flags,
struct rte_eth_dev *dev,
const struct rte_flow_attr *attr,
+ uint64_t item_flags,
struct rte_flow_error *error)
{
struct rte_flow_error *error)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
const struct rte_flow_action_rss *rss = action->conf;
const struct rte_flow_action_rss *rss = action->conf;
+ int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
unsigned int i;
if (action_flags & MLX5_FLOW_FATE_ACTIONS)
unsigned int i;
if (action_flags & MLX5_FLOW_FATE_ACTIONS)
@@
-962,6
+968,11
@@
mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL,
"rss action not supported for "
"egress");
RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL,
"rss action not supported for "
"egress");
+ if (rss->level > 1 && !tunnel)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION_CONF, NULL,
+ "inner RSS is not supported for "
+ "non-tunnel flows");
return 0;
}
return 0;
}
@@
-976,7
+987,7
@@
mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
* Pointer to error structure.
*
* @return
* Pointer to error structure.
*
* @return
- * 0 on success, a negative errno value otherwise and rte_er
n
no is set.
+ * 0 on success, a negative errno value otherwise and rte_er
r
no is set.
*/
int
mlx5_flow_validate_action_count(struct rte_eth_dev *dev __rte_unused,
*/
int
mlx5_flow_validate_action_count(struct rte_eth_dev *dev __rte_unused,
@@
-1010,7
+1021,7
@@
mlx5_flow_validate_attributes(struct rte_eth_dev *dev,
const struct rte_flow_attr *attributes,
struct rte_flow_error *error)
{
const struct rte_flow_attr *attributes,
struct rte_flow_error *error)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
uint32_t priority_max = priv->config.flow_prio - 1;
if (attributes->group)
uint32_t priority_max = priv->config.flow_prio - 1;
if (attributes->group)
@@
-1484,7
+1495,7
@@
mlx5_flow_validate_item_vxlan_gpe(const struct rte_flow_item *item,
struct rte_eth_dev *dev,
struct rte_flow_error *error)
{
struct rte_eth_dev *dev,
struct rte_flow_error *error)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
const struct rte_flow_item_vxlan_gpe *spec = item->spec;
const struct rte_flow_item_vxlan_gpe *mask = item->mask;
int ret;
const struct rte_flow_item_vxlan_gpe *spec = item->spec;
const struct rte_flow_item_vxlan_gpe *mask = item->mask;
int ret;
@@
-1638,7
+1649,7
@@
mlx5_flow_validate_item_mpls(struct rte_eth_dev *dev __rte_unused,
{
#ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT
const struct rte_flow_item_mpls *mask = item->mask;
{
#ifdef HAVE_IBV_DEVICE_MPLS_SUPPORT
const struct rte_flow_item_mpls *mask = item->mask;
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
int ret;
if (!priv->config.mpls_en)
int ret;
if (!priv->config.mpls_en)
@@
-1769,7
+1780,7
@@
const struct mlx5_flow_driver_ops mlx5_flow_null_drv_ops = {
static enum mlx5_flow_drv_type
flow_get_drv_type(struct rte_eth_dev *dev, const struct rte_flow_attr *attr)
{
static enum mlx5_flow_drv_type
flow_get_drv_type(struct rte_eth_dev *dev, const struct rte_flow_attr *attr)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
enum mlx5_flow_drv_type type = MLX5_FLOW_TYPE_MAX;
if (attr->transfer)
enum mlx5_flow_drv_type type = MLX5_FLOW_TYPE_MAX;
if (attr->transfer)
@@
-1798,7
+1809,7
@@
flow_get_drv_type(struct rte_eth_dev *dev, const struct rte_flow_attr *attr)
* Pointer to the error structure.
*
* @return
* Pointer to the error structure.
*
* @return
- * 0 on success, a negative errno value otherwise and rte_er
n
no is set.
+ * 0 on success, a negative errno value otherwise and rte_er
r
no is set.
*/
static inline int
flow_drv_validate(struct rte_eth_dev *dev,
*/
static inline int
flow_drv_validate(struct rte_eth_dev *dev,
@@
-1837,7
+1848,7
@@
flow_drv_validate(struct rte_eth_dev *dev,
* Pointer to the error structure.
*
* @return
* Pointer to the error structure.
*
* @return
- * Pointer to device flow on success, otherwise NULL and rte_er
n
no is set.
+ * Pointer to device flow on success, otherwise NULL and rte_er
r
no is set.
*/
static inline struct mlx5_flow *
flow_drv_prepare(const struct rte_flow *flow,
*/
static inline struct mlx5_flow *
flow_drv_prepare(const struct rte_flow *flow,
@@
-1881,7
+1892,7
@@
flow_drv_prepare(const struct rte_flow *flow,
* Pointer to the error structure.
*
* @return
* Pointer to the error structure.
*
* @return
- * 0 on success, a negative errno value otherwise and rte_er
n
no is set.
+ * 0 on success, a negative errno value otherwise and rte_er
r
no is set.
*/
static inline int
flow_drv_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow,
*/
static inline int
flow_drv_translate(struct rte_eth_dev *dev, struct mlx5_flow *dev_flow,
@@
-2082,6
+2093,7
@@
flow_list_create(struct rte_eth_dev *dev, struct mlx5_flows *list,
flow_size += RTE_ALIGN_CEIL(sizeof(uint16_t), sizeof(void *));
flow = rte_calloc(__func__, 1, flow_size, 0);
flow->drv_type = flow_get_drv_type(dev, attr);
flow_size += RTE_ALIGN_CEIL(sizeof(uint16_t), sizeof(void *));
flow = rte_calloc(__func__, 1, flow_size, 0);
flow->drv_type = flow_get_drv_type(dev, attr);
+ flow->ingress = attr->ingress;
assert(flow->drv_type > MLX5_FLOW_TYPE_MIN &&
flow->drv_type < MLX5_FLOW_TYPE_MAX);
flow->queue = (void *)(flow + 1);
assert(flow->drv_type > MLX5_FLOW_TYPE_MIN &&
flow->drv_type < MLX5_FLOW_TYPE_MAX);
flow->queue = (void *)(flow + 1);
@@
-2143,8
+2155,9
@@
mlx5_flow_create(struct rte_eth_dev *dev,
const struct rte_flow_action actions[],
struct rte_flow_error *error)
{
const struct rte_flow_action actions[],
struct rte_flow_error *error)
{
- return flow_list_create(dev,
- &((struct priv *)dev->data->dev_private)->flows,
+ struct mlx5_priv *priv = (struct mlx5_priv *)dev->data->dev_private;
+
+ return flow_list_create(dev, &priv->flows,
attr, items, actions, error);
}
attr, items, actions, error);
}
@@
-2254,7
+2267,7
@@
error:
int
mlx5_flow_verify(struct rte_eth_dev *dev)
{
int
mlx5_flow_verify(struct rte_eth_dev *dev)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
struct rte_flow *flow;
int ret = 0;
struct rte_flow *flow;
int ret = 0;
@@
-2290,7
+2303,7
@@
mlx5_ctrl_flow_vlan(struct rte_eth_dev *dev,
struct rte_flow_item_vlan *vlan_spec,
struct rte_flow_item_vlan *vlan_mask)
{
struct rte_flow_item_vlan *vlan_spec,
struct rte_flow_item_vlan *vlan_mask)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
const struct rte_flow_attr attr = {
.ingress = 1,
.priority = MLX5_FLOW_PRIO_RSVD,
const struct rte_flow_attr attr = {
.ingress = 1,
.priority = MLX5_FLOW_PRIO_RSVD,
@@
-2380,7
+2393,7
@@
mlx5_flow_destroy(struct rte_eth_dev *dev,
struct rte_flow *flow,
struct rte_flow_error *error __rte_unused)
{
struct rte_flow *flow,
struct rte_flow_error *error __rte_unused)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
flow_list_destroy(dev, &priv->flows, flow);
return 0;
flow_list_destroy(dev, &priv->flows, flow);
return 0;
@@
-2396,7
+2409,7
@@
int
mlx5_flow_flush(struct rte_eth_dev *dev,
struct rte_flow_error *error __rte_unused)
{
mlx5_flow_flush(struct rte_eth_dev *dev,
struct rte_flow_error *error __rte_unused)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
mlx5_flow_list_flush(dev, &priv->flows);
return 0;
mlx5_flow_list_flush(dev, &priv->flows);
return 0;
@@
-2413,7
+2426,7
@@
mlx5_flow_isolate(struct rte_eth_dev *dev,
int enable,
struct rte_flow_error *error)
{
int enable,
struct rte_flow_error *error)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
if (dev->data->dev_started) {
rte_flow_error_set(error, EBUSY,
if (dev->data->dev_started) {
rte_flow_error_set(error, EBUSY,
@@
-2491,7
+2504,7
@@
flow_fdir_filter_convert(struct rte_eth_dev *dev,
const struct rte_eth_fdir_filter *fdir_filter,
struct mlx5_fdir *attributes)
{
const struct rte_eth_fdir_filter *fdir_filter,
struct mlx5_fdir *attributes)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
const struct rte_eth_fdir_input *input = &fdir_filter->input;
const struct rte_eth_fdir_masks *mask =
&dev->data->dev_conf.fdir_conf.mask;
const struct rte_eth_fdir_input *input = &fdir_filter->input;
const struct rte_eth_fdir_masks *mask =
&dev->data->dev_conf.fdir_conf.mask;
@@
-2708,7
+2721,7
@@
flow_fdir_cmp(const struct mlx5_fdir *f1, const struct mlx5_fdir *f2)
static struct rte_flow *
flow_fdir_filter_lookup(struct rte_eth_dev *dev, struct mlx5_fdir *fdir_flow)
{
static struct rte_flow *
flow_fdir_filter_lookup(struct rte_eth_dev *dev, struct mlx5_fdir *fdir_flow)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
struct rte_flow *flow = NULL;
assert(fdir_flow);
struct rte_flow *flow = NULL;
assert(fdir_flow);
@@
-2737,7
+2750,7
@@
static int
flow_fdir_filter_add(struct rte_eth_dev *dev,
const struct rte_eth_fdir_filter *fdir_filter)
{
flow_fdir_filter_add(struct rte_eth_dev *dev,
const struct rte_eth_fdir_filter *fdir_filter)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
struct mlx5_fdir *fdir_flow;
struct rte_flow *flow;
int ret;
struct mlx5_fdir *fdir_flow;
struct rte_flow *flow;
int ret;
@@
-2784,7
+2797,7
@@
static int
flow_fdir_filter_delete(struct rte_eth_dev *dev,
const struct rte_eth_fdir_filter *fdir_filter)
{
flow_fdir_filter_delete(struct rte_eth_dev *dev,
const struct rte_eth_fdir_filter *fdir_filter)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
struct rte_flow *flow;
struct mlx5_fdir fdir_flow = {
.attr.group = 0,
struct rte_flow *flow;
struct mlx5_fdir fdir_flow = {
.attr.group = 0,
@@
-2837,7
+2850,7
@@
flow_fdir_filter_update(struct rte_eth_dev *dev,
static void
flow_fdir_filter_flush(struct rte_eth_dev *dev)
{
static void
flow_fdir_filter_flush(struct rte_eth_dev *dev)
{
- struct priv *priv = dev->data->dev_private;
+ struct
mlx5_
priv *priv = dev->data->dev_private;
mlx5_flow_list_flush(dev, &priv->flows);
}
mlx5_flow_list_flush(dev, &priv->flows);
}