#define MLX5_MAX_MODIFY_NUM 32
#define MLX5_ROOT_TBL_MODIFY_NUM 16
+/* Maximal number of flex items created on the port.*/
+#define MLX5_PORT_FLEX_ITEM_NUM 4
+
enum mlx5_ipool_index {
#if defined(HAVE_IBV_FLOW_DV_SUPPORT) || !defined(HAVE_INFINIBAND_VERBS_H)
MLX5_IPOOL_DECAP_ENCAP = 0, /* Pool for encap/decap resource. */
struct mlx5_aso_age_pool **pools;
uint16_t n; /* Total number of pools. */
uint16_t next; /* Number of pools in use, index of next free pool. */
- rte_spinlock_t resize_sl; /* Lock for resize objects. */
+ rte_rwlock_t resize_rwl; /* Lock for resize objects. */
rte_spinlock_t free_sl; /* Lock for free list access. */
struct aso_age_list free; /* Free age actions list - ready to use. */
struct mlx5_aso_sq aso_sq; /* ASO queue objects. */
volatile uint16_t n_valid; /* Number of valid pools. */
uint16_t n; /* Number of pools. */
rte_spinlock_t mtrsl; /* The ASO flow meter free list lock. */
+ rte_rwlock_t resize_mtrwl; /* Lock for resize objects. */
struct aso_meter_list meters; /* Free ASO flow meter list. */
struct mlx5_aso_sq sq; /*SQ using by ASO flow meter. */
struct mlx5_aso_mtr_pool **pools; /* ASO flow meter pool array. */
uint64_t err_ts_future; /* Timestamp in the distant future. */
};
-/* Supported flex parser profile ID. */
-enum mlx5_flex_parser_profile_id {
- MLX5_FLEX_PARSER_ECPRI_0 = 0,
- MLX5_FLEX_PARSER_MAX = 8,
-};
-
-/* Sample ID information of flex parser structure. */
-struct mlx5_flex_parser_profiles {
+/* Sample ID information of eCPRI flex parser structure. */
+struct mlx5_ecpri_parser_profile {
uint32_t num; /* Actual number of samples. */
uint32_t ids[8]; /* Sample IDs for this profile. */
uint8_t offset[8]; /* Bytes offset of each parser. */
uint8_t affinity_mode; /* TIS or hash based affinity */
};
+/* DevX flex parser context. */
+struct mlx5_flex_parser_devx {
+ struct mlx5_list_entry entry; /* List element at the beginning. */
+ uint32_t num_samples;
+ void *devx_obj;
+ struct mlx5_devx_graph_node_attr devx_conf;
+ uint32_t sample_ids[MLX5_GRAPH_NODE_SAMPLE_NUM];
+};
+
+/* Port flex item context. */
+struct mlx5_flex_item {
+ struct mlx5_flex_parser_devx *devx_fp; /* DevX flex parser object. */
+ uint32_t refcnt; /* Atomically accessed refcnt by flows. */
+};
+
/*
* Shared Infiniband device context for Master/Representors
* which belong to same IB device with multiple IB ports.
struct mlx5_list *push_vlan_action_list; /* Push VLAN actions. */
struct mlx5_list *sample_action_list; /* List of sample actions. */
struct mlx5_list *dest_array_list;
+ struct mlx5_list *flex_parsers_dv; /* Flex Item parsers. */
/* List of destination array actions. */
struct mlx5_flow_counter_mng cmng; /* Counters management structure. */
void *default_miss_action; /* Default miss action. */
struct mlx5_devx_obj *td; /* Transport domain. */
struct mlx5_lag lag; /* LAG attributes */
void *tx_uar; /* Tx/packet pacing shared UAR. */
- struct mlx5_flex_parser_profiles fp[MLX5_FLEX_PARSER_MAX];
+ struct mlx5_ecpri_parser_profile ecpri_parser;
/* Flex parser profiles information. */
void *devx_rx_uar; /* DevX UAR for Rx. */
struct mlx5_aso_age_mng *aso_age_mng;
struct mlx5_devx_obj *q_counters; /* DevX queue counter object. */
uint32_t counter_set_id; /* Queue counter ID to set in DevX objects. */
uint32_t lag_affinity_idx; /* LAG mode queue 0 affinity starting. */
+ rte_spinlock_t flex_item_sl; /* Flex item list spinlock. */
+ struct mlx5_flex_item flex_item[MLX5_PORT_FLEX_ITEM_NUM];
+ /* Flex items have been created on the port. */
+ uint32_t flex_item_map; /* Map of allocated flex item elements. */
};
#define PORT_ID(priv) ((priv)->dev_data->port_id)
uint32_t
mlx5_get_supported_tunneling_offloads(const struct mlx5_hca_attr *attr);
+/* mlx5_flow_flex.c */
+
+struct rte_flow_item_flex_handle *
+flow_dv_item_create(struct rte_eth_dev *dev,
+ const struct rte_flow_item_flex_conf *conf,
+ struct rte_flow_error *error);
+int flow_dv_item_release(struct rte_eth_dev *dev,
+ const struct rte_flow_item_flex_handle *flex_handle,
+ struct rte_flow_error *error);
+int mlx5_flex_item_port_init(struct rte_eth_dev *dev);
+void mlx5_flex_item_port_cleanup(struct rte_eth_dev *dev);
+/* Flex parser list callbacks. */
+struct mlx5_list_entry *mlx5_flex_parser_create_cb(void *list_ctx, void *ctx);
+int mlx5_flex_parser_match_cb(void *list_ctx,
+ struct mlx5_list_entry *iter, void *ctx);
+void mlx5_flex_parser_remove_cb(void *list_ctx, struct mlx5_list_entry *entry);
+struct mlx5_list_entry *mlx5_flex_parser_clone_cb(void *list_ctx,
+ struct mlx5_list_entry *entry,
+ void *ctx);
+void mlx5_flex_parser_clone_free_cb(void *tool_ctx,
+ struct mlx5_list_entry *entry);
#endif /* RTE_PMD_MLX5_H_ */