net/mlx5: simplify flow counters support check
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>
Tue, 23 Oct 2018 10:04:13 +0000 (10:04 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 26 Oct 2018 20:14:06 +0000 (22:14 +0200)
The redundant check of Flow counters support in runtime is removed.
The flag flow_counter_en is eliminated from the code. The Verbs
create counter function just returns an error if no counter
support presented in the system.

If there is no any of Flow counters configuration macro defined
the log message is emited, indicating the missing counter support.

mlx5_flow_validate_action_count() fuctnion is also updated due to
flow_counter_en flag removal.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
drivers/net/mlx5/mlx5.c
drivers/net/mlx5/mlx5.h
drivers/net/mlx5/mlx5_flow.c

index f6a99b7..d29c195 100644 (file)
@@ -739,9 +739,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
        unsigned int mprq_max_stride_size_n = 0;
        unsigned int mprq_min_stride_num_n = 0;
        unsigned int mprq_max_stride_num_n = 0;
-#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
-       struct ibv_counter_set_description cs_desc = { .counter_type = 0 };
-#endif
        struct ether_addr mac;
        char name[RTE_ETH_NAME_MAX_LEN];
        int own_domain_id = 0;
@@ -1009,12 +1006,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
        config.hw_csum = !!(attr.device_cap_flags_ex & IBV_DEVICE_RAW_IP_CSUM);
        DRV_LOG(DEBUG, "checksum offloading is %ssupported",
                (config.hw_csum ? "" : "not "));
-#ifdef HAVE_IBV_DEVICE_COUNTERS_SET_V42
-       config.flow_counter_en = !!attr.max_counter_sets;
-       mlx5_glue->describe_counter_set(ctx, 0, &cs_desc);
-       DRV_LOG(DEBUG, "counter type = %d, num of cs = %ld, attributes = %d",
-               cs_desc.counter_type, cs_desc.num_of_cs,
-               cs_desc.attributes);
+#if !defined(HAVE_IBV_DEVICE_COUNTERS_SET_V42) && \
+       !defined(HAVE_IBV_DEVICE_COUNTERS_SET_V45)
+       DRV_LOG(DEBUG, "counters are not supported");
 #endif
        config.ind_table_max_size =
                attr.rss_caps.max_rwq_indirection_table_size;
index d14239c..74d87c0 100644 (file)
@@ -114,7 +114,6 @@ struct mlx5_dev_config {
        unsigned int tunnel_en:1;
        /* Whether tunnel stateless offloads are supported. */
        unsigned int mpls_en:1; /* MPLS over GRE/UDP is enabled. */
-       unsigned int flow_counter_en:1; /* Whether flow counter is supported. */
        unsigned int cqe_comp:1; /* CQE compression is enabled. */
        unsigned int tso:1; /* Whether TSO is supported. */
        unsigned int tx_vec_en:1; /* Tx vector is enabled. */
index df5c34e..7cea631 100644 (file)
@@ -921,16 +921,10 @@ mlx5_flow_validate_action_rss(const struct rte_flow_action *action,
  *   0 on success, a negative errno value otherwise and rte_ernno is set.
  */
 int
-mlx5_flow_validate_action_count(struct rte_eth_dev *dev,
+mlx5_flow_validate_action_count(struct rte_eth_dev *dev __rte_unused,
                                const struct rte_flow_attr *attr,
                                struct rte_flow_error *error)
 {
-       struct priv *priv = dev->data->dev_private;
-
-       if (!priv->config.flow_counter_en)
-               return rte_flow_error_set(error, ENOTSUP,
-                                         RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-                                         "flow counters are not supported.");
        if (attr->egress)
                return rte_flow_error_set(error, ENOTSUP,
                                          RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL,