MCPcopy Create free account
hub / github.com/F-Stack/f-stack / txgbe_dev_rx_queue_setup

Function txgbe_dev_rx_queue_setup

dpdk/drivers/net/txgbe/txgbe_rxtx.c:2568–2725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2566}
2567
2568int __rte_cold
2569txgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
2570 uint16_t queue_idx,
2571 uint16_t nb_desc,
2572 unsigned int socket_id,
2573 const struct rte_eth_rxconf *rx_conf,
2574 struct rte_mempool *mp)
2575{
2576 const struct rte_memzone *rz;
2577 struct txgbe_rx_queue *rxq;
2578 struct txgbe_hw *hw;
2579 uint16_t len;
2580 struct txgbe_adapter *adapter = TXGBE_DEV_ADAPTER(dev);
2581 uint64_t offloads;
2582
2583 PMD_INIT_FUNC_TRACE();
2584 hw = TXGBE_DEV_HW(dev);
2585
2586 offloads = rx_conf->offloads | dev->data->dev_conf.rxmode.offloads;
2587
2588 /*
2589 * Validate number of receive descriptors.
2590 * It must not exceed hardware maximum, and must be multiple
2591 * of TXGBE_ALIGN.
2592 */
2593 if (nb_desc % TXGBE_RXD_ALIGN != 0 ||
2594 nb_desc > TXGBE_RING_DESC_MAX ||
2595 nb_desc < TXGBE_RING_DESC_MIN) {
2596 return -EINVAL;
2597 }
2598
2599 /* Free memory prior to re-allocation if needed... */
2600 if (dev->data->rx_queues[queue_idx] != NULL) {
2601 txgbe_rx_queue_release(dev->data->rx_queues[queue_idx]);
2602 dev->data->rx_queues[queue_idx] = NULL;
2603 }
2604
2605 /* First allocate the rx queue data structure */
2606 rxq = rte_zmalloc_socket("ethdev RX queue",
2607 sizeof(struct txgbe_rx_queue),
2608 RTE_CACHE_LINE_SIZE, socket_id);
2609 if (rxq == NULL)
2610 return -ENOMEM;
2611 rxq->mb_pool = mp;
2612 rxq->nb_rx_desc = nb_desc;
2613 rxq->rx_free_thresh = rx_conf->rx_free_thresh;
2614 rxq->queue_id = queue_idx;
2615 rxq->reg_idx = (uint16_t)((RTE_ETH_DEV_SRIOV(dev).active == 0) ?
2616 queue_idx : RTE_ETH_DEV_SRIOV(dev).def_pool_q_idx + queue_idx);
2617 rxq->port_id = dev->data->port_id;
2618 if (dev->data->dev_conf.rxmode.offloads & RTE_ETH_RX_OFFLOAD_KEEP_CRC)
2619 rxq->crc_len = RTE_ETHER_CRC_LEN;
2620 else
2621 rxq->crc_len = 0;
2622 rxq->drop_en = rx_conf->rx_drop_en;
2623 rxq->rx_deferred_start = rx_conf->rx_deferred_start;
2624 rxq->offloads = offloads;
2625

Callers

nothing calls this directly

Calls 6

txgbe_rx_queue_releaseFunction · 0.85
rte_zmalloc_socketFunction · 0.85
rte_eth_dma_zone_reserveFunction · 0.85
memsetFunction · 0.85
txgbe_reset_rx_queueFunction · 0.85

Tested by

no test coverage detected