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

Function fs_tx_queue_setup

dpdk/drivers/net/failsafe/failsafe_ops.c:582–644  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

580}
581
582static int
583fs_tx_queue_setup(struct rte_eth_dev *dev,
584 uint16_t tx_queue_id,
585 uint16_t nb_tx_desc,
586 unsigned int socket_id,
587 const struct rte_eth_txconf *tx_conf)
588{
589 struct sub_device *sdev;
590 struct txq *txq;
591 uint8_t i;
592 int ret;
593
594 ret = fs_lock(dev, 0);
595 if (ret != 0)
596 return ret;
597 if (tx_conf->tx_deferred_start) {
598 FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
599 if (SUBOPS(sdev, tx_queue_start) == NULL) {
600 ERROR("Tx queue deferred start is not "
601 "supported for subdevice %d", i);
602 fs_unlock(dev, 0);
603 return -EINVAL;
604 }
605 }
606 }
607 txq = dev->data->tx_queues[tx_queue_id];
608 if (txq != NULL) {
609 fs_tx_queue_release(dev, tx_queue_id);
610 dev->data->tx_queues[tx_queue_id] = NULL;
611 }
612 txq = rte_zmalloc("ethdev TX queue",
613 sizeof(*txq) +
614 sizeof(rte_atomic64_t) * PRIV(dev)->subs_tail,
615 RTE_CACHE_LINE_SIZE);
616 if (txq == NULL) {
617 fs_unlock(dev, 0);
618 return -ENOMEM;
619 }
620 FOREACH_SUBDEV(sdev, i, dev)
621 rte_atomic64_init(&txq->refcnt[i]);
622 txq->qid = tx_queue_id;
623 txq->socket_id = socket_id;
624 txq->info.conf = *tx_conf;
625 txq->info.nb_desc = nb_tx_desc;
626 txq->priv = PRIV(dev);
627 dev->data->tx_queues[tx_queue_id] = txq;
628 FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) {
629 ret = rte_eth_tx_queue_setup(PORT_ID(sdev),
630 tx_queue_id,
631 nb_tx_desc, socket_id,
632 tx_conf);
633 if ((ret = fs_err(sdev, ret))) {
634 ERROR("TX queue setup failed for sub_device %d", i);
635 goto free_txq;
636 }
637 }
638 fs_unlock(dev, 0);
639 return 0;

Callers

nothing calls this directly

Calls 8

fs_lockFunction · 0.85
FOREACH_SUBDEV_STATEFunction · 0.85
fs_unlockFunction · 0.85
fs_tx_queue_releaseFunction · 0.85
rte_zmallocFunction · 0.85
rte_eth_tx_queue_setupFunction · 0.85
fs_errFunction · 0.85
rte_atomic64_initFunction · 0.50

Tested by

no test coverage detected