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 : :
257 : : static void
258 : 0 : gve_reset_rx_ring_state_dqo(struct gve_rx_queue *rxq)
259 : : {
260 : : struct rte_mbuf **sw_ring;
261 : : uint32_t size, i;
262 : :
263 [ # # ]: 0 : if (rxq == NULL) {
264 : 0 : PMD_DRV_LOG(ERR, "pointer to rxq is NULL");
265 : 0 : return;
266 : : }
267 : :
268 : 0 : size = rxq->nb_rx_desc * sizeof(struct gve_rx_desc_dqo);
269 [ # # ]: 0 : for (i = 0; i < size; i++)
270 : 0 : ((volatile char *)rxq->rx_ring)[i] = 0;
271 : :
272 : 0 : size = rxq->nb_rx_desc * sizeof(struct gve_rx_compl_desc_dqo);
273 [ # # ]: 0 : for (i = 0; i < size; i++)
274 : 0 : ((volatile char *)rxq->compl_ring)[i] = 0;
275 : :
276 : 0 : sw_ring = rxq->sw_ring;
277 [ # # ]: 0 : for (i = 0; i < rxq->nb_rx_desc; i++)
278 : 0 : sw_ring[i] = NULL;
279 : :
280 : : gve_completed_buf_list_init(rxq);
281 : :
282 : 0 : rxq->bufq_tail = 0;
283 : 0 : rxq->nb_rx_hold = rxq->nb_rx_desc - 1;
284 : :
285 : 0 : rxq->rx_tail = 0;
286 : 0 : rxq->cur_gen_bit = 1;
287 : : }
288 : :
289 : : int
290 : 0 : gve_rx_queue_setup_dqo(struct rte_eth_dev *dev, uint16_t queue_id,
291 : : uint16_t nb_desc, unsigned int socket_id,
292 : : const struct rte_eth_rxconf *conf,
293 : : struct rte_mempool *pool)
294 : : {
295 : 0 : struct gve_priv *hw = dev->data->dev_private;
296 : : const struct rte_memzone *mz;
297 : : struct gve_rx_queue *rxq;
298 : : uint16_t free_thresh;
299 : : uint32_t mbuf_len;
300 : : int err = 0;
301 : :
302 : : /* Free memory if needed */
303 [ # # ]: 0 : if (dev->data->rx_queues[queue_id]) {
304 : 0 : gve_rx_queue_release_dqo(dev, queue_id);
305 : 0 : dev->data->rx_queues[queue_id] = NULL;
306 : : }
307 : :
308 : : /* Allocate the RX queue data structure. */
309 : 0 : rxq = rte_zmalloc_socket("gve rxq",
310 : : sizeof(struct gve_rx_queue),
311 : : RTE_CACHE_LINE_SIZE,
312 : : socket_id);
313 [ # # ]: 0 : if (rxq == NULL) {
314 : 0 : PMD_DRV_LOG(ERR, "Failed to allocate memory for rx queue structure");
315 : 0 : return -ENOMEM;
316 : : }
317 : :
318 : : /* check free_thresh here */
319 [ # # ]: 0 : free_thresh = conf->rx_free_thresh ?
320 : : conf->rx_free_thresh : GVE_DEFAULT_RX_FREE_THRESH;
321 [ # # ]: 0 : if (free_thresh >= nb_desc) {
322 : 0 : PMD_DRV_LOG(ERR, "rx_free_thresh (%u) must be less than nb_desc (%u).",
323 : : free_thresh, rxq->nb_rx_desc);
324 : : err = -EINVAL;
325 : 0 : goto free_rxq;
326 : : }
327 : :
328 : 0 : rxq->nb_rx_desc = nb_desc;
329 : 0 : rxq->free_thresh = free_thresh;
330 : 0 : rxq->queue_id = queue_id;
331 : 0 : rxq->port_id = dev->data->port_id;
332 : 0 : rxq->ntfy_id = hw->num_ntfy_blks / 2 + queue_id;
333 : :
334 : 0 : rxq->mpool = pool;
335 : 0 : rxq->hw = hw;
336 [ # # # # ]: 0 : rxq->ntfy_addr = &hw->db_bar2[rte_be_to_cpu_32(hw->irq_dbs[rxq->ntfy_id].id)];
337 : :
338 : 0 : mbuf_len =
339 : 0 : rte_pktmbuf_data_room_size(rxq->mpool) - RTE_PKTMBUF_HEADROOM;
340 : 0 : rxq->rx_buf_len =
341 : 0 : RTE_MIN((uint16_t)GVE_RX_MAX_BUF_SIZE_DQO,
342 : : RTE_ALIGN_FLOOR(mbuf_len, GVE_RX_BUF_ALIGN_DQO));
343 : :
344 : : /* Allocate software ring */
345 : 0 : rxq->sw_ring = rte_zmalloc_socket("gve rx sw ring",
346 : : nb_desc * sizeof(struct rte_mbuf *),
347 : : RTE_CACHE_LINE_SIZE, socket_id);
348 [ # # ]: 0 : if (rxq->sw_ring == NULL) {
349 : 0 : PMD_DRV_LOG(ERR, "Failed to allocate memory for SW RX ring");
350 : : err = -ENOMEM;
351 : 0 : goto free_rxq;
352 : : }
353 : :
354 : : /* Allocate completed bufs list */
355 : 0 : rxq->completed_buf_list = rte_zmalloc_socket("gve completed buf list",
356 : : nb_desc * sizeof(*rxq->completed_buf_list), RTE_CACHE_LINE_SIZE,
357 : : socket_id);
358 [ # # ]: 0 : if (rxq->completed_buf_list == NULL) {
359 : 0 : PMD_DRV_LOG(ERR, "Failed to allocate completed buffer list.");
360 : : err = -ENOMEM;
361 : 0 : goto free_rxq_sw_ring;
362 : : }
363 : :
364 : : /* Allocate RX buffer queue */
365 : 0 : mz = rte_eth_dma_zone_reserve(dev, "rx_ring", queue_id,
366 : : nb_desc * sizeof(struct gve_rx_desc_dqo),
367 : : PAGE_SIZE, socket_id);
368 [ # # ]: 0 : if (mz == NULL) {
369 : 0 : PMD_DRV_LOG(ERR, "Failed to reserve DMA memory for RX buffer queue");
370 : : err = -ENOMEM;
371 : 0 : goto free_rxq_completed_buf_list;
372 : : }
373 : 0 : rxq->rx_ring = (struct gve_rx_desc_dqo *)mz->addr;
374 : 0 : rxq->rx_ring_phys_addr = mz->iova;
375 : 0 : rxq->mz = mz;
376 : :
377 : : /* Allocate RX completion queue */
378 : 0 : mz = rte_eth_dma_zone_reserve(dev, "compl_ring", queue_id,
379 : : nb_desc * sizeof(struct gve_rx_compl_desc_dqo),
380 : : PAGE_SIZE, socket_id);
381 [ # # ]: 0 : if (mz == NULL) {
382 : 0 : PMD_DRV_LOG(ERR, "Failed to reserve DMA memory for RX completion queue");
383 : : err = -ENOMEM;
384 : 0 : goto free_rxq_mz;
385 : : }
386 : : /* Zero all the descriptors in the ring */
387 : 0 : memset(mz->addr, 0, nb_desc * sizeof(struct gve_rx_compl_desc_dqo));
388 : 0 : rxq->compl_ring = (struct gve_rx_compl_desc_dqo *)mz->addr;
389 : 0 : rxq->compl_ring_phys_addr = mz->iova;
390 : 0 : rxq->compl_ring_mz = mz;
391 : :
392 : 0 : mz = rte_eth_dma_zone_reserve(dev, "rxq_res", queue_id,
393 : : sizeof(struct gve_queue_resources),
394 : : PAGE_SIZE, socket_id);
395 [ # # ]: 0 : if (mz == NULL) {
396 : 0 : PMD_DRV_LOG(ERR, "Failed to reserve DMA memory for RX resource");
397 : : err = -ENOMEM;
398 : 0 : goto free_rxq_cq_mz;
399 : : }
400 : 0 : rxq->qres = (struct gve_queue_resources *)mz->addr;
401 : 0 : rxq->qres_mz = mz;
402 : :
403 : 0 : gve_reset_rx_ring_state_dqo(rxq);
404 : :
405 : 0 : dev->data->rx_queues[queue_id] = rxq;
406 : :
407 : 0 : return 0;
408 : :
409 : : free_rxq_cq_mz:
410 : 0 : rte_memzone_free(rxq->compl_ring_mz);
411 : 0 : free_rxq_mz:
412 : 0 : rte_memzone_free(rxq->mz);
413 : 0 : free_rxq_completed_buf_list:
414 : 0 : rte_free(rxq->completed_buf_list);
415 : 0 : free_rxq_sw_ring:
416 : 0 : rte_free(rxq->sw_ring);
417 : 0 : free_rxq:
418 : 0 : rte_free(rxq);
419 : 0 : return err;
420 : : }
421 : :
422 : : static int
423 : 0 : gve_rxq_mbufs_alloc_dqo(struct gve_rx_queue *rxq)
424 : : {
425 : : struct rte_mbuf *nmb;
426 : : uint16_t rx_mask;
427 : : uint16_t i;
428 : : int diag;
429 : :
430 : 0 : rx_mask = rxq->nb_rx_desc - 1;
431 : 0 : diag = rte_pktmbuf_alloc_bulk(rxq->mpool, &rxq->sw_ring[0],
432 : : rx_mask);
433 [ # # ]: 0 : if (diag < 0) {
434 : 0 : rxq->stats.no_mbufs_bulk++;
435 [ # # ]: 0 : for (i = 0; i < rx_mask; i++) {
436 : 0 : nmb = rte_pktmbuf_alloc(rxq->mpool);
437 [ # # ]: 0 : if (!nmb) {
438 : 0 : rxq->stats.no_mbufs++;
439 : 0 : gve_release_rxq_mbufs_dqo(rxq);
440 : 0 : return -ENOMEM;
441 : : }
442 : 0 : rxq->sw_ring[i] = nmb;
443 : : }
444 : : }
445 : :
446 [ # # ]: 0 : for (i = 0; i < rx_mask; i++) {
447 : 0 : nmb = rxq->sw_ring[i];
448 : 0 : rxq->rx_ring[i].buf_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(nmb));
449 : 0 : rxq->rx_ring[i].buf_id = rte_cpu_to_le_16(i);
450 : : }
451 : 0 : rxq->rx_ring[rx_mask].buf_id = rte_cpu_to_le_16(rx_mask);
452 : :
453 : 0 : rxq->nb_rx_hold = 0;
454 : 0 : rxq->bufq_tail = rx_mask;
455 : :
456 : 0 : rte_write32(rxq->bufq_tail, rxq->qrx_tail);
457 : :
458 : 0 : return 0;
459 : : }
460 : :
461 : : int
462 : 0 : gve_rx_queue_start_dqo(struct rte_eth_dev *dev, uint16_t rx_queue_id)
463 : : {
464 : 0 : struct gve_priv *hw = dev->data->dev_private;
465 : : struct gve_rx_queue *rxq;
466 : : int ret;
467 : :
468 [ # # ]: 0 : if (rx_queue_id >= dev->data->nb_rx_queues)
469 : : return -EINVAL;
470 : :
471 : 0 : rxq = dev->data->rx_queues[rx_queue_id];
472 : :
473 [ # # ]: 0 : rxq->qrx_tail = &hw->db_bar2[rte_be_to_cpu_32(rxq->qres->db_index)];
474 : :
475 : : rte_write32(rte_cpu_to_le_32(GVE_NO_INT_MODE_DQO |
476 : : GVE_ITR_NO_UPDATE_DQO),
477 : 0 : rxq->ntfy_addr);
478 : :
479 : 0 : ret = gve_rxq_mbufs_alloc_dqo(rxq);
480 [ # # ]: 0 : if (ret != 0) {
481 : 0 : PMD_DRV_LOG(ERR, "Failed to alloc Rx queue mbuf");
482 : 0 : return ret;
483 : : }
484 : :
485 : 0 : dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED;
486 : :
487 : 0 : return 0;
488 : : }
489 : :
490 : : int
491 : 0 : gve_rx_queue_stop_dqo(struct rte_eth_dev *dev, uint16_t rx_queue_id)
492 : : {
493 : : struct gve_rx_queue *rxq;
494 : :
495 [ # # ]: 0 : if (rx_queue_id >= dev->data->nb_rx_queues)
496 : : return -EINVAL;
497 : :
498 : 0 : rxq = dev->data->rx_queues[rx_queue_id];
499 : 0 : gve_release_rxq_mbufs_dqo(rxq);
500 : 0 : gve_reset_rx_ring_state_dqo(rxq);
501 : :
502 : 0 : dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
503 : :
504 : 0 : return 0;
505 : : }
506 : :
507 : : void
508 : 0 : gve_stop_rx_queues_dqo(struct rte_eth_dev *dev)
509 : : {
510 : 0 : struct gve_priv *hw = dev->data->dev_private;
511 : : uint16_t i;
512 : : int err;
513 : :
514 : 0 : err = gve_adminq_destroy_rx_queues(hw, dev->data->nb_rx_queues);
515 [ # # ]: 0 : if (err != 0)
516 : 0 : PMD_DRV_LOG(WARNING, "failed to destroy rxqs");
517 : :
518 [ # # ]: 0 : for (i = 0; i < dev->data->nb_rx_queues; i++)
519 [ # # ]: 0 : if (gve_rx_queue_stop_dqo(dev, i) != 0)
520 : 0 : PMD_DRV_LOG(WARNING, "Fail to stop Rx queue %d", i);
521 : 0 : }
522 : :
523 : : void
524 : 0 : gve_set_rx_function_dqo(struct rte_eth_dev *dev)
525 : : {
526 : 0 : dev->rx_pkt_burst = gve_rx_burst_dqo;
527 : 0 : }
|