New upstream version 18.08
[deb_dpdk.git] / drivers / net / mlx4 / mlx4_flow.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2017 6WIND S.A.
3  * Copyright 2017 Mellanox Technologies, Ltd
4  */
5
6 #ifndef RTE_PMD_MLX4_FLOW_H_
7 #define RTE_PMD_MLX4_FLOW_H_
8
9 #include <stdint.h>
10 #include <sys/queue.h>
11
12 /* Verbs headers do not support -pedantic. */
13 #ifdef PEDANTIC
14 #pragma GCC diagnostic ignored "-Wpedantic"
15 #endif
16 #include <infiniband/verbs.h>
17 #ifdef PEDANTIC
18 #pragma GCC diagnostic error "-Wpedantic"
19 #endif
20
21 #include <rte_eth_ctrl.h>
22 #include <rte_ethdev_driver.h>
23 #include <rte_flow.h>
24 #include <rte_flow_driver.h>
25 #include <rte_byteorder.h>
26
27 /** Last and lowest priority level for a flow rule. */
28 #define MLX4_FLOW_PRIORITY_LAST UINT32_C(0xfff)
29
30 /** Meta pattern item used to distinguish internal rules. */
31 #define MLX4_FLOW_ITEM_TYPE_INTERNAL ((enum rte_flow_item_type)-1)
32
33 /** PMD-specific (mlx4) definition of a flow rule handle. */
34 struct rte_flow {
35         LIST_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */
36         struct ibv_flow *ibv_flow; /**< Verbs flow. */
37         struct ibv_flow_attr *ibv_attr; /**< Pointer to Verbs attributes. */
38         uint32_t ibv_attr_size; /**< Size of Verbs attributes. */
39         uint32_t select:1; /**< Used by operations on the linked list. */
40         uint32_t internal:1; /**< Internal flow rule outside isolated mode. */
41         uint32_t mac:1; /**< Rule associated with a configured MAC address. */
42         uint32_t promisc:1; /**< This rule matches everything. */
43         uint32_t allmulti:1; /**< This rule matches all multicast traffic. */
44         uint32_t drop:1; /**< This rule drops packets. */
45         uint32_t priority; /**< Flow rule priority. */
46         struct mlx4_rss *rss; /**< Rx target. */
47 };
48
49 /* mlx4_flow.c */
50
51 uint64_t mlx4_conv_rss_types(struct priv *priv, uint64_t types,
52                              int verbs_to_dpdk);
53 int mlx4_flow_sync(struct priv *priv, struct rte_flow_error *error);
54 void mlx4_flow_clean(struct priv *priv);
55 int mlx4_filter_ctrl(struct rte_eth_dev *dev,
56                      enum rte_filter_type filter_type,
57                      enum rte_filter_op filter_op,
58                      void *arg);
59
60 #endif /* RTE_PMD_MLX4_FLOW_H_ */