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

Function ionic_dev_tx_queue_setup

dpdk/drivers/net/ionic/ionic_rxtx.c:126–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126int __rte_cold
127ionic_dev_tx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t tx_queue_id,
128 uint16_t nb_desc, uint32_t socket_id,
129 const struct rte_eth_txconf *tx_conf)
130{
131 struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
132 struct ionic_tx_qcq *txq;
133 uint64_t offloads;
134 int err;
135
136 if (tx_queue_id >= lif->ntxqcqs) {
137 IONIC_PRINT(DEBUG, "Queue index %u not available "
138 "(max %u queues)",
139 tx_queue_id, lif->ntxqcqs);
140 return -EINVAL;
141 }
142
143 offloads = tx_conf->offloads | eth_dev->data->dev_conf.txmode.offloads;
144 IONIC_PRINT(DEBUG,
145 "Configuring skt %u TX queue %u with %u buffers, offloads %jx",
146 socket_id, tx_queue_id, nb_desc, offloads);
147
148 /* Validate number of receive descriptors */
149 if (!rte_is_power_of_2(nb_desc) || nb_desc < IONIC_MIN_RING_DESC)
150 return -EINVAL; /* or use IONIC_DEFAULT_RING_DESC */
151
152 if (tx_conf->tx_free_thresh > nb_desc) {
153 IONIC_PRINT(ERR,
154 "tx_free_thresh must be less than nb_desc (%u)",
155 nb_desc);
156 return -EINVAL;
157 }
158
159 /* Free memory prior to re-allocation if needed... */
160 if (eth_dev->data->tx_queues[tx_queue_id] != NULL) {
161 ionic_dev_tx_queue_release(eth_dev, tx_queue_id);
162 eth_dev->data->tx_queues[tx_queue_id] = NULL;
163 }
164
165 eth_dev->data->tx_queue_state[tx_queue_id] =
166 RTE_ETH_QUEUE_STATE_STOPPED;
167
168 err = ionic_tx_qcq_alloc(lif, socket_id, tx_queue_id, nb_desc, &txq);
169 if (err) {
170 IONIC_PRINT(DEBUG, "Queue allocation failure");
171 return -EINVAL;
172 }
173
174 /* Do not start queue with rte_eth_dev_start() */
175 if (tx_conf->tx_deferred_start)
176 txq->flags |= IONIC_QCQ_F_DEFERRED;
177
178 /* Convert the offload flags into queue flags */
179 if (offloads & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)
180 txq->flags |= IONIC_QCQ_F_CSUM_L3;
181 if (offloads & RTE_ETH_TX_OFFLOAD_TCP_CKSUM)
182 txq->flags |= IONIC_QCQ_F_CSUM_TCP;
183 if (offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM)

Callers

nothing calls this directly

Calls 3

ionic_tx_qcq_allocFunction · 0.85
rte_is_power_of_2Function · 0.50

Tested by

no test coverage detected