| 223 | } |
| 224 | |
| 225 | int |
| 226 | mana_start_rx_queues(struct rte_eth_dev *dev) |
| 227 | { |
| 228 | struct mana_priv *priv = dev->data->dev_private; |
| 229 | int ret, i; |
| 230 | struct ibv_wq *ind_tbl[priv->num_queues]; |
| 231 | |
| 232 | DRV_LOG(INFO, "start rx queues"); |
| 233 | |
| 234 | for (i = 0; i < priv->num_queues; i++) |
| 235 | if (dev->data->rx_queue_state[i] == RTE_ETH_QUEUE_STATE_STARTED) |
| 236 | return -EINVAL; |
| 237 | |
| 238 | for (i = 0; i < priv->num_queues; i++) { |
| 239 | struct mana_rxq *rxq = dev->data->rx_queues[i]; |
| 240 | struct ibv_wq_init_attr wq_attr = {}; |
| 241 | |
| 242 | manadv_set_context_attr(priv->ib_ctx, |
| 243 | MANADV_CTX_ATTR_BUF_ALLOCATORS, |
| 244 | (void *)((uintptr_t)&(struct manadv_ctx_allocators){ |
| 245 | .alloc = &mana_alloc_verbs_buf, |
| 246 | .free = &mana_free_verbs_buf, |
| 247 | .data = (void *)(uintptr_t)rxq->socket, |
| 248 | })); |
| 249 | |
| 250 | if (dev->data->dev_conf.intr_conf.rxq) { |
| 251 | rxq->channel = ibv_create_comp_channel(priv->ib_ctx); |
| 252 | if (!rxq->channel) { |
| 253 | ret = -errno; |
| 254 | DRV_LOG(ERR, "Queue %d comp channel failed", i); |
| 255 | goto fail; |
| 256 | } |
| 257 | |
| 258 | ret = mana_fd_set_non_blocking(rxq->channel->fd); |
| 259 | if (ret) { |
| 260 | DRV_LOG(ERR, "Failed to set comp non-blocking"); |
| 261 | goto fail; |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | rxq->cq = ibv_create_cq(priv->ib_ctx, rxq->num_desc, |
| 266 | NULL, rxq->channel, |
| 267 | rxq->channel ? i : 0); |
| 268 | if (!rxq->cq) { |
| 269 | ret = -errno; |
| 270 | DRV_LOG(ERR, "failed to create rx cq queue %d", i); |
| 271 | goto fail; |
| 272 | } |
| 273 | |
| 274 | wq_attr.wq_type = IBV_WQT_RQ; |
| 275 | wq_attr.max_wr = rxq->num_desc; |
| 276 | wq_attr.max_sge = 1; |
| 277 | wq_attr.pd = priv->ib_parent_pd; |
| 278 | wq_attr.cq = rxq->cq; |
| 279 | |
| 280 | rxq->wq = ibv_create_wq(priv->ib_ctx, &wq_attr); |
| 281 | if (!rxq->wq) { |
| 282 | ret = -errno; |
no test coverage detected