net/mlx5: convert port id action to indexed
[dpdk.git] / drivers / net / mlx5 / mlx5.h
index 1850cf9..2004479 100644 (file)
 #include <mlx5_devx_cmds.h>
 #include <mlx5_prm.h>
 #include <mlx5_nl.h>
+#include <mlx5_common_mp.h>
+#include <mlx5_common_mr.h>
 
 #include "mlx5_defs.h"
 #include "mlx5_utils.h"
-#include "mlx5_mr.h"
 #include "mlx5_autoconf.h"
 
-/* Request types for IPC. */
-enum mlx5_mp_req_type {
-       MLX5_MP_REQ_VERBS_CMD_FD = 1,
-       MLX5_MP_REQ_CREATE_MR,
-       MLX5_MP_REQ_START_RXTX,
-       MLX5_MP_REQ_STOP_RXTX,
-       MLX5_MP_REQ_QUEUE_STATE_MODIFY,
-};
-
-struct mlx5_mp_arg_queue_state_modify {
-       uint8_t is_wq; /* Set if WQ. */
-       uint16_t queue_id; /* DPDK queue ID. */
-       enum ibv_wq_state state; /* WQ requested state. */
-};
 
-/* Pameters for IPC. */
-struct mlx5_mp_param {
-       enum mlx5_mp_req_type type;
-       int port_id;
-       int result;
-       RTE_STD_C11
-       union {
-               uintptr_t addr; /* MLX5_MP_REQ_CREATE_MR */
-               struct mlx5_mp_arg_queue_state_modify state_modify;
-               /* MLX5_MP_REQ_QUEUE_STATE_MODIFY */
-       } args;
+enum mlx5_ipool_index {
+       MLX5_IPOOL_DECAP_ENCAP = 0, /* Pool for encap/decap resource. */
+       MLX5_IPOOL_PUSH_VLAN, /* Pool for push vlan resource. */
+       MLX5_IPOOL_TAG, /* Pool for tag resource. */
+       MLX5_IPOOL_PORT_ID, /* Pool for port id resource. */
+       MLX5_IPOOL_MAX,
 };
 
-/** Request timeout for IPC. */
-#define MLX5_MP_REQ_TIMEOUT_SEC 5
-
 /** Key string for IPC. */
 #define MLX5_MP_NAME "net_mlx5_mp"
 
@@ -229,8 +208,6 @@ struct mlx5_verbs_alloc_ctx {
        const void *obj; /* Pointer to the DPDK object. */
 };
 
-LIST_HEAD(mlx5_mr_list, mlx5_mr);
-
 /* Flow drop context necessary due to Verbs API. */
 struct mlx5_drop {
        struct mlx5_hrxq *hrxq; /* Hash Rx queue queue. */
@@ -441,13 +418,7 @@ struct mlx5_ibv_shared {
        struct ibv_device_attr_ex device_attr; /* Device properties. */
        LIST_ENTRY(mlx5_ibv_shared) mem_event_cb;
        /**< Called by memory event callback. */
-       struct {
-               uint32_t dev_gen; /* Generation number to flush local caches. */
-               rte_rwlock_t rwlock; /* MR Lock. */
-               struct mlx5_mr_btree cache; /* Global MR cache table. */
-               struct mlx5_mr_list mr_list; /* Registered MR list. */
-               struct mlx5_mr_list mr_free_list; /* Freed MR list. */
-       } mr;
+       struct mlx5_mr_share_cache share_cache;
        /* Shared DV/DR flow data section. */
        pthread_mutex_t dv_mutex; /* DV context mutex. */
        uint32_t dv_meta_mask; /* flow META metadata supported mask. */
@@ -461,14 +432,14 @@ struct mlx5_ibv_shared {
        /* Direct Rules tables for FDB, NIC TX+RX */
        void *esw_drop_action; /* Pointer to DR E-Switch drop action. */
        void *pop_vlan_action; /* Pointer to DR pop VLAN action. */
-       LIST_HEAD(encap_decap, mlx5_flow_dv_encap_decap_resource) encaps_decaps;
+       uint32_t encaps_decaps; /* Encap/decap action indexed memory list. */
        LIST_HEAD(modify_cmd, mlx5_flow_dv_modify_hdr_resource) modify_cmds;
        struct mlx5_hlist *tag_table;
-       LIST_HEAD(port_id_action_list, mlx5_flow_dv_port_id_action_resource)
-               port_id_action_list; /* List of port ID actions. */
-       LIST_HEAD(push_vlan_action_list, mlx5_flow_dv_push_vlan_action_resource)
-               push_vlan_action_list; /* List of push VLAN actions. */
+       uint32_t port_id_action_list; /* List of port ID actions. */
+       uint32_t push_vlan_action_list; /* List of push VLAN actions. */
        struct mlx5_flow_counter_mng cmng; /* Counters management structure. */
+       struct mlx5_indexed_pool *ipool[MLX5_IPOOL_MAX];
+       /* Memory Pool for mlx5 flow resources. */
        /* Shared interrupt handler section. */
        pthread_mutex_t intr_mutex; /* Interrupt config mutex. */
        uint32_t intr_cnt; /* Interrupt handler reference counter. */
@@ -577,6 +548,7 @@ struct mlx5_priv {
 #endif
        uint8_t skip_default_rss_reta; /* Skip configuration of default reta. */
        uint8_t fdb_def_rule; /* Whether fdb jump to table 1 is configured. */
+       struct mlx5_mp_id mp_id; /* ID of a multi-process process */
 };
 
 #define PORT_ID(priv) ((priv)->dev_data->port_id)
@@ -777,16 +749,10 @@ int mlx5_flow_dev_dump(struct rte_eth_dev *dev, FILE *file,
                       struct rte_flow_error *error);
 
 /* mlx5_mp.c */
+int mlx5_mp_primary_handle(const struct rte_mp_msg *mp_msg, const void *peer);
+int mlx5_mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer);
 void mlx5_mp_req_start_rxtx(struct rte_eth_dev *dev);
 void mlx5_mp_req_stop_rxtx(struct rte_eth_dev *dev);
-int mlx5_mp_req_mr_create(struct rte_eth_dev *dev, uintptr_t addr);
-int mlx5_mp_req_verbs_cmd_fd(struct rte_eth_dev *dev);
-int mlx5_mp_req_queue_state_modify(struct rte_eth_dev *dev,
-                                  struct mlx5_mp_arg_queue_state_modify *sm);
-int mlx5_mp_init_primary(void);
-void mlx5_mp_uninit_primary(void);
-int mlx5_mp_init_secondary(void);
-void mlx5_mp_uninit_secondary(void);
 
 /* mlx5_socket.c */