net/mlx5: remove drop queue function prototypes
[dpdk.git] / drivers / net / mlx5 / linux / mlx5_os.c
index a2cfa50..17d0533 100644 (file)
@@ -40,6 +40,8 @@
 #include "mlx5_common_os.h"
 #include "mlx5_utils.h"
 #include "mlx5_rxtx.h"
+#include "mlx5_rx.h"
+#include "mlx5_tx.h"
 #include "mlx5_autoconf.h"
 #include "mlx5_mr.h"
 #include "mlx5_flow.h"
@@ -325,7 +327,17 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv)
                        goto error;
                }
                sh->fdb_domain = domain;
-               sh->esw_drop_action = mlx5_glue->dr_create_flow_action_drop();
+       }
+       /*
+        * The drop action is just some dummy placeholder in rdma-core. It
+        * does not belong to domains and has no any attributes, and, can be
+        * shared by the entire device.
+        */
+       sh->dr_drop_action = mlx5_glue->dr_create_flow_action_drop();
+       if (!sh->dr_drop_action) {
+               DRV_LOG(ERR, "FDB mlx5dv_dr_create_flow_action_drop");
+               err = errno;
+               goto error;
        }
 #endif
        if (!sh->tunnel_hub)
@@ -361,9 +373,9 @@ error:
                mlx5_glue->dr_destroy_domain(sh->fdb_domain);
                sh->fdb_domain = NULL;
        }
-       if (sh->esw_drop_action) {
-               mlx5_glue->destroy_flow_action(sh->esw_drop_action);
-               sh->esw_drop_action = NULL;
+       if (sh->dr_drop_action) {
+               mlx5_glue->destroy_flow_action(sh->dr_drop_action);
+               sh->dr_drop_action = NULL;
        }
        if (sh->pop_vlan_action) {
                mlx5_glue->destroy_flow_action(sh->pop_vlan_action);
@@ -418,9 +430,9 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv)
                mlx5_glue->dr_destroy_domain(sh->fdb_domain);
                sh->fdb_domain = NULL;
        }
-       if (sh->esw_drop_action) {
-               mlx5_glue->destroy_flow_action(sh->esw_drop_action);
-               sh->esw_drop_action = NULL;
+       if (sh->dr_drop_action) {
+               mlx5_glue->destroy_flow_action(sh->dr_drop_action);
+               sh->dr_drop_action = NULL;
        }
 #endif
        if (sh->pop_vlan_action) {
@@ -710,11 +722,15 @@ mlx5_representor_match(struct mlx5_dev_spawn_data *spawn,
        struct mlx5_switch_info *switch_info = &spawn->info;
        unsigned int p, f;
        uint16_t id;
-       uint16_t repr_id = mlx5_representor_id_encode(switch_info);
+       uint16_t repr_id = mlx5_representor_id_encode(switch_info,
+                                                     eth_da->type);
 
        switch (eth_da->type) {
        case RTE_ETH_REPRESENTOR_SF:
-               if (switch_info->name_type != MLX5_PHYS_PORT_NAME_TYPE_PFSF) {
+               if (!(spawn->info.port_name == -1 &&
+                     switch_info->name_type ==
+                               MLX5_PHYS_PORT_NAME_TYPE_PFHPF) &&
+                   switch_info->name_type != MLX5_PHYS_PORT_NAME_TYPE_PFSF) {
                        rte_errno = EBUSY;
                        return false;
                }
@@ -742,7 +758,8 @@ mlx5_representor_match(struct mlx5_dev_spawn_data *spawn,
                if (spawn->pf_bond < 0) {
                        /* For non-LAG mode, allow and ignore pf. */
                        switch_info->pf_num = eth_da->ports[p];
-                       repr_id = mlx5_representor_id_encode(switch_info);
+                       repr_id = mlx5_representor_id_encode(switch_info,
+                                                            eth_da->type);
                }
                for (f = 0; f < eth_da->nb_representor_ports; ++f) {
                        id = MLX5_REPRESENTOR_ID
@@ -1107,7 +1124,8 @@ err_secondary:
        priv->vport_id = switch_info->representor ?
                         switch_info->port_name + 1 : -1;
 #endif
-       priv->representor_id = mlx5_representor_id_encode(switch_info);
+       priv->representor_id = mlx5_representor_id_encode(switch_info,
+                                                         eth_da->type);
        /*
         * Look for sibling devices in order to reuse their switch domain
         * if any, otherwise allocate one.
@@ -1237,7 +1255,9 @@ err_secondary:
                                "required for coalescing is %d bytes",
                                config->hca_attr.lro_min_mss_size);
                }
-#if defined(HAVE_MLX5DV_DR) && defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER)
+#if defined(HAVE_MLX5DV_DR) && \
+       (defined(HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER) || \
+        defined(HAVE_MLX5_DR_CREATE_ACTION_ASO))
                if (config->hca_attr.qos.sup &&
                    config->hca_attr.qos.flow_meter_old &&
                    config->dv_flow_en) {
@@ -1272,6 +1292,23 @@ err_secondary:
                                        priv->mtr_color_reg);
                        }
                }
+               if (config->hca_attr.qos.sup &&
+                       config->hca_attr.qos.flow_meter_aso_sup) {
+                       uint32_t log_obj_size =
+                               rte_log2_u32(MLX5_ASO_MTRS_PER_POOL >> 1);
+                       if (log_obj_size >=
+                       config->hca_attr.qos.log_meter_aso_granularity &&
+                       log_obj_size <=
+                       config->hca_attr.qos.log_meter_aso_max_alloc)
+                               sh->meter_aso_en = 1;
+               }
+               if (priv->mtr_en) {
+                       err = mlx5_aso_flow_mtrs_mng_init(priv->sh);
+                       if (err) {
+                               err = -err;
+                               goto error;
+                       }
+               }
 #endif
 #ifdef HAVE_MLX5_DR_CREATE_ACTION_ASO
                if (config->hca_attr.flow_hit_aso &&