1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright(c) 2018 Intel Corporation. */
4 #include <linux/bpf_trace.h>
5 #include <net/xdp_sock.h>
9 #include "i40e_txrx_common.h"
13 * i40e_xsk_umem_dma_map - DMA maps all UMEM memory for the netdev
15 * @umem: UMEM to DMA map
17 * Returns 0 on success, <0 on failure
19 static int i40e_xsk_umem_dma_map(struct i40e_vsi *vsi, struct xdp_umem *umem)
21 struct i40e_pf *pf = vsi->back;
27 for (i = 0; i < umem->npgs; i++) {
28 dma = dma_map_page_attrs(dev, umem->pgs[i], 0, PAGE_SIZE,
29 DMA_BIDIRECTIONAL, I40E_RX_DMA_ATTR);
30 if (dma_mapping_error(dev, dma))
33 umem->pages[i].dma = dma;
39 for (j = 0; j < i; j++) {
40 dma_unmap_page_attrs(dev, umem->pages[i].dma, PAGE_SIZE,
41 DMA_BIDIRECTIONAL, I40E_RX_DMA_ATTR);
42 umem->pages[i].dma = 0;
49 * i40e_xsk_umem_dma_unmap - DMA unmaps all UMEM memory for the netdev
51 * @umem: UMEM to DMA map
53 static void i40e_xsk_umem_dma_unmap(struct i40e_vsi *vsi, struct xdp_umem *umem)
55 struct i40e_pf *pf = vsi->back;
61 for (i = 0; i < umem->npgs; i++) {
62 dma_unmap_page_attrs(dev, umem->pages[i].dma, PAGE_SIZE,
63 DMA_BIDIRECTIONAL, I40E_RX_DMA_ATTR);
65 umem->pages[i].dma = 0;
70 * i40e_xsk_umem_enable - Enable/associate a UMEM to a certain ring/qid
73 * @qid: Rx ring to associate UMEM to
75 * Returns 0 on success, <0 on failure
77 static int i40e_xsk_umem_enable(struct i40e_vsi *vsi, struct xdp_umem *umem,
80 struct net_device *netdev = vsi->netdev;
81 struct xdp_umem_fq_reuse *reuseq;
85 if (vsi->type != I40E_VSI_MAIN)
88 if (qid >= vsi->num_queue_pairs)
91 if (qid >= netdev->real_num_rx_queues ||
92 qid >= netdev->real_num_tx_queues)
95 reuseq = xsk_reuseq_prepare(vsi->rx_rings[0]->count);
99 xsk_reuseq_free(xsk_reuseq_swap(umem, reuseq));
101 err = i40e_xsk_umem_dma_map(vsi, umem);
105 set_bit(qid, vsi->af_xdp_zc_qps);
107 if_running = netif_running(vsi->netdev) && i40e_enabled_xdp_vsi(vsi);
110 err = i40e_queue_pair_disable(vsi, qid);
114 err = i40e_queue_pair_enable(vsi, qid);
118 /* Kick start the NAPI context so that receiving will start */
119 err = i40e_xsk_wakeup(vsi->netdev, qid, XDP_WAKEUP_RX);
128 * i40e_xsk_umem_disable - Disassociate a UMEM from a certain ring/qid
130 * @qid: Rx ring to associate UMEM to
132 * Returns 0 on success, <0 on failure
134 static int i40e_xsk_umem_disable(struct i40e_vsi *vsi, u16 qid)
136 struct net_device *netdev = vsi->netdev;
137 struct xdp_umem *umem;
141 umem = xdp_get_umem_from_qid(netdev, qid);
145 if_running = netif_running(vsi->netdev) && i40e_enabled_xdp_vsi(vsi);
148 err = i40e_queue_pair_disable(vsi, qid);
153 clear_bit(qid, vsi->af_xdp_zc_qps);
154 i40e_xsk_umem_dma_unmap(vsi, umem);
157 err = i40e_queue_pair_enable(vsi, qid);
166 * i40e_xsk_umem_setup - Enable/disassociate a UMEM to/from a ring/qid
168 * @umem: UMEM to enable/associate to a ring, or NULL to disable
169 * @qid: Rx ring to (dis)associate UMEM (from)to
171 * This function enables or disables a UMEM to a certain ring.
173 * Returns 0 on success, <0 on failure
175 int i40e_xsk_umem_setup(struct i40e_vsi *vsi, struct xdp_umem *umem,
178 return umem ? i40e_xsk_umem_enable(vsi, umem, qid) :
179 i40e_xsk_umem_disable(vsi, qid);
183 * i40e_run_xdp_zc - Executes an XDP program on an xdp_buff
185 * @xdp: xdp_buff used as input to the XDP program
187 * This function enables or disables a UMEM to a certain ring.
189 * Returns any of I40E_XDP_{PASS, CONSUMED, TX, REDIR}
191 static int i40e_run_xdp_zc(struct i40e_ring *rx_ring, struct xdp_buff *xdp)
193 struct xdp_umem *umem = rx_ring->xsk_umem;
194 int err, result = I40E_XDP_PASS;
195 struct i40e_ring *xdp_ring;
196 struct bpf_prog *xdp_prog;
201 /* NB! xdp_prog will always be !NULL, due to the fact that
202 * this path is enabled by setting an XDP program.
204 xdp_prog = READ_ONCE(rx_ring->xdp_prog);
205 act = bpf_prog_run_xdp(xdp_prog, xdp);
206 offset = xdp->data - xdp->data_hard_start;
208 xdp->handle = xsk_umem_adjust_offset(umem, xdp->handle, offset);
214 xdp_ring = rx_ring->vsi->xdp_rings[rx_ring->queue_index];
215 result = i40e_xmit_xdp_tx_ring(xdp, xdp_ring);
218 err = xdp_do_redirect(rx_ring->netdev, xdp, xdp_prog);
219 result = !err ? I40E_XDP_REDIR : I40E_XDP_CONSUMED;
222 bpf_warn_invalid_xdp_action(act);
225 trace_xdp_exception(rx_ring->netdev, xdp_prog, act);
226 /* fallthrough -- handle aborts by dropping packet */
228 result = I40E_XDP_CONSUMED;
236 * i40e_alloc_buffer_zc - Allocates an i40e_rx_buffer
238 * @bi: Rx buffer to populate
240 * This function allocates an Rx buffer. The buffer can come from fill
241 * queue, or via the recycle queue (next_to_alloc).
243 * Returns true for a successful allocation, false otherwise
245 static bool i40e_alloc_buffer_zc(struct i40e_ring *rx_ring,
246 struct i40e_rx_buffer *bi)
248 struct xdp_umem *umem = rx_ring->xsk_umem;
249 void *addr = bi->addr;
253 rx_ring->rx_stats.page_reuse_count++;
257 if (!xsk_umem_peek_addr(umem, &handle)) {
258 rx_ring->rx_stats.alloc_page_failed++;
262 hr = umem->headroom + XDP_PACKET_HEADROOM;
264 bi->dma = xdp_umem_get_dma(umem, handle);
267 bi->addr = xdp_umem_get_data(umem, handle);
270 bi->handle = xsk_umem_adjust_offset(umem, handle, umem->headroom);
272 xsk_umem_discard_addr(umem);
277 * i40e_alloc_buffer_slow_zc - Allocates an i40e_rx_buffer
279 * @bi: Rx buffer to populate
281 * This function allocates an Rx buffer. The buffer can come from fill
282 * queue, or via the reuse queue.
284 * Returns true for a successful allocation, false otherwise
286 static bool i40e_alloc_buffer_slow_zc(struct i40e_ring *rx_ring,
287 struct i40e_rx_buffer *bi)
289 struct xdp_umem *umem = rx_ring->xsk_umem;
292 if (!xsk_umem_peek_addr_rq(umem, &handle)) {
293 rx_ring->rx_stats.alloc_page_failed++;
297 handle &= rx_ring->xsk_umem->chunk_mask;
299 hr = umem->headroom + XDP_PACKET_HEADROOM;
301 bi->dma = xdp_umem_get_dma(umem, handle);
304 bi->addr = xdp_umem_get_data(umem, handle);
307 bi->handle = xsk_umem_adjust_offset(umem, handle, umem->headroom);
309 xsk_umem_discard_addr_rq(umem);
313 static __always_inline bool
314 __i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count,
315 bool alloc(struct i40e_ring *rx_ring,
316 struct i40e_rx_buffer *bi))
318 u16 ntu = rx_ring->next_to_use;
319 union i40e_rx_desc *rx_desc;
320 struct i40e_rx_buffer *bi;
323 rx_desc = I40E_RX_DESC(rx_ring, ntu);
324 bi = &rx_ring->rx_bi[ntu];
326 if (!alloc(rx_ring, bi)) {
331 dma_sync_single_range_for_device(rx_ring->dev, bi->dma, 0,
335 rx_desc->read.pkt_addr = cpu_to_le64(bi->dma);
341 if (unlikely(ntu == rx_ring->count)) {
342 rx_desc = I40E_RX_DESC(rx_ring, 0);
347 rx_desc->wb.qword1.status_error_len = 0;
352 if (rx_ring->next_to_use != ntu)
353 i40e_release_rx_desc(rx_ring, ntu);
359 * i40e_alloc_rx_buffers_zc - Allocates a number of Rx buffers
361 * @count: The number of buffers to allocate
363 * This function allocates a number of Rx buffers from the reuse queue
364 * or fill ring and places them on the Rx ring.
366 * Returns true for a successful allocation, false otherwise
368 bool i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count)
370 return __i40e_alloc_rx_buffers_zc(rx_ring, count,
371 i40e_alloc_buffer_slow_zc);
375 * i40e_alloc_rx_buffers_fast_zc - Allocates a number of Rx buffers
377 * @count: The number of buffers to allocate
379 * This function allocates a number of Rx buffers from the fill ring
380 * or the internal recycle mechanism and places them on the Rx ring.
382 * Returns true for a successful allocation, false otherwise
384 static bool i40e_alloc_rx_buffers_fast_zc(struct i40e_ring *rx_ring, u16 count)
386 return __i40e_alloc_rx_buffers_zc(rx_ring, count,
387 i40e_alloc_buffer_zc);
391 * i40e_get_rx_buffer_zc - Return the current Rx buffer
393 * @size: The size of the rx buffer (read from descriptor)
395 * This function returns the current, received Rx buffer, and also
396 * does DMA synchronization. the Rx ring.
398 * Returns the received Rx buffer
400 static struct i40e_rx_buffer *i40e_get_rx_buffer_zc(struct i40e_ring *rx_ring,
401 const unsigned int size)
403 struct i40e_rx_buffer *bi;
405 bi = &rx_ring->rx_bi[rx_ring->next_to_clean];
407 /* we are reusing so sync this buffer for CPU use */
408 dma_sync_single_range_for_cpu(rx_ring->dev,
417 * i40e_reuse_rx_buffer_zc - Recycle an Rx buffer
419 * @old_bi: The Rx buffer to recycle
421 * This function recycles a finished Rx buffer, and places it on the
422 * recycle queue (next_to_alloc).
424 static void i40e_reuse_rx_buffer_zc(struct i40e_ring *rx_ring,
425 struct i40e_rx_buffer *old_bi)
427 struct i40e_rx_buffer *new_bi = &rx_ring->rx_bi[rx_ring->next_to_alloc];
428 u16 nta = rx_ring->next_to_alloc;
430 /* update, and store next to alloc */
432 rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0;
434 /* transfer page from old buffer to new buffer */
435 new_bi->dma = old_bi->dma;
436 new_bi->addr = old_bi->addr;
437 new_bi->handle = old_bi->handle;
443 * i40e_zca_free - Free callback for MEM_TYPE_ZERO_COPY allocations
444 * @alloc: Zero-copy allocator
445 * @handle: Buffer handle
447 void i40e_zca_free(struct zero_copy_allocator *alloc, unsigned long handle)
449 struct i40e_rx_buffer *bi;
450 struct i40e_ring *rx_ring;
454 rx_ring = container_of(alloc, struct i40e_ring, zca);
455 hr = rx_ring->xsk_umem->headroom + XDP_PACKET_HEADROOM;
456 mask = rx_ring->xsk_umem->chunk_mask;
458 nta = rx_ring->next_to_alloc;
459 bi = &rx_ring->rx_bi[nta];
462 rx_ring->next_to_alloc = (nta < rx_ring->count) ? nta : 0;
466 bi->dma = xdp_umem_get_dma(rx_ring->xsk_umem, handle);
469 bi->addr = xdp_umem_get_data(rx_ring->xsk_umem, handle);
472 bi->handle = xsk_umem_adjust_offset(rx_ring->xsk_umem, (u64)handle,
473 rx_ring->xsk_umem->headroom);
477 * i40e_construct_skb_zc - Create skbufff from zero-copy Rx buffer
482 * This functions allocates a new skb from a zero-copy Rx buffer.
484 * Returns the skb, or NULL on failure.
486 static struct sk_buff *i40e_construct_skb_zc(struct i40e_ring *rx_ring,
487 struct i40e_rx_buffer *bi,
488 struct xdp_buff *xdp)
490 unsigned int metasize = xdp->data - xdp->data_meta;
491 unsigned int datasize = xdp->data_end - xdp->data;
494 /* allocate a skb to store the frags */
495 skb = __napi_alloc_skb(&rx_ring->q_vector->napi,
496 xdp->data_end - xdp->data_hard_start,
497 GFP_ATOMIC | __GFP_NOWARN);
501 skb_reserve(skb, xdp->data - xdp->data_hard_start);
502 memcpy(__skb_put(skb, datasize), xdp->data, datasize);
504 skb_metadata_set(skb, metasize);
506 i40e_reuse_rx_buffer_zc(rx_ring, bi);
511 * i40e_inc_ntc: Advance the next_to_clean index
514 static void i40e_inc_ntc(struct i40e_ring *rx_ring)
516 u32 ntc = rx_ring->next_to_clean + 1;
518 ntc = (ntc < rx_ring->count) ? ntc : 0;
519 rx_ring->next_to_clean = ntc;
520 prefetch(I40E_RX_DESC(rx_ring, ntc));
524 * i40e_clean_rx_irq_zc - Consumes Rx packets from the hardware ring
526 * @budget: NAPI budget
528 * Returns amount of work completed
530 int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
532 unsigned int total_rx_bytes = 0, total_rx_packets = 0;
533 u16 cleaned_count = I40E_DESC_UNUSED(rx_ring);
534 unsigned int xdp_res, xdp_xmit = 0;
535 bool failure = false;
539 xdp.rxq = &rx_ring->xdp_rxq;
541 while (likely(total_rx_packets < (unsigned int)budget)) {
542 struct i40e_rx_buffer *bi;
543 union i40e_rx_desc *rx_desc;
547 if (cleaned_count >= I40E_RX_BUFFER_WRITE) {
549 !i40e_alloc_rx_buffers_fast_zc(rx_ring,
554 rx_desc = I40E_RX_DESC(rx_ring, rx_ring->next_to_clean);
555 qword = le64_to_cpu(rx_desc->wb.qword1.status_error_len);
557 /* This memory barrier is needed to keep us from reading
558 * any other fields out of the rx_desc until we have
559 * verified the descriptor has been written back.
563 bi = i40e_clean_programming_status(rx_ring, rx_desc,
566 i40e_reuse_rx_buffer_zc(rx_ring, bi);
571 size = (qword & I40E_RXD_QW1_LENGTH_PBUF_MASK) >>
572 I40E_RXD_QW1_LENGTH_PBUF_SHIFT;
576 bi = i40e_get_rx_buffer_zc(rx_ring, size);
578 xdp.data_meta = xdp.data;
579 xdp.data_hard_start = xdp.data - XDP_PACKET_HEADROOM;
580 xdp.data_end = xdp.data + size;
581 xdp.handle = bi->handle;
583 xdp_res = i40e_run_xdp_zc(rx_ring, &xdp);
585 if (xdp_res & (I40E_XDP_TX | I40E_XDP_REDIR)) {
589 i40e_reuse_rx_buffer_zc(rx_ring, bi);
592 total_rx_bytes += size;
596 i40e_inc_ntc(rx_ring);
602 /* NB! We are not checking for errors using
603 * i40e_test_staterr with
604 * BIT(I40E_RXD_QW1_ERROR_SHIFT). This is due to that
605 * SBP is *not* set in PRT_SBPVSI (default not set).
607 skb = i40e_construct_skb_zc(rx_ring, bi, &xdp);
609 rx_ring->rx_stats.alloc_buff_failed++;
614 i40e_inc_ntc(rx_ring);
616 if (eth_skb_pad(skb))
619 total_rx_bytes += skb->len;
622 i40e_process_skb_fields(rx_ring, rx_desc, skb);
623 napi_gro_receive(&rx_ring->q_vector->napi, skb);
626 i40e_finalize_xdp_rx(rx_ring, xdp_xmit);
627 i40e_update_rx_stats(rx_ring, total_rx_bytes, total_rx_packets);
629 if (xsk_umem_uses_need_wakeup(rx_ring->xsk_umem)) {
630 if (failure || rx_ring->next_to_clean == rx_ring->next_to_use)
631 xsk_set_rx_need_wakeup(rx_ring->xsk_umem);
633 xsk_clear_rx_need_wakeup(rx_ring->xsk_umem);
635 return (int)total_rx_packets;
637 return failure ? budget : (int)total_rx_packets;
641 * i40e_xmit_zc - Performs zero-copy Tx AF_XDP
642 * @xdp_ring: XDP Tx ring
643 * @budget: NAPI budget
645 * Returns true if the work is finished.
647 static bool i40e_xmit_zc(struct i40e_ring *xdp_ring, unsigned int budget)
649 struct i40e_tx_desc *tx_desc = NULL;
650 struct i40e_tx_buffer *tx_bi;
651 bool work_done = true;
652 struct xdp_desc desc;
655 while (budget-- > 0) {
656 if (!unlikely(I40E_DESC_UNUSED(xdp_ring))) {
657 xdp_ring->tx_stats.tx_busy++;
662 if (!xsk_umem_consume_tx(xdp_ring->xsk_umem, &desc))
665 dma = xdp_umem_get_dma(xdp_ring->xsk_umem, desc.addr);
667 dma_sync_single_for_device(xdp_ring->dev, dma, desc.len,
670 tx_bi = &xdp_ring->tx_bi[xdp_ring->next_to_use];
671 tx_bi->bytecount = desc.len;
673 tx_desc = I40E_TX_DESC(xdp_ring, xdp_ring->next_to_use);
674 tx_desc->buffer_addr = cpu_to_le64(dma);
675 tx_desc->cmd_type_offset_bsz =
676 build_ctob(I40E_TX_DESC_CMD_ICRC
677 | I40E_TX_DESC_CMD_EOP,
680 xdp_ring->next_to_use++;
681 if (xdp_ring->next_to_use == xdp_ring->count)
682 xdp_ring->next_to_use = 0;
686 /* Request an interrupt for the last frame and bump tail ptr. */
687 tx_desc->cmd_type_offset_bsz |= (I40E_TX_DESC_CMD_RS <<
688 I40E_TXD_QW1_CMD_SHIFT);
689 i40e_xdp_ring_update_tail(xdp_ring);
691 xsk_umem_consume_tx_done(xdp_ring->xsk_umem);
694 return !!budget && work_done;
698 * i40e_clean_xdp_tx_buffer - Frees and unmaps an XDP Tx entry
699 * @tx_ring: XDP Tx ring
700 * @tx_bi: Tx buffer info to clean
702 static void i40e_clean_xdp_tx_buffer(struct i40e_ring *tx_ring,
703 struct i40e_tx_buffer *tx_bi)
705 xdp_return_frame(tx_bi->xdpf);
706 dma_unmap_single(tx_ring->dev,
707 dma_unmap_addr(tx_bi, dma),
708 dma_unmap_len(tx_bi, len), DMA_TO_DEVICE);
709 dma_unmap_len_set(tx_bi, len, 0);
713 * i40e_clean_xdp_tx_irq - Completes AF_XDP entries, and cleans XDP entries
714 * @tx_ring: XDP Tx ring
715 * @tx_bi: Tx buffer info to clean
717 * Returns true if cleanup/tranmission is done.
719 bool i40e_clean_xdp_tx_irq(struct i40e_vsi *vsi,
720 struct i40e_ring *tx_ring, int napi_budget)
722 unsigned int ntc, total_bytes = 0, budget = vsi->work_limit;
723 u32 i, completed_frames, frames_ready, xsk_frames = 0;
724 struct xdp_umem *umem = tx_ring->xsk_umem;
725 u32 head_idx = i40e_get_head(tx_ring);
726 bool work_done = true, xmit_done;
727 struct i40e_tx_buffer *tx_bi;
729 if (head_idx < tx_ring->next_to_clean)
730 head_idx += tx_ring->count;
731 frames_ready = head_idx - tx_ring->next_to_clean;
733 if (frames_ready == 0) {
735 } else if (frames_ready > budget) {
736 completed_frames = budget;
739 completed_frames = frames_ready;
742 ntc = tx_ring->next_to_clean;
744 for (i = 0; i < completed_frames; i++) {
745 tx_bi = &tx_ring->tx_bi[ntc];
748 i40e_clean_xdp_tx_buffer(tx_ring, tx_bi);
753 total_bytes += tx_bi->bytecount;
755 if (++ntc >= tx_ring->count)
759 tx_ring->next_to_clean += completed_frames;
760 if (unlikely(tx_ring->next_to_clean >= tx_ring->count))
761 tx_ring->next_to_clean -= tx_ring->count;
764 xsk_umem_complete_tx(umem, xsk_frames);
766 i40e_arm_wb(tx_ring, vsi, budget);
767 i40e_update_tx_stats(tx_ring, completed_frames, total_bytes);
770 if (xsk_umem_uses_need_wakeup(tx_ring->xsk_umem))
771 xsk_set_tx_need_wakeup(tx_ring->xsk_umem);
773 xmit_done = i40e_xmit_zc(tx_ring, budget);
775 return work_done && xmit_done;
779 * i40e_xsk_wakeup - Implements the ndo_xsk_wakeup
780 * @dev: the netdevice
781 * @queue_id: queue id to wake up
782 * @flags: ignored in our case since we have Rx and Tx in the same NAPI.
784 * Returns <0 for errors, 0 otherwise.
786 int i40e_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags)
788 struct i40e_netdev_priv *np = netdev_priv(dev);
789 struct i40e_vsi *vsi = np->vsi;
790 struct i40e_ring *ring;
792 if (test_bit(__I40E_VSI_DOWN, vsi->state))
795 if (!i40e_enabled_xdp_vsi(vsi))
798 if (queue_id >= vsi->num_queue_pairs)
801 if (!vsi->xdp_rings[queue_id]->xsk_umem)
804 ring = vsi->xdp_rings[queue_id];
806 /* The idea here is that if NAPI is running, mark a miss, so
807 * it will run again. If not, trigger an interrupt and
808 * schedule the NAPI from interrupt context. If NAPI would be
809 * scheduled here, the interrupt affinity would not be
812 if (!napi_if_scheduled_mark_missed(&ring->q_vector->napi))
813 i40e_force_wb(vsi, ring->q_vector);
818 void i40e_xsk_clean_rx_ring(struct i40e_ring *rx_ring)
822 for (i = 0; i < rx_ring->count; i++) {
823 struct i40e_rx_buffer *rx_bi = &rx_ring->rx_bi[i];
828 xsk_umem_fq_reuse(rx_ring->xsk_umem, rx_bi->handle);
834 * i40e_xsk_clean_xdp_ring - Clean the XDP Tx ring on shutdown
835 * @xdp_ring: XDP Tx ring
837 void i40e_xsk_clean_tx_ring(struct i40e_ring *tx_ring)
839 u16 ntc = tx_ring->next_to_clean, ntu = tx_ring->next_to_use;
840 struct xdp_umem *umem = tx_ring->xsk_umem;
841 struct i40e_tx_buffer *tx_bi;
845 tx_bi = &tx_ring->tx_bi[ntc];
848 i40e_clean_xdp_tx_buffer(tx_ring, tx_bi);
855 if (ntc >= tx_ring->count)
860 xsk_umem_complete_tx(umem, xsk_frames);
864 * i40e_xsk_any_rx_ring_enabled - Checks if Rx rings have AF_XDP UMEM attached
867 * Returns true if any of the Rx rings has an AF_XDP UMEM attached
869 bool i40e_xsk_any_rx_ring_enabled(struct i40e_vsi *vsi)
871 struct net_device *netdev = vsi->netdev;
874 for (i = 0; i < vsi->num_queue_pairs; i++) {
875 if (xdp_get_umem_from_qid(netdev, i))