2018-01-29 13:11:31 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright 2017 6WIND S.A.
|
2018-03-20 19:20:35 +00:00
|
|
|
* Copyright 2017 Mellanox Technologies, Ltd
|
2017-03-05 07:51:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef RTE_PMD_MLX4_FLOW_H_
|
|
|
|
#define RTE_PMD_MLX4_FLOW_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <sys/queue.h>
|
|
|
|
|
2017-09-01 08:07:04 +00:00
|
|
|
/* Verbs headers do not support -pedantic. */
|
2017-03-05 07:51:32 +00:00
|
|
|
#ifdef PEDANTIC
|
|
|
|
#pragma GCC diagnostic ignored "-Wpedantic"
|
|
|
|
#endif
|
|
|
|
#include <infiniband/verbs.h>
|
|
|
|
#ifdef PEDANTIC
|
|
|
|
#pragma GCC diagnostic error "-Wpedantic"
|
|
|
|
#endif
|
|
|
|
|
2018-01-22 00:16:22 +00:00
|
|
|
#include <rte_ethdev_driver.h>
|
2017-03-05 07:51:32 +00:00
|
|
|
#include <rte_flow.h>
|
|
|
|
#include <rte_flow_driver.h>
|
|
|
|
#include <rte_byteorder.h>
|
|
|
|
|
2017-10-12 12:19:19 +00:00
|
|
|
/** Last and lowest priority level for a flow rule. */
|
|
|
|
#define MLX4_FLOW_PRIORITY_LAST UINT32_C(0xfff)
|
|
|
|
|
2017-10-12 12:19:27 +00:00
|
|
|
/** Meta pattern item used to distinguish internal rules. */
|
|
|
|
#define MLX4_FLOW_ITEM_TYPE_INTERNAL ((enum rte_flow_item_type)-1)
|
|
|
|
|
2017-10-12 12:19:18 +00:00
|
|
|
/** PMD-specific (mlx4) definition of a flow rule handle. */
|
2017-03-05 07:51:32 +00:00
|
|
|
struct rte_flow {
|
|
|
|
LIST_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */
|
|
|
|
struct ibv_flow *ibv_flow; /**< Verbs flow. */
|
|
|
|
struct ibv_flow_attr *ibv_attr; /**< Pointer to Verbs attributes. */
|
2017-10-12 12:19:24 +00:00
|
|
|
uint32_t ibv_attr_size; /**< Size of Verbs attributes. */
|
2017-10-12 12:19:31 +00:00
|
|
|
uint32_t select:1; /**< Used by operations on the linked list. */
|
2017-10-12 12:19:27 +00:00
|
|
|
uint32_t internal:1; /**< Internal flow rule outside isolated mode. */
|
2017-10-12 12:19:31 +00:00
|
|
|
uint32_t mac:1; /**< Rule associated with a configured MAC address. */
|
2017-10-12 12:19:30 +00:00
|
|
|
uint32_t promisc:1; /**< This rule matches everything. */
|
2017-10-12 12:19:33 +00:00
|
|
|
uint32_t allmulti:1; /**< This rule matches all multicast traffic. */
|
2017-10-12 12:19:24 +00:00
|
|
|
uint32_t drop:1; /**< This rule drops packets. */
|
2018-05-04 15:17:44 +00:00
|
|
|
uint32_t priority; /**< Flow rule priority. */
|
net/mlx4: add RSS flow rule action support
This patch dissociates single-queue indirection tables and hash QP objects
from Rx queue structures to relinquish their control to users through the
RSS flow rule action, while simultaneously allowing multiple queues to be
associated with RSS contexts.
Flow rules share identical RSS contexts (hashed fields, hash key, target
queues) to save on memory and other resources. The trade-off is some added
complexity due to reference counters management on RSS contexts.
The QUEUE action is re-implemented on top of an automatically-generated
single-queue RSS context.
The following hardware limitations apply to RSS contexts:
- The number of queues in a group must be a power of two.
- Queue indices must be consecutive, for instance the [0 1 2 3] set is
allowed, however [3 2 1 0], [0 2 1 3] and [0 0 1 1 2 3 3 3] are not.
- The first queue of a group must be aligned to a multiple of the context
size, e.g. if queues [0 1 2 3 4] are defined globally, allowed group
combinations are [0 1] and [2 3]; groups [1 2] and [3 4] are not
supported.
- RSS hash key, while configurable per context, must be exactly 40 bytes
long.
- The only supported hash algorithm is Toeplitz.
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2017-10-12 12:19:41 +00:00
|
|
|
struct mlx4_rss *rss; /**< Rx target. */
|
2017-03-05 07:51:32 +00:00
|
|
|
};
|
|
|
|
|
2017-09-01 08:07:01 +00:00
|
|
|
/* mlx4_flow.c */
|
|
|
|
|
2019-02-21 09:29:14 +00:00
|
|
|
uint64_t mlx4_conv_rss_types(struct mlx4_priv *priv, uint64_t types,
|
2018-05-21 15:50:12 +00:00
|
|
|
int verbs_to_dpdk);
|
2019-02-21 09:29:14 +00:00
|
|
|
int mlx4_flow_sync(struct mlx4_priv *priv, struct rte_flow_error *error);
|
|
|
|
void mlx4_flow_clean(struct mlx4_priv *priv);
|
2017-09-01 08:07:01 +00:00
|
|
|
int mlx4_filter_ctrl(struct rte_eth_dev *dev,
|
|
|
|
enum rte_filter_type filter_type,
|
|
|
|
enum rte_filter_op filter_op,
|
|
|
|
void *arg);
|
2017-03-05 07:51:32 +00:00
|
|
|
|
|
|
|
#endif /* RTE_PMD_MLX4_FLOW_H_ */
|