* Rx queues configuration for mlx4 driver.
*/
-#include <assert.h>
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
void
mlx4_rss_put(struct mlx4_rss *rss)
{
- assert(rss->refcnt);
+ MLX4_ASSERT(rss->refcnt);
if (--rss->refcnt)
return;
- assert(!rss->usecnt);
- assert(!rss->qp);
- assert(!rss->ind);
+ MLX4_ASSERT(!rss->usecnt);
+ MLX4_ASSERT(!rss->qp);
+ MLX4_ASSERT(!rss->ind);
LIST_REMOVE(rss, next);
rte_free(rss);
}
int
mlx4_rss_attach(struct mlx4_rss *rss)
{
- assert(rss->refcnt);
+ MLX4_ASSERT(rss->refcnt);
if (rss->usecnt++) {
- assert(rss->qp);
- assert(rss->ind);
+ MLX4_ASSERT(rss->qp);
+ MLX4_ASSERT(rss->ind);
return 0;
}
struct rte_eth_dev *dev = ETH_DEV(priv);
unsigned int i;
- assert(rss->refcnt);
- assert(rss->qp);
- assert(rss->ind);
+ MLX4_ASSERT(rss->refcnt);
+ MLX4_ASSERT(rss->qp);
+ MLX4_ASSERT(rss->ind);
if (--rss->usecnt)
return;
claim_zero(mlx4_glue->destroy_qp(rss->qp));
/* Attach the configured Rx queues. */
if (rxq) {
- assert(!rxq->usecnt);
+ MLX4_ASSERT(!rxq->usecnt);
ret = mlx4_rxq_attach(rxq);
if (!ret) {
wq_num = rxq->wq->wq_num;
struct rxq *rxq = ETH_DEV(priv)->data->rx_queues[i];
if (rxq) {
- assert(rxq->usecnt == 1);
+ MLX4_ASSERT(rxq->usecnt == 1);
mlx4_rxq_detach(rxq);
}
}
mlx4_rxq_attach(struct rxq *rxq)
{
if (rxq->usecnt++) {
- assert(rxq->cq);
- assert(rxq->wq);
- assert(rxq->wqes);
- assert(rxq->rq_db);
+ MLX4_ASSERT(rxq->cq);
+ MLX4_ASSERT(rxq->wq);
+ MLX4_ASSERT(rxq->wqes);
+ MLX4_ASSERT(rxq->rq_db);
return 0;
}
unsigned int i;
int ret;
- assert(rte_is_power_of_2(elts_n));
+ MLX4_ASSERT(rte_is_power_of_2(elts_n));
+ priv->verbs_alloc_ctx.type = MLX4_VERBS_ALLOC_TYPE_RX_QUEUE;
+ priv->verbs_alloc_ctx.obj = rxq;
cq = mlx4_glue->create_cq(priv->ctx, elts_n / sges_n, NULL,
rxq->channel, 0);
if (!cq) {
goto error;
}
/* Headroom is reserved by rte_pktmbuf_alloc(). */
- assert(buf->data_off == RTE_PKTMBUF_HEADROOM);
+ MLX4_ASSERT(buf->data_off == RTE_PKTMBUF_HEADROOM);
/* Buffer is supposed to be empty. */
- assert(rte_pktmbuf_data_len(buf) == 0);
- assert(rte_pktmbuf_pkt_len(buf) == 0);
+ MLX4_ASSERT(rte_pktmbuf_data_len(buf) == 0);
+ MLX4_ASSERT(rte_pktmbuf_pkt_len(buf) == 0);
/* Only the first segment keeps headroom. */
if (i % sges_n)
buf->data_off = 0;
rxq->rq_ci = elts_n / sges_n;
rte_wmb();
*rxq->rq_db = rte_cpu_to_be_32(rxq->rq_ci);
+ priv->verbs_alloc_ctx.type = MLX4_VERBS_ALLOC_TYPE_NONE;
return 0;
error:
if (wq)
rte_errno = ret;
ERROR("error while attaching Rx queue %p: %s: %s",
(void *)rxq, msg, strerror(ret));
+ priv->verbs_alloc_ctx.type = MLX4_VERBS_ALLOC_TYPE_NONE;
return -ret;
}
{
uint64_t offloads = DEV_RX_OFFLOAD_SCATTER |
DEV_RX_OFFLOAD_KEEP_CRC |
- DEV_RX_OFFLOAD_JUMBO_FRAME;
+ DEV_RX_OFFLOAD_JUMBO_FRAME |
+ DEV_RX_OFFLOAD_RSS_HASH;
if (priv->hw_csum)
offloads |= DEV_RX_OFFLOAD_CHECKSUM;
.socket = socket,
};
/* Enable scattered packets support for this queue if necessary. */
- assert(mb_len >= RTE_PKTMBUF_HEADROOM);
+ MLX4_ASSERT(mb_len >= RTE_PKTMBUF_HEADROOM);
if (dev->data->dev_conf.rxmode.max_rx_pkt_len <=
(mb_len - RTE_PKTMBUF_HEADROOM)) {
;
ret = rte_errno;
mlx4_rx_queue_release(rxq);
rte_errno = ret;
- assert(rte_errno > 0);
+ MLX4_ASSERT(rte_errno > 0);
return -rte_errno;
}
ETH_DEV(priv)->data->rx_queues[i] = NULL;
break;
}
- assert(!rxq->cq);
- assert(!rxq->wq);
- assert(!rxq->wqes);
- assert(!rxq->rq_db);
+ MLX4_ASSERT(!rxq->cq);
+ MLX4_ASSERT(!rxq->wq);
+ MLX4_ASSERT(!rxq->wqes);
+ MLX4_ASSERT(!rxq->rq_db);
if (rxq->channel)
claim_zero(mlx4_glue->destroy_comp_channel(rxq->channel));
mlx4_mr_btree_free(&rxq->mr_ctrl.cache_bh);