void *arg)
{
struct mlx5_common_device *cdev = arg;
- bool extmem = rte_pktmbuf_priv_flags(mp) &
- RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF;
+ bool extmem = mlx5_mempool_is_extmem(mp);
switch (event) {
case RTE_MEMPOOL_EVENT_READY:
struct mlx5_range *chunks;
unsigned int n;
+ DRV_LOG(DEBUG, "Collecting chunks of regular mempool %s", mp->name);
n = mp->nb_mem_chunks;
chunks = calloc(sizeof(chunks[0]), n);
if (chunks == NULL)
{
struct mlx5_mempool_get_extmem_data data;
+ DRV_LOG(DEBUG, "Recovering external pinned pages of mempool %s",
+ mp->name);
memset(&data, 0, sizeof(data));
rte_mempool_obj_iter(mp, mlx5_mempool_get_extmem_cb, &data);
if (data.ret < 0)
int ret;
/* Collect the pool underlying memory. */
- ret = (rte_pktmbuf_priv_flags(mp) & RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF) ?
+ ret = mlx5_mempool_is_extmem(mp) ?
mlx5_mempool_get_extmem(mp, &chunks, &chunks_n) :
mlx5_mempool_get_chunks(mp, &chunks, &chunks_n);
if (ret < 0)
mlx5_mr_mempool_unregister(struct mlx5_common_device *cdev,
struct rte_mempool *mp);
+/** Check if @p mp has buffers pinned in external memory. */
+static inline bool
+mlx5_mempool_is_extmem(struct rte_mempool *mp)
+{
+ return (mp->private_data_size ==
+ sizeof(struct rte_pktmbuf_pool_private)) &&
+ (mp->elt_size >= sizeof(struct rte_mbuf)) &&
+ (rte_pktmbuf_priv_flags(mp) & RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF);
+}
+
#endif /* RTE_PMD_MLX5_COMMON_MR_H_ */
uint32_t flags;
mp = rxq_ctrl->rxq.rxseg[s].mp;
- flags = rte_pktmbuf_priv_flags(mp);
+ flags = mp != rxq_ctrl->rxq.mprq_mp ?
+ rte_pktmbuf_priv_flags(mp) : 0;
ret = mlx5_mr_mempool_register(rxq_ctrl->sh->cdev, mp);
if (ret < 0 && rte_errno != EEXIST)
return ret;
if ((flags & RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF) == 0)
rte_mempool_mem_iter(mp, mlx5_rxq_mempool_register_cb,
- &rxq_ctrl->rxq);
+ &rxq_ctrl->rxq);
}
return 0;
}