#include <rte_mtr_driver.h>
#include <mlx5_devx_cmds.h>
+#include <mlx5_malloc.h>
#include "mlx5.h"
#include "mlx5_flow.h"
if (ret)
return ret;
/* Meter profile memory allocation. */
- fmp = rte_calloc(__func__, 1, sizeof(struct mlx5_flow_meter_profile),
- RTE_CACHE_LINE_SIZE);
+ fmp = mlx5_malloc(MLX5_MEM_ZERO, sizeof(struct mlx5_flow_meter_profile),
+ RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);
if (fmp == NULL)
return -rte_mtr_error_set(error, ENOMEM,
RTE_MTR_ERROR_TYPE_UNSPECIFIED,
TAILQ_INSERT_TAIL(fmps, fmp, next);
return 0;
error:
- rte_free(fmp);
+ mlx5_free(fmp);
return ret;
}
NULL, "Meter profile is in use.");
/* Remove from list. */
TAILQ_REMOVE(&priv->flow_meter_profiles, fmp, next);
- rte_free(fmp);
+ mlx5_free(fmp);
return 0;
}
void
mlx5_flow_meter_detach(struct mlx5_flow_meter *fm)
{
+#ifdef HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER
MLX5_ASSERT(fm->ref_cnt);
if (--fm->ref_cnt)
return;
fm->ingress = 0;
fm->egress = 0;
fm->transfer = 0;
+#else
+ (void)fm;
+#endif
}
/**
MLX5_ASSERT(!fmp->ref_cnt);
/* Remove from list. */
TAILQ_REMOVE(&priv->flow_meter_profiles, fmp, next);
- rte_free(fmp);
+ mlx5_free(fmp);
}
return 0;
}