* Start Receive Units for specified queue. */
| 675 | * Start Receive Units for specified queue. |
| 676 | */ |
| 677 | int __rte_cold |
| 678 | ionic_dev_rx_queue_start(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) |
| 679 | { |
| 680 | uint8_t *rx_queue_state = eth_dev->data->rx_queue_state; |
| 681 | struct ionic_rx_qcq *rxq; |
| 682 | struct ionic_queue *q; |
| 683 | int err; |
| 684 | |
| 685 | if (rx_queue_state[rx_queue_id] == RTE_ETH_QUEUE_STATE_STARTED) { |
| 686 | IONIC_PRINT(DEBUG, "RX queue %u already started", |
| 687 | rx_queue_id); |
| 688 | return 0; |
| 689 | } |
| 690 | |
| 691 | rxq = eth_dev->data->rx_queues[rx_queue_id]; |
| 692 | q = &rxq->qcq.q; |
| 693 | |
| 694 | rxq->frame_size = rxq->qcq.lif->frame_size - RTE_ETHER_CRC_LEN; |
| 695 | |
| 696 | /* Recalculate segment count based on MTU */ |
| 697 | q->num_segs = 1 + |
| 698 | (rxq->frame_size + RTE_PKTMBUF_HEADROOM - 1) / rxq->seg_size; |
| 699 | |
| 700 | IONIC_PRINT(DEBUG, "Starting RX queue %u, %u descs, size %u segs %u", |
| 701 | rx_queue_id, q->num_descs, rxq->frame_size, q->num_segs); |
| 702 | |
| 703 | ionic_rx_init_descriptors(rxq); |
| 704 | |
| 705 | err = ionic_lif_rxq_init(rxq); |
| 706 | if (err) |
| 707 | return err; |
| 708 | |
| 709 | /* Allocate buffers for descriptor ring */ |
| 710 | if (rxq->flags & IONIC_QCQ_F_SG) |
| 711 | err = ionic_rx_fill_sg(rxq); |
| 712 | else |
| 713 | err = ionic_rx_fill(rxq); |
| 714 | if (err != 0) { |
| 715 | IONIC_PRINT(ERR, "Could not fill queue %d", rx_queue_id); |
| 716 | return -1; |
| 717 | } |
| 718 | |
| 719 | rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; |
| 720 | |
| 721 | return 0; |
| 722 | } |
| 723 | |
| 724 | /* |
| 725 | * Stop Receive Units for specified queue. |
no test coverage detected