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

Function vmxnet3_dev_tx_queue_setup

dpdk/drivers/net/vmxnet3/vmxnet3_rxtx.c:1088–1187  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1086}
1087
1088int
1089vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev,
1090 uint16_t queue_idx,
1091 uint16_t nb_desc,
1092 unsigned int socket_id,
1093 const struct rte_eth_txconf *tx_conf __rte_unused)
1094{
1095 struct vmxnet3_hw *hw = dev->data->dev_private;
1096 const struct rte_memzone *mz;
1097 struct vmxnet3_tx_queue *txq;
1098 struct vmxnet3_cmd_ring *ring;
1099 struct vmxnet3_comp_ring *comp_ring;
1100 struct vmxnet3_data_ring *data_ring;
1101 int size;
1102
1103 PMD_INIT_FUNC_TRACE();
1104
1105 txq = rte_zmalloc("ethdev_tx_queue", sizeof(struct vmxnet3_tx_queue),
1106 RTE_CACHE_LINE_SIZE);
1107 if (txq == NULL) {
1108 PMD_INIT_LOG(ERR, "Can not allocate tx queue structure");
1109 return -ENOMEM;
1110 }
1111
1112 txq->queue_id = queue_idx;
1113 txq->port_id = dev->data->port_id;
1114 txq->shared = NULL; /* set in vmxnet3_setup_driver_shared() */
1115 txq->hw = hw;
1116 txq->qid = queue_idx;
1117 txq->stopped = TRUE;
1118 txq->txdata_desc_size = hw->txdata_desc_size;
1119
1120 ring = &txq->cmd_ring;
1121 comp_ring = &txq->comp_ring;
1122 data_ring = &txq->data_ring;
1123
1124 /* Tx vmxnet ring length should be between 512-4096 */
1125 if (nb_desc < VMXNET3_DEF_TX_RING_SIZE) {
1126 PMD_INIT_LOG(ERR, "VMXNET3 Tx Ring Size Min: %u",
1127 VMXNET3_DEF_TX_RING_SIZE);
1128 return -EINVAL;
1129 } else if (nb_desc > VMXNET3_TX_RING_MAX_SIZE) {
1130 PMD_INIT_LOG(ERR, "VMXNET3 Tx Ring Size Max: %u",
1131 VMXNET3_TX_RING_MAX_SIZE);
1132 return -EINVAL;
1133 } else {
1134 ring->size = nb_desc;
1135 if (VMXNET3_VERSION_GE_7(hw))
1136 ring->size = rte_align32prevpow2(nb_desc);
1137 ring->size &= ~VMXNET3_RING_SIZE_MASK;
1138 }
1139 comp_ring->size = data_ring->size = ring->size;
1140
1141 /* Tx vmxnet rings structure initialization*/
1142 ring->next2fill = 0;
1143 ring->next2comp = 0;
1144 ring->gen = VMXNET3_INIT_GEN;
1145 comp_ring->next2proc = 0;

Callers

nothing calls this directly

Calls 4

rte_zmallocFunction · 0.85
rte_eth_dma_zone_reserveFunction · 0.85
memsetFunction · 0.85
rte_align32prevpow2Function · 0.50

Tested by

no test coverage detected