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 <ethdev_driver.h> 22 #include <rte_flow.h> 23 #include <rte_flow_driver.h> 24 #include <rte_byteorder.h> 25 26 /** Last and lowest priority level for a flow rule. */ 27 #define MLX4_FLOW_PRIORITY_LAST UINT32_C(0xfff) 28 29 /** Meta pattern item used to distinguish internal rules. */ 30 #define MLX4_FLOW_ITEM_TYPE_INTERNAL ((enum rte_flow_item_type)-1) 31 32 /** PMD-specific (mlx4) definition of a flow rule handle. */ 33 struct rte_flow { 34 LIST_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */ 35 struct ibv_flow *ibv_flow; /**< Verbs flow. */ 36 struct ibv_flow_attr *ibv_attr; /**< Pointer to Verbs attributes. */ 37 uint32_t ibv_attr_size; /**< Size of Verbs attributes. */ 38 uint32_t select:1; /**< Used by operations on the linked list. */ 39 uint32_t internal:1; /**< Internal flow rule outside isolated mode. */ 40 uint32_t mac:1; /**< Rule associated with a configured MAC address. */ 41 uint32_t promisc:1; /**< This rule matches everything. */ 42 uint32_t allmulti:1; /**< This rule matches all multicast traffic. */ 43 uint32_t drop:1; /**< This rule drops packets. */ 44 uint32_t priority; /**< Flow rule priority. */ 45 struct mlx4_rss *rss; /**< Rx target. */ 46 }; 47 48 /* mlx4_flow.c */ 49 50 uint64_t mlx4_conv_rss_types(struct mlx4_priv *priv, uint64_t types, 51 int verbs_to_dpdk); 52 int mlx4_flow_sync(struct mlx4_priv *priv, struct rte_flow_error *error); 53 void mlx4_flow_clean(struct mlx4_priv *priv); 54 int mlx4_flow_ops_get(struct rte_eth_dev *dev, const struct rte_flow_ops **ops); 55 56 #endif /* RTE_PMD_MLX4_FLOW_H_ */ 57