| 402 | } |
| 403 | |
| 404 | static int |
| 405 | fs_rx_queue_setup(struct rte_eth_dev *dev, |
| 406 | uint16_t rx_queue_id, |
| 407 | uint16_t nb_rx_desc, |
| 408 | unsigned int socket_id, |
| 409 | const struct rte_eth_rxconf *rx_conf, |
| 410 | struct rte_mempool *mb_pool) |
| 411 | { |
| 412 | struct sub_device *sdev; |
| 413 | struct rxq *rxq; |
| 414 | uint8_t i; |
| 415 | int ret; |
| 416 | |
| 417 | ret = fs_lock(dev, 0); |
| 418 | if (ret != 0) |
| 419 | return ret; |
| 420 | if (rx_conf->rx_deferred_start) { |
| 421 | FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) { |
| 422 | if (SUBOPS(sdev, rx_queue_start) == NULL) { |
| 423 | ERROR("Rx queue deferred start is not " |
| 424 | "supported for subdevice %d", i); |
| 425 | fs_unlock(dev, 0); |
| 426 | return -EINVAL; |
| 427 | } |
| 428 | } |
| 429 | } |
| 430 | rxq = dev->data->rx_queues[rx_queue_id]; |
| 431 | if (rxq != NULL) { |
| 432 | fs_rx_queue_release(dev, rx_queue_id); |
| 433 | dev->data->rx_queues[rx_queue_id] = NULL; |
| 434 | } |
| 435 | rxq = rte_zmalloc(NULL, |
| 436 | sizeof(*rxq) + |
| 437 | sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail, |
| 438 | RTE_CACHE_LINE_SIZE); |
| 439 | if (rxq == NULL) { |
| 440 | fs_unlock(dev, 0); |
| 441 | return -ENOMEM; |
| 442 | } |
| 443 | FOREACH_SUBDEV(sdev, i, dev) |
| 444 | rte_atomic64_init(&rxq->refcnt[i]); |
| 445 | rxq->qid = rx_queue_id; |
| 446 | rxq->socket_id = socket_id; |
| 447 | rxq->info.mp = mb_pool; |
| 448 | rxq->info.conf = *rx_conf; |
| 449 | rxq->info.nb_desc = nb_rx_desc; |
| 450 | rxq->priv = PRIV(dev); |
| 451 | rxq->sdev = PRIV(dev)->subs; |
| 452 | #ifdef RTE_EXEC_ENV_LINUX |
| 453 | rxq->event_fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); |
| 454 | if (rxq->event_fd < 0) { |
| 455 | ERROR("Failed to create an eventfd: %s", strerror(errno)); |
| 456 | fs_unlock(dev, 0); |
| 457 | return -errno; |
| 458 | } |
| 459 | #else |
| 460 | rxq->event_fd = -1; |
| 461 | #endif |
nothing calls this directly
no test coverage detected