X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fmlx5%2Fmlx5.h;h=a1bb779306b8e377ea14c901917acf44a31fd76b;hb=5cac1a5c8d6d3500503d16170b40ec35b88177c7;hp=378b68e4bea2669a7c70b9b6627ec155db0bc43b;hpb=4443201863933b27274a2ffc0d648bebc90e6b9b;p=dpdk.git diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h index 378b68e4be..a1bb779306 100644 --- a/drivers/net/mlx5/mlx5.h +++ b/drivers/net/mlx5/mlx5.h @@ -291,7 +291,7 @@ struct mlx5_drop { #define MLX5_MAX_PENDING_QUERIES 4 #define MLX5_CNT_CONTAINER_RESIZE 64 #define MLX5_CNT_SHARED_OFFSET 0x80000000 -#define IS_SHARED_CNT(cnt) (!!((cnt) & MLX5_CNT_SHARED_OFFSET)) +#define IS_LEGACY_SHARED_CNT(cnt) (!!((cnt) & MLX5_CNT_SHARED_OFFSET)) #define IS_BATCH_CNT(cnt) (((cnt) & (MLX5_CNT_SHARED_OFFSET - 1)) >= \ MLX5_CNT_BATCH_OFFSET) #define MLX5_CNT_SIZE (sizeof(struct mlx5_flow_counter)) @@ -353,7 +353,10 @@ struct flow_counter_stats { /* Shared counters information for counters. */ struct mlx5_flow_counter_shared { - uint32_t id; /**< User counter ID. */ + union { + uint32_t refcnt; /* Only for shared action management. */ + uint32_t id; /* User counter ID for legacy sharing. */ + }; }; /* Shared counter configuration. */ @@ -483,14 +486,6 @@ struct mlx5_aso_cq { uint64_t errors; }; -struct mlx5_aso_devx_mr { - void *buf; - uint64_t length; - struct mlx5dv_devx_umem *umem; - struct mlx5_devx_obj *mkey; - bool is_indirect; -}; - struct mlx5_aso_sq_elem { union { struct { @@ -498,6 +493,10 @@ struct mlx5_aso_sq_elem { uint16_t burst_size; }; struct mlx5_aso_mtr *mtr; + struct { + struct mlx5_aso_ct_action *ct; + char *query_data; + }; }; }; @@ -507,7 +506,7 @@ struct mlx5_aso_sq { struct mlx5_aso_cq cq; struct mlx5_devx_sq sq_obj; volatile uint64_t *uar_addr; - struct mlx5_aso_devx_mr mr; + struct mlx5_pmd_mr mr; uint16_t pi; uint32_t head; uint32_t tail; @@ -560,6 +559,8 @@ struct mlx5_geneve_tlv_option_resource { #define MLX5_AGE_TRIGGER 2 #define MLX5_AGE_SET(age_info, BIT) \ ((age_info)->flags |= (1 << (BIT))) +#define MLX5_AGE_UNSET(age_info, BIT) \ + ((age_info)->flags &= ~(1 << (BIT))) #define MLX5_AGE_GET(age_info, BIT) \ ((age_info)->flags & (1 << (BIT))) #define GET_PORT_AGE_INFO(priv) \ @@ -991,6 +992,60 @@ struct mlx5_bond_info { } ports[MLX5_BOND_MAX_PORTS]; }; +/* Number of connection tracking objects per pool: must be a power of 2. */ +#define MLX5_ASO_CT_ACTIONS_PER_POOL 64 + +/* Generate incremental and unique CT index from pool and offset. */ +#define MLX5_MAKE_CT_IDX(pool, offset) \ + ((pool) * MLX5_ASO_CT_ACTIONS_PER_POOL + (offset) + 1) + +/* ASO Conntrack state. */ +enum mlx5_aso_ct_state { + ASO_CONNTRACK_FREE, /* Inactive, in the free list. */ + ASO_CONNTRACK_WAIT, /* WQE sent in the SQ. */ + ASO_CONNTRACK_READY, /* CQE received w/o error. */ + ASO_CONNTRACK_QUERY, /* WQE for query sent. */ + ASO_CONNTRACK_MAX, /* Guard. */ +}; + +/* Generic ASO connection tracking structure. */ +struct mlx5_aso_ct_action { + LIST_ENTRY(mlx5_aso_ct_action) next; /* Pointer to the next ASO CT. */ + void *dr_action_orig; /* General action object for original dir. */ + void *dr_action_rply; /* General action object for reply dir. */ + uint32_t refcnt; /* Action used count in device flows. */ + uint16_t offset; /* Offset of ASO CT in DevX objects bulk. */ + uint16_t peer; /* The only peer port index could also use this CT. */ + enum mlx5_aso_ct_state state; /* ASO CT state. */ + bool is_original; /* The direction of the DR action to be used. */ +}; + +/* CT action object state update. */ +#define MLX5_ASO_CT_UPDATE_STATE(c, s) \ + __atomic_store_n(&((c)->state), (s), __ATOMIC_RELAXED) + +/* ASO connection tracking software pool definition. */ +struct mlx5_aso_ct_pool { + uint16_t index; /* Pool index in pools array. */ + struct mlx5_devx_obj *devx_obj; + /* The first devx object in the bulk, used for freeing (not yet). */ + struct mlx5_aso_ct_action actions[MLX5_ASO_CT_ACTIONS_PER_POOL]; + /* CT action structures bulk. */ +}; + +LIST_HEAD(aso_ct_list, mlx5_aso_ct_action); + +/* Pools management structure for ASO connection tracking pools. */ +struct mlx5_aso_ct_pools_mng { + struct mlx5_aso_ct_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 ct_sl; /* The ASO CT free list lock. */ + rte_rwlock_t resize_rwl; /* The ASO CT pool resize lock. */ + struct aso_ct_list free_cts; /* Free ASO CT objects list. */ + struct mlx5_aso_sq aso_sq; /* ASO queue objects. */ +}; + /* * Shared Infiniband device context for Master/Representors * which belong to same IB device with multiple IB ports. @@ -1004,6 +1059,7 @@ struct mlx5_dev_ctx_shared { uint32_t sq_ts_format:2; /* SQ timestamp formats supported. */ uint32_t qp_ts_format:2; /* QP timestamp formats supported. */ uint32_t meter_aso_en:1; /* Flow Meter ASO is supported. */ + uint32_t ct_aso_en:1; /* Connection Tracking ASO is supported. */ uint32_t max_port; /* Maximal IB device port index. */ struct mlx5_bond_info bond; /* Bonding information. */ void *ctx; /* Verbs/DV/DevX context. */ @@ -1066,6 +1122,8 @@ struct mlx5_dev_ctx_shared { rte_spinlock_t geneve_tlv_opt_sl; /* Lock for geneve tlv resource */ struct mlx5_flow_mtr_mng *mtrmng; /* Meter management structure. */ + struct mlx5_aso_ct_pools_mng *ct_mng; + /* Management data for ASO connection tracking. */ struct mlx5_dev_shared_port port[]; /* per device port data array. */ }; @@ -1363,6 +1421,7 @@ bool mlx5_flex_parser_ecpri_exist(struct rte_eth_dev *dev); int mlx5_flex_parser_ecpri_alloc(struct rte_eth_dev *dev); int mlx5_flow_aso_age_mng_init(struct mlx5_dev_ctx_shared *sh); int mlx5_aso_flow_mtrs_mng_init(struct mlx5_dev_ctx_shared *sh); +int mlx5_flow_aso_ct_mng_init(struct mlx5_dev_ctx_shared *sh); /* mlx5_ethdev.c */ @@ -1544,8 +1603,6 @@ int mlx5_ctrl_flow(struct rte_eth_dev *dev, struct rte_flow_item_eth *eth_mask); int mlx5_flow_lacp_miss(struct rte_eth_dev *dev); struct rte_flow *mlx5_flow_create_esw_table_zero_flow(struct rte_eth_dev *dev); -int mlx5_flow_create_drop_queue(struct rte_eth_dev *dev); -void mlx5_flow_delete_drop_queue(struct rte_eth_dev *dev); void mlx5_flow_async_pool_query_handle(struct mlx5_dev_ctx_shared *sh, uint64_t async_id, int status); void mlx5_set_query_alarm(struct mlx5_dev_ctx_shared *sh); @@ -1650,5 +1707,15 @@ int mlx5_aso_meter_update_by_wqe(struct mlx5_dev_ctx_shared *sh, struct mlx5_aso_mtr *mtr); int mlx5_aso_mtr_wait(struct mlx5_dev_ctx_shared *sh, struct mlx5_aso_mtr *mtr); +int mlx5_aso_ct_update_by_wqe(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct, + const struct rte_flow_action_conntrack *profile); +int mlx5_aso_ct_wait_ready(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct); +int mlx5_aso_ct_query_by_wqe(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct, + struct rte_flow_action_conntrack *profile); +int mlx5_aso_ct_available(struct mlx5_dev_ctx_shared *sh, + struct mlx5_aso_ct_action *ct); #endif /* RTE_PMD_MLX5_H_ */