net/sfc: support callback to check if mempool is supported

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>
This commit is contained in:
Andrew Rybchenko 2018-04-19 12:36:56 +01:00 committed by Ferruh Yigit
parent 390f9b8d82
commit 08d23c67ed
2 changed files with 29 additions and 0 deletions

View 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); 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 * Get size of receive and event queue rings by the number of Rx
* descriptors and mempool configuration. * 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_MULTI_PROCESS 0x2
#define SFC_DP_RX_FEAT_TUNNELS 0x4 #define SFC_DP_RX_FEAT_TUNNELS 0x4
sfc_dp_rx_get_dev_info_t *get_dev_info; 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_qsize_up_rings_t *qsize_up_rings;
sfc_dp_rx_qcreate_t *qcreate; sfc_dp_rx_qcreate_t *qcreate;
sfc_dp_rx_qdestroy_t *qdestroy; sfc_dp_rx_qdestroy_t *qdestroy;

View File

@ -1630,6 +1630,21 @@ sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
return -rc; 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 = { static const struct eth_dev_ops sfc_eth_dev_ops = {
.dev_configure = sfc_dev_configure, .dev_configure = sfc_dev_configure,
.dev_start = sfc_dev_start, .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, .fw_version_get = sfc_fw_version_get,
.xstats_get_by_id = sfc_xstats_get_by_id, .xstats_get_by_id = sfc_xstats_get_by_id,
.xstats_get_names_by_id = sfc_xstats_get_names_by_id, .xstats_get_names_by_id = sfc_xstats_get_names_by_id,
.pool_ops_supported = sfc_pool_ops_supported,
}; };
/** /**