Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright (c) 2022-2023 Google LLC
3 : : * Copyright (c) 2022-2023 Intel Corporation
4 : : */
5 : :
6 : :
7 : : #include "gve_ethdev.h"
8 : : #include "base/gve_adminq.h"
9 : : #include "rte_mbuf_ptype.h"
10 : : #include "rte_atomic.h"
11 : :
12 : : static inline void
13 : : gve_completed_buf_list_init(struct gve_rx_queue *rxq)
14 : : {
15 [ # # ]: 0 : for (int i = 0; i < rxq->nb_rx_desc; i++)
16 : 0 : rxq->completed_buf_list[i] = -1;
17 : :
18 : 0 : rxq->completed_buf_list_head = -1;
19 : : }
20 : :
21 : : /* Assumes buf_id < nb_rx_desc */
22 : : static inline void
23 : : gve_completed_buf_list_push(struct gve_rx_queue *rxq, uint16_t buf_id)
24 : : {
25 : 0 : rxq->completed_buf_list[buf_id] = rxq->completed_buf_list_head;
26 : 0 : rxq->completed_buf_list_head = buf_id;
27 : : }
28 : :
29 : : static inline int16_t
30 : : gve_completed_buf_list_pop(struct gve_rx_queue *rxq)
31 : : {
32 : 0 : int16_t head = rxq->completed_buf_list_head;
33 : 0 : if (head != -1)
34 : 0 : rxq->completed_buf_list_head = rxq->completed_buf_list[head];
35 : :
36 : : return head;
37 : : }
38 : :
39 : : static inline void
40 : 0 : gve_rx_refill_dqo(struct gve_rx_queue *rxq)
41 : 0 : {
42 : : volatile struct gve_rx_desc_dqo *rx_buf_desc;
43 : 0 : struct rte_mbuf *new_bufs[rxq->nb_rx_desc];
44 : 0 : uint16_t rx_mask = rxq->nb_rx_desc - 1;
45 : 0 : uint16_t next_avail = rxq->bufq_tail;
46 : : struct rte_eth_dev *dev;
47 : : uint16_t nb_refill;
48 : : uint64_t dma_addr;
49 : : int16_t buf_id;
50 : : int diag;
51 : : int i;
52 : :
53 : 0 : nb_refill = rxq->nb_rx_hold;
54 [ # # ]: 0 : if (nb_refill < rxq->free_thresh)
55 : 0 : return;
56 : :
57 : 0 : diag = rte_pktmbuf_alloc_bulk(rxq->mpool, new_bufs, nb_refill);
58 [ # # ]: 0 : if (unlikely(diag < 0)) {
59 : 0 : rxq->stats.no_mbufs_bulk++;
60 : 0 : rxq->stats.no_mbufs += nb_refill;
61 : 0 : dev = &rte_eth_devices[rxq->port_id];
62 : 0 : dev->data->rx_mbuf_alloc_failed += nb_refill;
63 : : PMD_DRV_DP_LOG(DEBUG,
64 : : "RX mbuf alloc failed port_id=%u queue_id=%u",
65 : : rxq->port_id, rxq->queue_id);
66 : 0 : return;
67 : : }
68 : :
69 : : /* Mbuf allocation succeeded, so refill buffers. */
70 [ # # ]: 0 : for (i = 0; i < nb_refill; i++) {
71 [ # # ]: 0 : rx_buf_desc = &rxq->rx_ring[next_avail];
72 : : buf_id = gve_completed_buf_list_pop(rxq);
73 : :
74 : : /* Out of buffers. Free remaining mbufs and return. */
75 [ # # ]: 0 : if (unlikely(buf_id == -1)) {
76 : 0 : PMD_DRV_DP_LOG(ERR,
77 : : "No free entries in sw_ring for port %d, queue %d.",
78 : : rxq->port_id, rxq->queue_id);
79 : 0 : rte_pktmbuf_free_bulk(new_bufs + i, nb_refill - i);
80 : 0 : nb_refill = i;
81 : 0 : break;
82 : : }
83 : 0 : rxq->sw_ring[buf_id] = new_bufs[i];
84 : 0 : dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(new_bufs[i]));
85 : 0 : rx_buf_desc->buf_id = buf_id;
86 : 0 : rx_buf_desc->header_buf_addr = 0;
87 : 0 : rx_buf_desc->buf_addr = dma_addr;
88 : :
89 : 0 : next_avail = (next_avail + 1) & rx_mask;
90 : : }
91 : :
92 : 0 : rxq->nb_rx_hold -= nb_refill;
93 : 0 : rte_write32(next_avail, rxq->qrx_tail);
94 : 0 : rxq->bufq_tail = next_avail;
95 : : }
96 : :
97 : : static inline void
98 : 0 : gve_parse_csum_ol_flags(struct rte_mbuf *rx_mbuf,
99 : : volatile struct gve_rx_compl_desc_dqo *rx_desc)
100 : : {
101 [ # # ]: 0 : if (!rx_desc->l3_l4_processed)
102 : : return;
103 : :
104 [ # # ]: 0 : if (rx_mbuf->packet_type & RTE_PTYPE_L3_IPV4) {
105 [ # # ]: 0 : if (rx_desc->csum_ip_err)
106 : 0 : rx_mbuf->ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_BAD;
107 : : else
108 : 0 : rx_mbuf->ol_flags |= RTE_MBUF_F_RX_IP_CKSUM_GOOD;
109 : : }
110 : :
111 [ # # ]: 0 : if (rx_desc->csum_l4_err) {
112 : 0 : rx_mbuf->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_BAD;
113 : 0 : return;
114 : : }
115 [ # # ]: 0 : if (rx_mbuf->packet_type & RTE_PTYPE_L4_MASK)
116 : 0 : rx_mbuf->ol_flags |= RTE_MBUF_F_RX_L4_CKSUM_GOOD;
117 : : }
118 : :
119 : : static inline void
120 : 0 : gve_rx_set_mbuf_ptype(struct gve_priv *priv, struct rte_mbuf *rx_mbuf,
121 : : volatile struct gve_rx_compl_desc_dqo *rx_desc)
122 : : {
123 : 0 : struct gve_ptype ptype =
124 : 0 : priv->ptype_lut_dqo->ptypes[rx_desc->packet_type];
125 : 0 : rx_mbuf->packet_type = 0;
126 : :
127 [ # # # ]: 0 : switch (ptype.l3_type) {
128 : 0 : case GVE_L3_TYPE_IPV4:
129 : 0 : rx_mbuf->packet_type |= RTE_PTYPE_L3_IPV4;
130 : 0 : break;
131 : 0 : case GVE_L3_TYPE_IPV6:
132 : 0 : rx_mbuf->packet_type |= RTE_PTYPE_L3_IPV6;
133 : 0 : break;
134 : : default:
135 : : break;
136 : : }
137 : :
138 [ # # # # : 0 : switch (ptype.l4_type) {
# ]
139 : 0 : case GVE_L4_TYPE_TCP:
140 : 0 : rx_mbuf->packet_type |= RTE_PTYPE_L4_TCP;
141 : 0 : break;
142 : 0 : case GVE_L4_TYPE_UDP:
143 : 0 : rx_mbuf->packet_type |= RTE_PTYPE_L4_UDP;
144 : 0 : break;
145 : 0 : case GVE_L4_TYPE_ICMP:
146 : 0 : rx_mbuf->packet_type |= RTE_PTYPE_L4_ICMP;
147 : 0 : break;
148 : 0 : case GVE_L4_TYPE_SCTP:
149 : 0 : rx_mbuf->packet_type |= RTE_PTYPE_L4_SCTP;
150 : 0 : break;
151 : : default:
152 : : break;
153 : : }
154 : 0 : }
155 : :
156 : : uint16_t
157 : 0 : gve_rx_burst_dqo(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
158 : : {
159 : : volatile struct gve_rx_compl_desc_dqo *rx_desc;
160 : : struct gve_rx_queue *rxq;
161 : : struct rte_mbuf *rxm;
162 : : uint16_t rx_buf_id;
163 : : uint16_t pkt_len;
164 : : uint16_t rx_id;
165 : : uint16_t nb_rx;
166 : : uint64_t bytes;
167 : :
168 : : bytes = 0;
169 : : nb_rx = 0;
170 : : rxq = rx_queue;
171 : 0 : rx_id = rxq->rx_tail;
172 : :
173 [ # # ]: 0 : while (nb_rx < nb_pkts) {
174 : 0 : rx_desc = &rxq->compl_ring[rx_id];
175 : :
176 : : /* check status */
177 [ # # ]: 0 : if (rx_desc->generation != rxq->cur_gen_bit)
178 : : break;
179 : :
180 : 0 : rte_io_rmb();
181 : :
182 : 0 : rxq->nb_rx_hold++;
183 : 0 : rx_id++;
184 [ # # ]: 0 : if (rx_id == rxq->nb_rx_desc) {
185 : : rx_id = 0;
186 : 0 : rxq->cur_gen_bit ^= 1;
187 : : }
188 : :
189 : 0 : rx_buf_id = rte_le_to_cpu_16(rx_desc->buf_id);
190 : 0 : rxm = rxq->sw_ring[rx_buf_id];
191 : : gve_completed_buf_list_push(rxq, rx_buf_id);
192 : :
193 : : /* Free buffer and report error. */
194 [ # # ]: 0 : if (unlikely(rx_desc->rx_error)) {
195 : 0 : rxq->stats.errors++;
196 : 0 : rte_pktmbuf_free(rxm);
197 : 0 : continue;
198 : : }
199 : :
200 : 0 : pkt_len = rte_le_to_cpu_16(rx_desc->packet_len);
201 : 0 : rxm->pkt_len = pkt_len;
202 : 0 : rxm->data_len = pkt_len;
203 : 0 : rxm->port = rxq->port_id;
204 : 0 : gve_rx_set_mbuf_ptype(rxq->hw, rxm, rx_desc);
205 : 0 : rxm->ol_flags = RTE_MBUF_F_RX_RSS_HASH;
206 : 0 : gve_parse_csum_ol_flags(rxm, rx_desc);
207 : 0 : rxm->hash.rss = rte_le_to_cpu_32(rx_desc->hash);
208 : :
209 : 0 : rx_pkts[nb_rx++] = rxm;
210 : 0 : bytes += pkt_len;
211 : : }
212 : :
213 [ # # ]: 0 : if (nb_rx > 0) {
214 : 0 : rxq->rx_tail = rx_id;
215 : :
216 : 0 : rxq->stats.packets += nb_rx;
217 : 0 : rxq->stats.bytes += bytes;
218 : : }
219 : 0 : gve_rx_refill_dqo(rxq);
220 : :
221 : 0 : return nb_rx;
222 : : }
223 : :
224 : : static inline void
225 : 0 : gve_release_rxq_mbufs_dqo(struct gve_rx_queue *rxq)
226 : : {
227 : : uint16_t i;
228 : :
229 [ # # ]: 0 : for (i = 0; i < rxq->nb_rx_desc; i++) {
230 [ # # ]: 0 : if (rxq->sw_ring[i]) {
231 : : rte_pktmbuf_free_seg(rxq->sw_ring[i]);
232 : 0 : rxq->sw_ring[i] = NULL;
233 : : }
234 : : }
235 : :
236 : 0 : rxq->nb_avail = rxq->nb_rx_desc;
237 : 0 : }
238 : :
239 : : void
240 : 0 : gve_rx_queue_release_dqo(struct rte_eth_dev *dev, uint16_t qid)
241 : : {
242 : 0 : struct gve_rx_queue *q = dev->data->rx_queues[qid];
243 : :
244 [ # # ]: 0 : if (q == NULL)
245 : : return;
246 : :
247 : 0 : gve_release_rxq_mbufs_dqo(q);
248 : 0 : rte_free(q->sw_ring);
249 : 0 : rte_free(q->completed_buf_list);
250 : 0 : rte_memzone_free(q->compl_ring_mz);
251 : 0 : rte_memzone_free(q->mz);
252 : 0 : rte_memzone_free(q->qres_mz);
253 : 0 : q->qres = NULL;
254 : 0 : rte_free(q);
255 : :
256 : 0 : dev->data->rx_queues[qid] = NULL;
257 : : }
258 : :
259 : : static void
260 : 0 : gve_reset_rx_ring_state_dqo(struct gve_rx_queue *rxq)
261 : : {
262 : : struct rte_mbuf **sw_ring;
263 : : uint32_t size, i;
264 : :
265 [ # # ]: 0 : if (rxq == NULL) {
266 : 0 : PMD_DRV_LOG(ERR, "pointer to rxq is NULL");
267 : 0 : return;
268 : : }
269 : :
270 : 0 : size = rxq->nb_rx_desc * sizeof(struct gve_rx_desc_dqo);
271 [ # # ]: 0 : for (i = 0; i < size; i++)
272 : 0 : ((volatile char *)rxq->rx_ring)[i] = 0;
273 : :
274 : 0 : size = rxq->nb_rx_desc * sizeof(struct gve_rx_compl_desc_dqo);
275 [ # # ]: 0 : for (i = 0; i < size; i++)
276 : 0 : ((volatile char *)rxq->compl_ring)[i] = 0;
277 : :
278 : 0 : sw_ring = rxq->sw_ring;
279 [ # # ]: 0 : for (i = 0; i < rxq->nb_rx_desc; i++)
280 : 0 : sw_ring[i] = NULL;
281 : :
282 : : gve_completed_buf_list_init(rxq);
283 : :
284 : 0 : rxq->bufq_tail = 0;
285 : 0 : rxq->nb_rx_hold = rxq->nb_rx_desc - 1;
286 : :
287 : 0 : rxq->rx_tail = 0;
288 : 0 : rxq->cur_gen_bit = 1;
289 : : }
290 : :
291 : : int
292 : 0 : gve_rx_queue_setup_dqo(struct rte_eth_dev *dev, uint16_t queue_id,
293 : : uint16_t nb_desc, unsigned int socket_id,
294 : : const struct rte_eth_rxconf *conf,
295 : : struct rte_mempool *pool)
296 : : {
297 : 0 : struct gve_priv *hw = dev->data->dev_private;
298 : : const struct rte_memzone *mz;
299 : : struct gve_rx_queue *rxq;
300 : : uint16_t free_thresh;
301 : : uint32_t mbuf_len;
302 : : int err = 0;
303 : :
304 : : /* Free memory if needed */
305 [ # # ]: 0 : if (dev->data->rx_queues[queue_id]) {
306 : 0 : gve_rx_queue_release_dqo(dev, queue_id);
307 : 0 : dev->data->rx_queues[queue_id] = NULL;
308 : : }
309 : :
310 : : /* Allocate the RX queue data structure. */
311 : 0 : rxq = rte_zmalloc_socket("gve rxq",
312 : : sizeof(struct gve_rx_queue),
313 : : RTE_CACHE_LINE_SIZE,
314 : : socket_id);
315 [ # # ]: 0 : if (rxq == NULL) {
316 : 0 : PMD_DRV_LOG(ERR, "Failed to allocate memory for rx queue structure");
317 : 0 : return -ENOMEM;
318 : : }
319 : :
320 : : /* check free_thresh here */
321 [ # # ]: 0 : free_thresh = conf->rx_free_thresh ?
322 : : conf->rx_free_thresh : GVE_DEFAULT_RX_FREE_THRESH;
323 [ # # ]: 0 : if (free_thresh >= nb_desc) {
324 : 0 : PMD_DRV_LOG(ERR, "rx_free_thresh (%u) must be less than nb_desc (%u).",
325 : : free_thresh, rxq->nb_rx_desc);
326 : : err = -EINVAL;
327 : 0 : goto free_rxq;
328 : : }
329 : :
330 : 0 : rxq->nb_rx_desc = nb_desc;
331 : 0 : rxq->free_thresh = free_thresh;
332 : 0 : rxq->queue_id = queue_id;
333 : 0 : rxq->port_id = dev->data->port_id;
334 : 0 : rxq->ntfy_id = hw->num_ntfy_blks / 2 + queue_id;
335 : :
336 : 0 : rxq->mpool = pool;
337 : 0 : rxq->hw = hw;
338 [ # # # # ]: 0 : rxq->ntfy_addr = &hw->db_bar2[rte_be_to_cpu_32(hw->irq_dbs[rxq->ntfy_id].id)];
339 : :
340 : 0 : mbuf_len =
341 : 0 : rte_pktmbuf_data_room_size(rxq->mpool) - RTE_PKTMBUF_HEADROOM;
342 : 0 : rxq->rx_buf_len =
343 : 0 : RTE_MIN((uint16_t)GVE_RX_MAX_BUF_SIZE_DQO,
344 : : RTE_ALIGN_FLOOR(mbuf_len, GVE_RX_BUF_ALIGN_DQO));
345 : :
346 : : /* Allocate software ring */
347 : 0 : rxq->sw_ring = rte_zmalloc_socket("gve rx sw ring",
348 : : nb_desc * sizeof(struct rte_mbuf *),
349 : : RTE_CACHE_LINE_SIZE, socket_id);
350 [ # # ]: 0 : if (rxq->sw_ring == NULL) {
351 : 0 : PMD_DRV_LOG(ERR, "Failed to allocate memory for SW RX ring");
352 : : err = -ENOMEM;
353 : 0 : goto free_rxq;
354 : : }
355 : :
356 : : /* Allocate completed bufs list */
357 : 0 : rxq->completed_buf_list = rte_zmalloc_socket("gve completed buf list",
358 : : nb_desc * sizeof(*rxq->completed_buf_list), RTE_CACHE_LINE_SIZE,
359 : : socket_id);
360 [ # # ]: 0 : if (rxq->completed_buf_list == NULL) {
361 : 0 : PMD_DRV_LOG(ERR, "Failed to allocate completed buffer list.");
362 : : err = -ENOMEM;
363 : 0 : goto free_rxq_sw_ring;
364 : : }
365 : :
366 : : /* Allocate RX buffer queue */
367 : 0 : mz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_id,
368 : : nb_desc * sizeof(struct gve_rx_desc_dqo),
369 : : PAGE_SIZE, socket_id);
370 [ # # ]: 0 : if (mz == NULL) {
371 : 0 : PMD_DRV_LOG(ERR, "Failed to reserve DMA memory for RX buffer queue");
372 : : err = -ENOMEM;
373 : 0 : goto free_rxq_completed_buf_list;
374 : : }
375 : 0 : rxq->rx_ring = (struct gve_rx_desc_dqo *)mz->addr;
376 : 0 : rxq->rx_ring_phys_addr = mz->iova;
377 : 0 : rxq->mz = mz;
378 : :
379 : : /* Allocate RX completion queue */
380 : 0 : mz = rte_eth_dma_zone_reserve(dev, "compl_ring", queue_id,
381 : : nb_desc * sizeof(struct gve_rx_compl_desc_dqo),
382 : : PAGE_SIZE, socket_id);
383 [ # # ]: 0 : if (mz == NULL) {
384 : 0 : PMD_DRV_LOG(ERR, "Failed to reserve DMA memory for RX completion queue");
385 : : err = -ENOMEM;
386 : 0 : goto free_rxq_mz;
387 : : }
388 : : /* Zero all the descriptors in the ring */
389 : 0 : memset(mz->addr, 0, nb_desc * sizeof(struct gve_rx_compl_desc_dqo));
390 : 0 : rxq->compl_ring = (struct gve_rx_compl_desc_dqo *)mz->addr;
391 : 0 : rxq->compl_ring_phys_addr = mz->iova;
392 : 0 : rxq->compl_ring_mz = mz;
393 : :
394 : 0 : mz = rte_eth_dma_zone_reserve(dev, "rxq_res", queue_id,
395 : : sizeof(struct gve_queue_resources),
396 : : PAGE_SIZE, socket_id);
397 [ # # ]: 0 : if (mz == NULL) {
398 : 0 : PMD_DRV_LOG(ERR, "Failed to reserve DMA memory for RX resource");
399 : : err = -ENOMEM;
400 : 0 : goto free_rxq_cq_mz;
401 : : }
402 : 0 : rxq->qres = (struct gve_queue_resources *)mz->addr;
403 : 0 : rxq->qres_mz = mz;
404 : :
405 : 0 : gve_reset_rx_ring_state_dqo(rxq);
406 : :
407 : 0 : dev->data->rx_queues[queue_id] = rxq;
408 : :
409 : 0 : return 0;
410 : :
411 : : free_rxq_cq_mz:
412 : 0 : rte_memzone_free(rxq->compl_ring_mz);
413 : 0 : free_rxq_mz:
414 : 0 : rte_memzone_free(rxq->mz);
415 : 0 : free_rxq_completed_buf_list:
416 : 0 : rte_free(rxq->completed_buf_list);
417 : 0 : free_rxq_sw_ring:
418 : 0 : rte_free(rxq->sw_ring);
419 : 0 : free_rxq:
420 : 0 : rte_free(rxq);
421 : 0 : return err;
422 : : }
423 : :
424 : : static int
425 : 0 : gve_rxq_mbufs_alloc_dqo(struct gve_rx_queue *rxq)
426 : : {
427 : : struct rte_mbuf *nmb;
428 : : uint16_t rx_mask;
429 : : uint16_t i;
430 : : int diag;
431 : :
432 : 0 : rx_mask = rxq->nb_rx_desc - 1;
433 : 0 : diag = rte_pktmbuf_alloc_bulk(rxq->mpool, &rxq->sw_ring[0],
434 : : rx_mask);
435 [ # # ]: 0 : if (diag < 0) {
436 : 0 : rxq->stats.no_mbufs_bulk++;
437 [ # # ]: 0 : for (i = 0; i < rx_mask; i++) {
438 : 0 : nmb = rte_pktmbuf_alloc(rxq->mpool);
439 [ # # ]: 0 : if (!nmb) {
440 : 0 : rxq->stats.no_mbufs++;
441 : 0 : gve_release_rxq_mbufs_dqo(rxq);
442 : 0 : return -ENOMEM;
443 : : }
444 : 0 : rxq->sw_ring[i] = nmb;
445 : : }
446 : : }
447 : :
448 [ # # ]: 0 : for (i = 0; i < rx_mask; i++) {
449 : 0 : nmb = rxq->sw_ring[i];
450 : 0 : rxq->rx_ring[i].buf_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(nmb));
451 : 0 : rxq->rx_ring[i].buf_id = rte_cpu_to_le_16(i);
452 : : }
453 : 0 : rxq->rx_ring[rx_mask].buf_id = rte_cpu_to_le_16(rx_mask);
454 : :
455 : 0 : rxq->nb_rx_hold = 0;
456 : 0 : rxq->bufq_tail = rx_mask;
457 : :
458 : 0 : rte_write32(rxq->bufq_tail, rxq->qrx_tail);
459 : :
460 : 0 : return 0;
461 : : }
462 : :
463 : : int
464 : 0 : gve_rx_queue_start_dqo(struct rte_eth_dev *dev, uint16_t rx_queue_id)
465 : : {
466 : 0 : struct gve_priv *hw = dev->data->dev_private;
467 : : struct gve_rx_queue *rxq;
468 : : int ret;
469 : :
470 [ # # ]: 0 : if (rx_queue_id >= dev->data->nb_rx_queues)
471 : : return -EINVAL;
472 : :
473 : 0 : rxq = dev->data->rx_queues[rx_queue_id];
474 : :
475 [ # # ]: 0 : rxq->qrx_tail = &hw->db_bar2[rte_be_to_cpu_32(rxq->qres->db_index)];
476 : :
477 : : rte_write32(rte_cpu_to_le_32(GVE_NO_INT_MODE_DQO |
478 : : GVE_ITR_NO_UPDATE_DQO),
479 : 0 : rxq->ntfy_addr);
480 : :
481 : 0 : ret = gve_rxq_mbufs_alloc_dqo(rxq);
482 [ # # ]: 0 : if (ret != 0) {
483 : 0 : PMD_DRV_LOG(ERR, "Failed to alloc Rx queue mbuf");
484 : 0 : return ret;
485 : : }
486 : :
487 : 0 : dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
488 : :
489 : 0 : return 0;
490 : : }
491 : :
492 : : int
493 : 0 : gve_rx_queue_stop_dqo(struct rte_eth_dev *dev, uint16_t rx_queue_id)
494 : : {
495 : : struct gve_rx_queue *rxq;
496 : :
497 [ # # ]: 0 : if (rx_queue_id >= dev->data->nb_rx_queues)
498 : : return -EINVAL;
499 : :
500 : 0 : rxq = dev->data->rx_queues[rx_queue_id];
501 : 0 : gve_release_rxq_mbufs_dqo(rxq);
502 : 0 : gve_reset_rx_ring_state_dqo(rxq);
503 : :
504 : 0 : dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
505 : :
506 : 0 : return 0;
507 : : }
508 : :
509 : : void
510 : 0 : gve_stop_rx_queues_dqo(struct rte_eth_dev *dev)
511 : : {
512 : 0 : struct gve_priv *hw = dev->data->dev_private;
513 : : uint16_t i;
514 : : int err;
515 : :
516 : 0 : err = gve_adminq_destroy_rx_queues(hw, dev->data->nb_rx_queues);
517 [ # # ]: 0 : if (err != 0)
518 : 0 : PMD_DRV_LOG(WARNING, "failed to destroy rxqs");
519 : :
520 [ # # ]: 0 : for (i = 0; i < dev->data->nb_rx_queues; i++)
521 [ # # ]: 0 : if (gve_rx_queue_stop_dqo(dev, i) != 0)
522 : 0 : PMD_DRV_LOG(WARNING, "Fail to stop Rx queue %d", i);
523 : 0 : }
524 : :
525 : : void
526 : 0 : gve_set_rx_function_dqo(struct rte_eth_dev *dev)
527 : : {
528 : 0 : dev->rx_pkt_burst = gve_rx_burst_dqo;
529 : 0 : }
|