182092c87SOlivier Matz /* SPDX-License-Identifier: BSD-3-Clause 246d5736aSVasily Philipov * Copyright 2017 6WIND S.A. 35feecc57SShahaf Shuler * Copyright 2017 Mellanox Technologies, Ltd 446d5736aSVasily Philipov */ 546d5736aSVasily Philipov 646d5736aSVasily Philipov #ifndef RTE_PMD_MLX4_FLOW_H_ 746d5736aSVasily Philipov #define RTE_PMD_MLX4_FLOW_H_ 846d5736aSVasily Philipov 946d5736aSVasily Philipov #include <stdint.h> 1046d5736aSVasily Philipov #include <sys/queue.h> 1146d5736aSVasily Philipov 1237491c7fSAdrien Mazarguil /* Verbs headers do not support -pedantic. */ 1346d5736aSVasily Philipov #ifdef PEDANTIC 1446d5736aSVasily Philipov #pragma GCC diagnostic ignored "-Wpedantic" 1546d5736aSVasily Philipov #endif 1646d5736aSVasily Philipov #include <infiniband/verbs.h> 1746d5736aSVasily Philipov #ifdef PEDANTIC 1846d5736aSVasily Philipov #pragma GCC diagnostic error "-Wpedantic" 1946d5736aSVasily Philipov #endif 2046d5736aSVasily Philipov 21df96fd0dSBruce Richardson #include <ethdev_driver.h> 2246d5736aSVasily Philipov #include <rte_flow.h> 2346d5736aSVasily Philipov #include <rte_flow_driver.h> 2446d5736aSVasily Philipov #include <rte_byteorder.h> 2546d5736aSVasily Philipov 26a5171594SAdrien Mazarguil /** Last and lowest priority level for a flow rule. */ 27a5171594SAdrien Mazarguil #define MLX4_FLOW_PRIORITY_LAST UINT32_C(0xfff) 28a5171594SAdrien Mazarguil 29bdcad2f4SAdrien Mazarguil /** Meta pattern item used to distinguish internal rules. */ 30bdcad2f4SAdrien Mazarguil #define MLX4_FLOW_ITEM_TYPE_INTERNAL ((enum rte_flow_item_type)-1) 31bdcad2f4SAdrien Mazarguil 32ed0cc677SAdrien Mazarguil /** PMD-specific (mlx4) definition of a flow rule handle. */ 3346d5736aSVasily Philipov struct rte_flow { 3446d5736aSVasily Philipov LIST_ENTRY(rte_flow) next; /**< Pointer to the next flow structure. */ 3546d5736aSVasily Philipov struct ibv_flow *ibv_flow; /**< Verbs flow. */ 3646d5736aSVasily Philipov struct ibv_flow_attr *ibv_attr; /**< Pointer to Verbs attributes. */ 37100fe44bSAdrien Mazarguil uint32_t ibv_attr_size; /**< Size of Verbs attributes. */ 381437784bSAdrien Mazarguil uint32_t select:1; /**< Used by operations on the linked list. */ 39bdcad2f4SAdrien Mazarguil uint32_t internal:1; /**< Internal flow rule outside isolated mode. */ 401437784bSAdrien Mazarguil uint32_t mac:1; /**< Rule associated with a configured MAC address. */ 41680d5280SAdrien Mazarguil uint32_t promisc:1; /**< This rule matches everything. */ 423e49f870SAdrien Mazarguil uint32_t allmulti:1; /**< This rule matches all multicast traffic. */ 43100fe44bSAdrien Mazarguil uint32_t drop:1; /**< This rule drops packets. */ 44bf959ec5SAdrien Mazarguil uint32_t priority; /**< Flow rule priority. */ 45078b8b45SAdrien Mazarguil struct mlx4_rss *rss; /**< Rx target. */ 4646d5736aSVasily Philipov }; 4746d5736aSVasily Philipov 48af745cd6SAdrien Mazarguil /* mlx4_flow.c */ 49af745cd6SAdrien Mazarguil 50dbeba4cfSThomas Monjalon uint64_t mlx4_conv_rss_types(struct mlx4_priv *priv, uint64_t types, 51b7abc67cSAdrien Mazarguil int verbs_to_dpdk); 52dbeba4cfSThomas Monjalon int mlx4_flow_sync(struct mlx4_priv *priv, struct rte_flow_error *error); 53dbeba4cfSThomas Monjalon void mlx4_flow_clean(struct mlx4_priv *priv); 54*fb7ad441SThomas Monjalon int mlx4_flow_ops_get(struct rte_eth_dev *dev, const struct rte_flow_ops **ops); 5546d5736aSVasily Philipov 5646d5736aSVasily Philipov #endif /* RTE_PMD_MLX4_FLOW_H_ */ 57