net/sfc: support callback to check if mempool is supported
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 19 Apr 2018 11:36:56 +0000 (12:36 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 27 Apr 2018 17:00:58 +0000 (18:00 +0100)
The callback is a dummy yet since no Rx datapath provides its own
callback, so all pools are supported.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
drivers/net/sfc/sfc_dp_rx.h
drivers/net/sfc/sfc_ethdev.c

index db075dd..cb745e6 100644 (file)
@@ -89,6 +89,18 @@ struct sfc_dp_rx_qcreate_info {
  */
 typedef void (sfc_dp_rx_get_dev_info_t)(struct rte_eth_dev_info *dev_info);
 
+/**
+ * Test if an Rx datapath supports specific mempool ops.
+ *
+ * @param pool                 The name of the pool operations to test.
+ *
+ * @return Check status.
+ * @retval     0               Best mempool ops choice.
+ * @retval     1               Mempool ops are supported.
+ * @retval     -ENOTSUP        Mempool ops not supported.
+ */
+typedef int (sfc_dp_rx_pool_ops_supported_t)(const char *pool);
+
 /**
  * Get size of receive and event queue rings by the number of Rx
  * descriptors and mempool configuration.
@@ -182,6 +194,7 @@ struct sfc_dp_rx {
 #define SFC_DP_RX_FEAT_MULTI_PROCESS           0x2
 #define SFC_DP_RX_FEAT_TUNNELS                 0x4
        sfc_dp_rx_get_dev_info_t                *get_dev_info;
+       sfc_dp_rx_pool_ops_supported_t          *pool_ops_supported;
        sfc_dp_rx_qsize_up_rings_t              *qsize_up_rings;
        sfc_dp_rx_qcreate_t                     *qcreate;
        sfc_dp_rx_qdestroy_t                    *qdestroy;
index 700e154..c3f37bc 100644 (file)
@@ -1630,6 +1630,21 @@ sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
        return -rc;
 }
 
+static int
+sfc_pool_ops_supported(struct rte_eth_dev *dev, const char *pool)
+{
+       struct sfc_adapter *sa = dev->data->dev_private;
+
+       /*
+        * If Rx datapath does not provide callback to check mempool,
+        * all pools are supported.
+        */
+       if (sa->dp_rx->pool_ops_supported == NULL)
+               return 1;
+
+       return sa->dp_rx->pool_ops_supported(pool);
+}
+
 static const struct eth_dev_ops sfc_eth_dev_ops = {
        .dev_configure                  = sfc_dev_configure,
        .dev_start                      = sfc_dev_start,
@@ -1678,6 +1693,7 @@ static const struct eth_dev_ops sfc_eth_dev_ops = {
        .fw_version_get                 = sfc_fw_version_get,
        .xstats_get_by_id               = sfc_xstats_get_by_id,
        .xstats_get_names_by_id         = sfc_xstats_get_names_by_id,
+       .pool_ops_supported             = sfc_pool_ops_supported,
 };
 
 /**