1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Intel Corporation.
9 #include <netinet/in.h>
11 #include <sys/socket.h>
12 #include <sys/ioctl.h>
13 #include <linux/if_ether.h>
14 #include <linux/if_xdp.h>
15 #include <linux/if_link.h>
16 #include <linux/ethtool.h>
17 #include <linux/sockios.h>
18 #include "af_xdp_deps.h"
21 #include <rte_ethdev.h>
22 #include <rte_ethdev_driver.h>
23 #include <rte_ethdev_vdev.h>
24 #include <rte_kvargs.h>
25 #include <rte_bus_vdev.h>
26 #include <rte_string_fns.h>
27 #include <rte_branch_prediction.h>
28 #include <rte_common.h>
31 #include <rte_ether.h>
32 #include <rte_lcore.h>
34 #include <rte_memory.h>
35 #include <rte_memzone.h>
36 #include <rte_mempool.h>
38 #include <rte_malloc.h>
40 #include <rte_spinlock.h>
57 RTE_LOG_REGISTER(af_xdp_logtype, pmd.net.af_xdp, NOTICE);
59 #define AF_XDP_LOG(level, fmt, args...) \
60 rte_log(RTE_LOG_ ## level, af_xdp_logtype, \
61 "%s(): " fmt, __func__, ##args)
63 #define ETH_AF_XDP_FRAME_SIZE 2048
64 #define ETH_AF_XDP_NUM_BUFFERS 4096
65 #define ETH_AF_XDP_DFLT_NUM_DESCS XSK_RING_CONS__DEFAULT_NUM_DESCS
66 #define ETH_AF_XDP_DFLT_START_QUEUE_IDX 0
67 #define ETH_AF_XDP_DFLT_QUEUE_COUNT 1
69 #define ETH_AF_XDP_RX_BATCH_SIZE 32
70 #define ETH_AF_XDP_TX_BATCH_SIZE 32
73 struct xsk_umem_info {
74 struct xsk_umem *umem;
75 struct rte_ring *buf_ring;
76 const struct rte_memzone *mz;
77 struct rte_mempool *mb_pool;
90 struct xsk_ring_cons rx;
91 struct xsk_umem_info *umem;
92 struct xsk_socket *xsk;
93 struct rte_mempool *mb_pool;
95 struct rx_stats stats;
97 struct xsk_ring_prod fq;
98 struct xsk_ring_cons cq;
100 struct pkt_tx_queue *pair;
101 struct pollfd fds[1];
111 struct pkt_tx_queue {
112 struct xsk_ring_prod tx;
113 struct xsk_umem_info *umem;
115 struct tx_stats stats;
117 struct pkt_rx_queue *pair;
121 struct pmd_internals {
123 char if_name[IFNAMSIZ];
127 int combined_queue_cnt;
129 char prog_path[PATH_MAX];
130 bool custom_prog_configured;
132 struct rte_ether_addr eth_addr;
134 struct pkt_rx_queue *rx_queues;
135 struct pkt_tx_queue *tx_queues;
138 #define ETH_AF_XDP_IFACE_ARG "iface"
139 #define ETH_AF_XDP_START_QUEUE_ARG "start_queue"
140 #define ETH_AF_XDP_QUEUE_COUNT_ARG "queue_count"
141 #define ETH_AF_XDP_SHARED_UMEM_ARG "shared_umem"
142 #define ETH_AF_XDP_PROG_ARG "xdp_prog"
144 static const char * const valid_arguments[] = {
145 ETH_AF_XDP_IFACE_ARG,
146 ETH_AF_XDP_START_QUEUE_ARG,
147 ETH_AF_XDP_QUEUE_COUNT_ARG,
148 ETH_AF_XDP_SHARED_UMEM_ARG,
153 static const struct rte_eth_link pmd_link = {
154 .link_speed = ETH_SPEED_NUM_10G,
155 .link_duplex = ETH_LINK_FULL_DUPLEX,
156 .link_status = ETH_LINK_DOWN,
157 .link_autoneg = ETH_LINK_AUTONEG
160 /* List which tracks PMDs to facilitate sharing UMEMs across them. */
161 struct internal_list {
162 TAILQ_ENTRY(internal_list) next;
163 struct rte_eth_dev *eth_dev;
166 TAILQ_HEAD(internal_list_head, internal_list);
167 static struct internal_list_head internal_list =
168 TAILQ_HEAD_INITIALIZER(internal_list);
170 static pthread_mutex_t internal_list_lock = PTHREAD_MUTEX_INITIALIZER;
172 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
174 reserve_fill_queue_zc(struct xsk_umem_info *umem, uint16_t reserve_size,
175 struct rte_mbuf **bufs, struct xsk_ring_prod *fq)
180 if (unlikely(!xsk_ring_prod__reserve(fq, reserve_size, &idx))) {
181 for (i = 0; i < reserve_size; i++)
182 rte_pktmbuf_free(bufs[i]);
183 AF_XDP_LOG(DEBUG, "Failed to reserve enough fq descs.\n");
187 for (i = 0; i < reserve_size; i++) {
191 fq_addr = xsk_ring_prod__fill_addr(fq, idx++);
192 addr = (uint64_t)bufs[i] - (uint64_t)umem->buffer -
193 umem->mb_pool->header_size;
197 xsk_ring_prod__submit(fq, reserve_size);
203 reserve_fill_queue_cp(struct xsk_umem_info *umem, uint16_t reserve_size,
204 struct rte_mbuf **bufs __rte_unused,
205 struct xsk_ring_prod *fq)
207 void *addrs[reserve_size];
211 if (rte_ring_dequeue_bulk(umem->buf_ring, addrs, reserve_size, NULL)
213 AF_XDP_LOG(DEBUG, "Failed to get enough buffers for fq.\n");
217 if (unlikely(!xsk_ring_prod__reserve(fq, reserve_size, &idx))) {
218 AF_XDP_LOG(DEBUG, "Failed to reserve enough fq descs.\n");
219 rte_ring_enqueue_bulk(umem->buf_ring, addrs,
224 for (i = 0; i < reserve_size; i++) {
227 fq_addr = xsk_ring_prod__fill_addr(fq, idx++);
228 *fq_addr = (uint64_t)addrs[i];
231 xsk_ring_prod__submit(fq, reserve_size);
238 reserve_fill_queue(struct xsk_umem_info *umem, uint16_t reserve_size,
239 struct rte_mbuf **bufs, struct xsk_ring_prod *fq)
241 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
242 return reserve_fill_queue_zc(umem, reserve_size, bufs, fq);
244 return reserve_fill_queue_cp(umem, reserve_size, bufs, fq);
248 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
250 af_xdp_rx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
252 struct pkt_rx_queue *rxq = queue;
253 struct xsk_ring_cons *rx = &rxq->rx;
254 struct xsk_ring_prod *fq = &rxq->fq;
255 struct xsk_umem_info *umem = rxq->umem;
257 unsigned long rx_bytes = 0;
259 struct rte_mbuf *fq_bufs[ETH_AF_XDP_RX_BATCH_SIZE];
261 /* allocate bufs for fill queue replenishment after rx */
262 if (rte_pktmbuf_alloc_bulk(umem->mb_pool, fq_bufs, nb_pkts)) {
264 "Failed to get enough buffers for fq.\n");
268 rcvd = xsk_ring_cons__peek(rx, nb_pkts, &idx_rx);
271 #if defined(XDP_USE_NEED_WAKEUP)
272 if (xsk_ring_prod__needs_wakeup(fq))
273 (void)poll(rxq->fds, 1, 1000);
279 for (i = 0; i < rcvd; i++) {
280 const struct xdp_desc *desc;
285 desc = xsk_ring_cons__rx_desc(rx, idx_rx++);
289 offset = xsk_umem__extract_offset(addr);
290 addr = xsk_umem__extract_addr(addr);
292 bufs[i] = (struct rte_mbuf *)
293 xsk_umem__get_data(umem->buffer, addr +
294 umem->mb_pool->header_size);
295 bufs[i]->data_off = offset - sizeof(struct rte_mbuf) -
296 rte_pktmbuf_priv_size(umem->mb_pool) -
297 umem->mb_pool->header_size;
299 rte_pktmbuf_pkt_len(bufs[i]) = len;
300 rte_pktmbuf_data_len(bufs[i]) = len;
304 xsk_ring_cons__release(rx, rcvd);
306 (void)reserve_fill_queue(umem, rcvd, fq_bufs, fq);
309 rxq->stats.rx_pkts += rcvd;
310 rxq->stats.rx_bytes += rx_bytes;
314 rte_mempool_put_bulk(umem->mb_pool, (void **)&fq_bufs[rcvd],
321 af_xdp_rx_cp(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
323 struct pkt_rx_queue *rxq = queue;
324 struct xsk_ring_cons *rx = &rxq->rx;
325 struct xsk_umem_info *umem = rxq->umem;
326 struct xsk_ring_prod *fq = &rxq->fq;
328 unsigned long rx_bytes = 0;
330 uint32_t free_thresh = fq->size >> 1;
331 struct rte_mbuf *mbufs[ETH_AF_XDP_RX_BATCH_SIZE];
333 if (xsk_prod_nb_free(fq, free_thresh) >= free_thresh)
334 (void)reserve_fill_queue(umem, ETH_AF_XDP_RX_BATCH_SIZE,
337 if (unlikely(rte_pktmbuf_alloc_bulk(rxq->mb_pool, mbufs, nb_pkts) != 0))
340 rcvd = xsk_ring_cons__peek(rx, nb_pkts, &idx_rx);
342 #if defined(XDP_USE_NEED_WAKEUP)
343 if (xsk_ring_prod__needs_wakeup(fq))
344 (void)poll(rxq->fds, 1, 1000);
350 for (i = 0; i < rcvd; i++) {
351 const struct xdp_desc *desc;
356 desc = xsk_ring_cons__rx_desc(rx, idx_rx++);
359 pkt = xsk_umem__get_data(rxq->umem->mz->addr, addr);
361 rte_memcpy(rte_pktmbuf_mtod(mbufs[i], void *), pkt, len);
362 rte_ring_enqueue(umem->buf_ring, (void *)addr);
363 rte_pktmbuf_pkt_len(mbufs[i]) = len;
364 rte_pktmbuf_data_len(mbufs[i]) = len;
369 xsk_ring_cons__release(rx, rcvd);
372 rxq->stats.rx_pkts += rcvd;
373 rxq->stats.rx_bytes += rx_bytes;
377 rte_mempool_put_bulk(rxq->mb_pool, (void **)&mbufs[rcvd],
385 eth_af_xdp_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
387 nb_pkts = RTE_MIN(nb_pkts, ETH_AF_XDP_RX_BATCH_SIZE);
389 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
390 return af_xdp_rx_zc(queue, bufs, nb_pkts);
392 return af_xdp_rx_cp(queue, bufs, nb_pkts);
397 pull_umem_cq(struct xsk_umem_info *umem, int size, struct xsk_ring_cons *cq)
402 n = xsk_ring_cons__peek(cq, size, &idx_cq);
404 for (i = 0; i < n; i++) {
406 addr = *xsk_ring_cons__comp_addr(cq, idx_cq++);
407 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
408 addr = xsk_umem__extract_addr(addr);
409 rte_pktmbuf_free((struct rte_mbuf *)
410 xsk_umem__get_data(umem->buffer,
411 addr + umem->mb_pool->header_size));
413 rte_ring_enqueue(umem->buf_ring, (void *)addr);
417 xsk_ring_cons__release(cq, n);
421 kick_tx(struct pkt_tx_queue *txq, struct xsk_ring_cons *cq)
423 struct xsk_umem_info *umem = txq->umem;
425 pull_umem_cq(umem, XSK_RING_CONS__DEFAULT_NUM_DESCS, cq);
427 #if defined(XDP_USE_NEED_WAKEUP)
428 if (xsk_ring_prod__needs_wakeup(&txq->tx))
430 while (send(xsk_socket__fd(txq->pair->xsk), NULL,
431 0, MSG_DONTWAIT) < 0) {
432 /* some thing unexpected */
433 if (errno != EBUSY && errno != EAGAIN && errno != EINTR)
436 /* pull from completion queue to leave more space */
439 XSK_RING_CONS__DEFAULT_NUM_DESCS,
444 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
446 af_xdp_tx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
448 struct pkt_tx_queue *txq = queue;
449 struct xsk_umem_info *umem = txq->umem;
450 struct rte_mbuf *mbuf;
451 unsigned long tx_bytes = 0;
455 struct xdp_desc *desc;
456 uint64_t addr, offset;
457 struct xsk_ring_cons *cq = &txq->pair->cq;
458 uint32_t free_thresh = cq->size >> 1;
460 if (xsk_cons_nb_avail(cq, free_thresh) >= free_thresh)
461 pull_umem_cq(umem, XSK_RING_CONS__DEFAULT_NUM_DESCS, cq);
463 for (i = 0; i < nb_pkts; i++) {
466 if (mbuf->pool == umem->mb_pool) {
467 if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) {
469 if (!xsk_ring_prod__reserve(&txq->tx, 1,
473 desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx);
474 desc->len = mbuf->pkt_len;
475 addr = (uint64_t)mbuf - (uint64_t)umem->buffer -
476 umem->mb_pool->header_size;
477 offset = rte_pktmbuf_mtod(mbuf, uint64_t) -
479 umem->mb_pool->header_size;
480 offset = offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT;
481 desc->addr = addr | offset;
484 struct rte_mbuf *local_mbuf =
485 rte_pktmbuf_alloc(umem->mb_pool);
488 if (local_mbuf == NULL)
491 if (!xsk_ring_prod__reserve(&txq->tx, 1, &idx_tx)) {
492 rte_pktmbuf_free(local_mbuf);
497 desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx);
498 desc->len = mbuf->pkt_len;
500 addr = (uint64_t)local_mbuf - (uint64_t)umem->buffer -
501 umem->mb_pool->header_size;
502 offset = rte_pktmbuf_mtod(local_mbuf, uint64_t) -
503 (uint64_t)local_mbuf +
504 umem->mb_pool->header_size;
505 pkt = xsk_umem__get_data(umem->buffer, addr + offset);
506 offset = offset << XSK_UNALIGNED_BUF_OFFSET_SHIFT;
507 desc->addr = addr | offset;
508 rte_memcpy(pkt, rte_pktmbuf_mtod(mbuf, void *),
510 rte_pktmbuf_free(mbuf);
514 tx_bytes += mbuf->pkt_len;
520 xsk_ring_prod__submit(&txq->tx, count);
522 txq->stats.tx_pkts += count;
523 txq->stats.tx_bytes += tx_bytes;
524 txq->stats.tx_dropped += nb_pkts - count;
530 af_xdp_tx_cp(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
532 struct pkt_tx_queue *txq = queue;
533 struct xsk_umem_info *umem = txq->umem;
534 struct rte_mbuf *mbuf;
535 void *addrs[ETH_AF_XDP_TX_BATCH_SIZE];
536 unsigned long tx_bytes = 0;
539 struct xsk_ring_cons *cq = &txq->pair->cq;
541 nb_pkts = RTE_MIN(nb_pkts, ETH_AF_XDP_TX_BATCH_SIZE);
543 pull_umem_cq(umem, nb_pkts, cq);
545 nb_pkts = rte_ring_dequeue_bulk(umem->buf_ring, addrs,
550 if (xsk_ring_prod__reserve(&txq->tx, nb_pkts, &idx_tx) != nb_pkts) {
552 rte_ring_enqueue_bulk(umem->buf_ring, addrs, nb_pkts, NULL);
556 for (i = 0; i < nb_pkts; i++) {
557 struct xdp_desc *desc;
560 desc = xsk_ring_prod__tx_desc(&txq->tx, idx_tx + i);
562 desc->len = mbuf->pkt_len;
564 desc->addr = (uint64_t)addrs[i];
565 pkt = xsk_umem__get_data(umem->mz->addr,
567 rte_memcpy(pkt, rte_pktmbuf_mtod(mbuf, void *), desc->len);
568 tx_bytes += mbuf->pkt_len;
569 rte_pktmbuf_free(mbuf);
572 xsk_ring_prod__submit(&txq->tx, nb_pkts);
576 txq->stats.tx_pkts += nb_pkts;
577 txq->stats.tx_bytes += tx_bytes;
584 eth_af_xdp_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
586 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
587 return af_xdp_tx_zc(queue, bufs, nb_pkts);
589 return af_xdp_tx_cp(queue, bufs, nb_pkts);
594 eth_dev_start(struct rte_eth_dev *dev)
596 dev->data->dev_link.link_status = ETH_LINK_UP;
601 /* This function gets called when the current port gets stopped. */
603 eth_dev_stop(struct rte_eth_dev *dev)
605 dev->data->dev_link.link_status = ETH_LINK_DOWN;
608 /* Find ethdev in list */
609 static inline struct internal_list *
610 find_internal_resource(struct pmd_internals *port_int)
613 struct internal_list *list = NULL;
615 if (port_int == NULL)
618 pthread_mutex_lock(&internal_list_lock);
620 TAILQ_FOREACH(list, &internal_list, next) {
621 struct pmd_internals *list_int =
622 list->eth_dev->data->dev_private;
623 if (list_int == port_int) {
629 pthread_mutex_unlock(&internal_list_lock);
637 /* Check if the netdev,qid context already exists */
639 ctx_exists(struct pkt_rx_queue *rxq, const char *ifname,
640 struct pkt_rx_queue *list_rxq, const char *list_ifname)
644 if (rxq->xsk_queue_idx == list_rxq->xsk_queue_idx &&
645 !strncmp(ifname, list_ifname, IFNAMSIZ)) {
646 AF_XDP_LOG(ERR, "ctx %s,%i already exists, cannot share umem\n",
647 ifname, rxq->xsk_queue_idx);
654 /* Get a pointer to an existing UMEM which overlays the rxq's mb_pool */
656 get_shared_umem(struct pkt_rx_queue *rxq, const char *ifname,
657 struct xsk_umem_info **umem)
659 struct internal_list *list;
660 struct pmd_internals *internals;
662 struct rte_mempool *mb_pool = rxq->mb_pool;
667 pthread_mutex_lock(&internal_list_lock);
669 TAILQ_FOREACH(list, &internal_list, next) {
670 internals = list->eth_dev->data->dev_private;
671 for (i = 0; i < internals->queue_cnt; i++) {
672 struct pkt_rx_queue *list_rxq =
673 &internals->rx_queues[i];
676 if (mb_pool == internals->rx_queues[i].mb_pool) {
677 if (ctx_exists(rxq, ifname, list_rxq,
678 internals->if_name)) {
683 &internals->rx_queues[i].umem->refcnt,
685 *umem = internals->rx_queues[i].umem;
693 pthread_mutex_unlock(&internal_list_lock);
699 eth_dev_configure(struct rte_eth_dev *dev)
701 struct pmd_internals *internal = dev->data->dev_private;
703 /* rx/tx must be paired */
704 if (dev->data->nb_rx_queues != dev->data->nb_tx_queues)
707 if (internal->shared_umem) {
708 struct internal_list *list = NULL;
709 const char *name = dev->device->name;
711 /* Ensure PMD is not already inserted into the list */
712 list = find_internal_resource(internal);
716 list = rte_zmalloc_socket(name, sizeof(*list), 0,
717 dev->device->numa_node);
722 pthread_mutex_lock(&internal_list_lock);
723 TAILQ_INSERT_TAIL(&internal_list, list, next);
724 pthread_mutex_unlock(&internal_list_lock);
731 eth_dev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
733 struct pmd_internals *internals = dev->data->dev_private;
735 dev_info->if_index = internals->if_index;
736 dev_info->max_mac_addrs = 1;
737 dev_info->max_rx_pktlen = ETH_FRAME_LEN;
738 dev_info->max_rx_queues = internals->queue_cnt;
739 dev_info->max_tx_queues = internals->queue_cnt;
741 dev_info->min_mtu = RTE_ETHER_MIN_MTU;
742 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
743 dev_info->max_mtu = getpagesize() -
744 sizeof(struct rte_mempool_objhdr) -
745 sizeof(struct rte_mbuf) -
746 RTE_PKTMBUF_HEADROOM - XDP_PACKET_HEADROOM;
748 dev_info->max_mtu = ETH_AF_XDP_FRAME_SIZE - XDP_PACKET_HEADROOM;
751 dev_info->default_rxportconf.nb_queues = 1;
752 dev_info->default_txportconf.nb_queues = 1;
753 dev_info->default_rxportconf.ring_size = ETH_AF_XDP_DFLT_NUM_DESCS;
754 dev_info->default_txportconf.ring_size = ETH_AF_XDP_DFLT_NUM_DESCS;
760 eth_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
762 struct pmd_internals *internals = dev->data->dev_private;
763 struct xdp_statistics xdp_stats;
764 struct pkt_rx_queue *rxq;
765 struct pkt_tx_queue *txq;
769 for (i = 0; i < dev->data->nb_rx_queues; i++) {
770 optlen = sizeof(struct xdp_statistics);
771 rxq = &internals->rx_queues[i];
773 stats->q_ipackets[i] = rxq->stats.rx_pkts;
774 stats->q_ibytes[i] = rxq->stats.rx_bytes;
776 stats->q_opackets[i] = txq->stats.tx_pkts;
777 stats->q_obytes[i] = txq->stats.tx_bytes;
779 stats->ipackets += stats->q_ipackets[i];
780 stats->ibytes += stats->q_ibytes[i];
781 stats->imissed += rxq->stats.rx_dropped;
782 stats->oerrors += txq->stats.tx_dropped;
783 ret = getsockopt(xsk_socket__fd(rxq->xsk), SOL_XDP,
784 XDP_STATISTICS, &xdp_stats, &optlen);
786 AF_XDP_LOG(ERR, "getsockopt() failed for XDP_STATISTICS.\n");
789 stats->imissed += xdp_stats.rx_dropped;
791 stats->opackets += stats->q_opackets[i];
792 stats->obytes += stats->q_obytes[i];
799 eth_stats_reset(struct rte_eth_dev *dev)
801 struct pmd_internals *internals = dev->data->dev_private;
804 for (i = 0; i < internals->queue_cnt; i++) {
805 memset(&internals->rx_queues[i].stats, 0,
806 sizeof(struct rx_stats));
807 memset(&internals->tx_queues[i].stats, 0,
808 sizeof(struct tx_stats));
815 remove_xdp_program(struct pmd_internals *internals)
817 uint32_t curr_prog_id = 0;
819 if (bpf_get_link_xdp_id(internals->if_index, &curr_prog_id,
820 XDP_FLAGS_UPDATE_IF_NOEXIST)) {
821 AF_XDP_LOG(ERR, "bpf_get_link_xdp_id failed\n");
824 bpf_set_link_xdp_fd(internals->if_index, -1,
825 XDP_FLAGS_UPDATE_IF_NOEXIST);
829 xdp_umem_destroy(struct xsk_umem_info *umem)
831 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
832 umem->mb_pool = NULL;
834 rte_memzone_free(umem->mz);
837 rte_ring_free(umem->buf_ring);
838 umem->buf_ring = NULL;
846 eth_dev_close(struct rte_eth_dev *dev)
848 struct pmd_internals *internals = dev->data->dev_private;
849 struct pkt_rx_queue *rxq;
852 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
855 AF_XDP_LOG(INFO, "Closing AF_XDP ethdev on numa socket %u\n",
858 for (i = 0; i < internals->queue_cnt; i++) {
859 rxq = &internals->rx_queues[i];
860 if (rxq->umem == NULL)
862 xsk_socket__delete(rxq->xsk);
864 if (__atomic_sub_fetch(&rxq->umem->refcnt, 1, __ATOMIC_ACQUIRE)
866 (void)xsk_umem__delete(rxq->umem->umem);
867 xdp_umem_destroy(rxq->umem);
870 /* free pkt_tx_queue */
876 * MAC is not allocated dynamically, setting it to NULL would prevent
877 * from releasing it in rte_eth_dev_release_port.
879 dev->data->mac_addrs = NULL;
881 remove_xdp_program(internals);
883 if (internals->shared_umem) {
884 struct internal_list *list;
886 /* Remove ethdev from list used to track and share UMEMs */
887 list = find_internal_resource(internals);
889 pthread_mutex_lock(&internal_list_lock);
890 TAILQ_REMOVE(&internal_list, list, next);
891 pthread_mutex_unlock(&internal_list_lock);
900 eth_queue_release(void *q __rte_unused)
905 eth_link_update(struct rte_eth_dev *dev __rte_unused,
906 int wait_to_complete __rte_unused)
911 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
912 static inline uint64_t get_base_addr(struct rte_mempool *mp, uint64_t *align)
914 struct rte_mempool_memhdr *memhdr;
915 uint64_t memhdr_addr, aligned_addr;
917 memhdr = STAILQ_FIRST(&mp->mem_list);
918 memhdr_addr = (uint64_t)memhdr->addr;
919 aligned_addr = memhdr_addr & ~(getpagesize() - 1);
920 *align = memhdr_addr - aligned_addr;
926 xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
927 struct pkt_rx_queue *rxq)
929 struct xsk_umem_info *umem = NULL;
931 struct xsk_umem_config usr_config = {
932 .fill_size = ETH_AF_XDP_DFLT_NUM_DESCS * 2,
933 .comp_size = ETH_AF_XDP_DFLT_NUM_DESCS,
934 .flags = XDP_UMEM_UNALIGNED_CHUNK_FLAG};
935 void *base_addr = NULL;
936 struct rte_mempool *mb_pool = rxq->mb_pool;
937 uint64_t umem_size, align = 0;
939 if (internals->shared_umem) {
940 if (get_shared_umem(rxq, internals->if_name, &umem) < 0)
944 __atomic_load_n(&umem->refcnt, __ATOMIC_ACQUIRE) <
946 AF_XDP_LOG(INFO, "%s,qid%i sharing UMEM\n",
947 internals->if_name, rxq->xsk_queue_idx);
948 __atomic_fetch_add(&umem->refcnt, 1, __ATOMIC_ACQUIRE);
953 usr_config.frame_size =
954 rte_mempool_calc_obj_size(mb_pool->elt_size,
955 mb_pool->flags, NULL);
956 usr_config.frame_headroom = mb_pool->header_size +
957 sizeof(struct rte_mbuf) +
958 rte_pktmbuf_priv_size(mb_pool) +
959 RTE_PKTMBUF_HEADROOM;
961 umem = rte_zmalloc_socket("umem", sizeof(*umem), 0,
964 AF_XDP_LOG(ERR, "Failed to allocate umem info");
968 umem->mb_pool = mb_pool;
969 base_addr = (void *)get_base_addr(mb_pool, &align);
970 umem_size = mb_pool->populated_size * usr_config.frame_size +
973 ret = xsk_umem__create(&umem->umem, base_addr, umem_size,
974 &rxq->fq, &rxq->cq, &usr_config);
976 AF_XDP_LOG(ERR, "Failed to create umem");
979 umem->buffer = base_addr;
981 if (internals->shared_umem) {
982 umem->max_xsks = mb_pool->populated_size /
983 ETH_AF_XDP_NUM_BUFFERS;
984 AF_XDP_LOG(INFO, "Max xsks for UMEM %s: %u\n",
985 mb_pool->name, umem->max_xsks);
988 __atomic_store_n(&umem->refcnt, 1, __ATOMIC_RELEASE);
993 xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
994 struct pkt_rx_queue *rxq)
996 struct xsk_umem_info *umem;
997 const struct rte_memzone *mz;
998 struct xsk_umem_config usr_config = {
999 .fill_size = ETH_AF_XDP_DFLT_NUM_DESCS,
1000 .comp_size = ETH_AF_XDP_DFLT_NUM_DESCS,
1001 .frame_size = ETH_AF_XDP_FRAME_SIZE,
1002 .frame_headroom = 0 };
1003 char ring_name[RTE_RING_NAMESIZE];
1004 char mz_name[RTE_MEMZONE_NAMESIZE];
1008 umem = rte_zmalloc_socket("umem", sizeof(*umem), 0, rte_socket_id());
1010 AF_XDP_LOG(ERR, "Failed to allocate umem info");
1014 snprintf(ring_name, sizeof(ring_name), "af_xdp_ring_%s_%u",
1015 internals->if_name, rxq->xsk_queue_idx);
1016 umem->buf_ring = rte_ring_create(ring_name,
1017 ETH_AF_XDP_NUM_BUFFERS,
1020 if (umem->buf_ring == NULL) {
1021 AF_XDP_LOG(ERR, "Failed to create rte_ring\n");
1025 for (i = 0; i < ETH_AF_XDP_NUM_BUFFERS; i++)
1026 rte_ring_enqueue(umem->buf_ring,
1027 (void *)(i * ETH_AF_XDP_FRAME_SIZE));
1029 snprintf(mz_name, sizeof(mz_name), "af_xdp_umem_%s_%u",
1030 internals->if_name, rxq->xsk_queue_idx);
1031 mz = rte_memzone_reserve_aligned(mz_name,
1032 ETH_AF_XDP_NUM_BUFFERS * ETH_AF_XDP_FRAME_SIZE,
1033 rte_socket_id(), RTE_MEMZONE_IOVA_CONTIG,
1036 AF_XDP_LOG(ERR, "Failed to reserve memzone for af_xdp umem.\n");
1040 ret = xsk_umem__create(&umem->umem, mz->addr,
1041 ETH_AF_XDP_NUM_BUFFERS * ETH_AF_XDP_FRAME_SIZE,
1046 AF_XDP_LOG(ERR, "Failed to create umem");
1055 xdp_umem_destroy(umem);
1060 load_custom_xdp_prog(const char *prog_path, int if_index)
1062 int ret, prog_fd = -1;
1063 struct bpf_object *obj;
1064 struct bpf_map *map;
1066 ret = bpf_prog_load(prog_path, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
1068 AF_XDP_LOG(ERR, "Failed to load program %s\n", prog_path);
1073 * The loaded program must provision for a map of xsks, such that some
1074 * traffic can be redirected to userspace. When the xsk is created,
1075 * libbpf inserts it into the map.
1077 map = bpf_object__find_map_by_name(obj, "xsks_map");
1079 AF_XDP_LOG(ERR, "Failed to find xsks_map in %s\n", prog_path);
1083 /* Link the program with the given network device */
1084 ret = bpf_set_link_xdp_fd(if_index, prog_fd,
1085 XDP_FLAGS_UPDATE_IF_NOEXIST);
1087 AF_XDP_LOG(ERR, "Failed to set prog fd %d on interface\n",
1092 AF_XDP_LOG(INFO, "Successfully loaded XDP program %s with fd %d\n",
1093 prog_path, prog_fd);
1099 xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq,
1102 struct xsk_socket_config cfg;
1103 struct pkt_tx_queue *txq = rxq->pair;
1105 int reserve_size = ETH_AF_XDP_DFLT_NUM_DESCS;
1106 struct rte_mbuf *fq_bufs[reserve_size];
1108 rxq->umem = xdp_umem_configure(internals, rxq);
1109 if (rxq->umem == NULL)
1111 txq->umem = rxq->umem;
1113 cfg.rx_size = ring_size;
1114 cfg.tx_size = ring_size;
1115 cfg.libbpf_flags = 0;
1116 cfg.xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
1119 #if defined(XDP_USE_NEED_WAKEUP)
1120 cfg.bind_flags |= XDP_USE_NEED_WAKEUP;
1123 if (strnlen(internals->prog_path, PATH_MAX) &&
1124 !internals->custom_prog_configured) {
1125 ret = load_custom_xdp_prog(internals->prog_path,
1126 internals->if_index);
1128 AF_XDP_LOG(ERR, "Failed to load custom XDP program %s\n",
1129 internals->prog_path);
1132 internals->custom_prog_configured = 1;
1135 if (internals->shared_umem)
1136 ret = create_shared_socket(&rxq->xsk, internals->if_name,
1137 rxq->xsk_queue_idx, rxq->umem->umem, &rxq->rx,
1138 &txq->tx, &rxq->fq, &rxq->cq, &cfg);
1140 ret = xsk_socket__create(&rxq->xsk, internals->if_name,
1141 rxq->xsk_queue_idx, rxq->umem->umem, &rxq->rx,
1145 AF_XDP_LOG(ERR, "Failed to create xsk socket.\n");
1149 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
1150 if (rte_pktmbuf_alloc_bulk(rxq->umem->mb_pool, fq_bufs, reserve_size)) {
1151 AF_XDP_LOG(DEBUG, "Failed to get enough buffers for fq.\n");
1155 ret = reserve_fill_queue(rxq->umem, reserve_size, fq_bufs, &rxq->fq);
1157 xsk_socket__delete(rxq->xsk);
1158 AF_XDP_LOG(ERR, "Failed to reserve fill queue.\n");
1165 if (__atomic_sub_fetch(&rxq->umem->refcnt, 1, __ATOMIC_ACQUIRE) == 0)
1166 xdp_umem_destroy(rxq->umem);
1172 eth_rx_queue_setup(struct rte_eth_dev *dev,
1173 uint16_t rx_queue_id,
1174 uint16_t nb_rx_desc,
1175 unsigned int socket_id __rte_unused,
1176 const struct rte_eth_rxconf *rx_conf __rte_unused,
1177 struct rte_mempool *mb_pool)
1179 struct pmd_internals *internals = dev->data->dev_private;
1180 struct pkt_rx_queue *rxq;
1183 rxq = &internals->rx_queues[rx_queue_id];
1185 AF_XDP_LOG(INFO, "Set up rx queue, rx queue id: %d, xsk queue id: %d\n",
1186 rx_queue_id, rxq->xsk_queue_idx);
1188 #ifndef XDP_UMEM_UNALIGNED_CHUNK_FLAG
1189 uint32_t buf_size, data_size;
1191 /* Now get the space available for data in the mbuf */
1192 buf_size = rte_pktmbuf_data_room_size(mb_pool) -
1193 RTE_PKTMBUF_HEADROOM;
1194 data_size = ETH_AF_XDP_FRAME_SIZE;
1196 if (data_size > buf_size) {
1197 AF_XDP_LOG(ERR, "%s: %d bytes will not fit in mbuf (%d bytes)\n",
1198 dev->device->name, data_size, buf_size);
1204 rxq->mb_pool = mb_pool;
1206 if (xsk_configure(internals, rxq, nb_rx_desc)) {
1207 AF_XDP_LOG(ERR, "Failed to configure xdp socket\n");
1212 rxq->fds[0].fd = xsk_socket__fd(rxq->xsk);
1213 rxq->fds[0].events = POLLIN;
1215 dev->data->rx_queues[rx_queue_id] = rxq;
1223 eth_tx_queue_setup(struct rte_eth_dev *dev,
1224 uint16_t tx_queue_id,
1225 uint16_t nb_tx_desc __rte_unused,
1226 unsigned int socket_id __rte_unused,
1227 const struct rte_eth_txconf *tx_conf __rte_unused)
1229 struct pmd_internals *internals = dev->data->dev_private;
1230 struct pkt_tx_queue *txq;
1232 txq = &internals->tx_queues[tx_queue_id];
1234 dev->data->tx_queues[tx_queue_id] = txq;
1239 eth_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
1241 struct pmd_internals *internals = dev->data->dev_private;
1242 struct ifreq ifr = { .ifr_mtu = mtu };
1246 s = socket(PF_INET, SOCK_DGRAM, 0);
1250 strlcpy(ifr.ifr_name, internals->if_name, IFNAMSIZ);
1251 ret = ioctl(s, SIOCSIFMTU, &ifr);
1254 return (ret < 0) ? -errno : 0;
1258 eth_dev_change_flags(char *if_name, uint32_t flags, uint32_t mask)
1264 s = socket(PF_INET, SOCK_DGRAM, 0);
1268 strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
1269 if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0) {
1273 ifr.ifr_flags &= mask;
1274 ifr.ifr_flags |= flags;
1275 if (ioctl(s, SIOCSIFFLAGS, &ifr) < 0) {
1285 eth_dev_promiscuous_enable(struct rte_eth_dev *dev)
1287 struct pmd_internals *internals = dev->data->dev_private;
1289 return eth_dev_change_flags(internals->if_name, IFF_PROMISC, ~0);
1293 eth_dev_promiscuous_disable(struct rte_eth_dev *dev)
1295 struct pmd_internals *internals = dev->data->dev_private;
1297 return eth_dev_change_flags(internals->if_name, 0, ~IFF_PROMISC);
1300 static const struct eth_dev_ops ops = {
1301 .dev_start = eth_dev_start,
1302 .dev_stop = eth_dev_stop,
1303 .dev_close = eth_dev_close,
1304 .dev_configure = eth_dev_configure,
1305 .dev_infos_get = eth_dev_info,
1306 .mtu_set = eth_dev_mtu_set,
1307 .promiscuous_enable = eth_dev_promiscuous_enable,
1308 .promiscuous_disable = eth_dev_promiscuous_disable,
1309 .rx_queue_setup = eth_rx_queue_setup,
1310 .tx_queue_setup = eth_tx_queue_setup,
1311 .rx_queue_release = eth_queue_release,
1312 .tx_queue_release = eth_queue_release,
1313 .link_update = eth_link_update,
1314 .stats_get = eth_stats_get,
1315 .stats_reset = eth_stats_reset,
1318 /** parse integer from integer argument */
1320 parse_integer_arg(const char *key __rte_unused,
1321 const char *value, void *extra_args)
1323 int *i = (int *)extra_args;
1326 *i = strtol(value, &end, 10);
1328 AF_XDP_LOG(ERR, "Argument has to be positive.\n");
1335 /** parse name argument */
1337 parse_name_arg(const char *key __rte_unused,
1338 const char *value, void *extra_args)
1340 char *name = extra_args;
1342 if (strnlen(value, IFNAMSIZ) > IFNAMSIZ - 1) {
1343 AF_XDP_LOG(ERR, "Invalid name %s, should be less than %u bytes.\n",
1348 strlcpy(name, value, IFNAMSIZ);
1353 /** parse xdp prog argument */
1355 parse_prog_arg(const char *key __rte_unused,
1356 const char *value, void *extra_args)
1358 char *path = extra_args;
1360 if (strnlen(value, PATH_MAX) == PATH_MAX) {
1361 AF_XDP_LOG(ERR, "Invalid path %s, should be less than %u bytes.\n",
1366 if (access(value, F_OK) != 0) {
1367 AF_XDP_LOG(ERR, "Error accessing %s: %s\n",
1368 value, strerror(errno));
1372 strlcpy(path, value, PATH_MAX);
1378 xdp_get_channels_info(const char *if_name, int *max_queues,
1379 int *combined_queues)
1381 struct ethtool_channels channels;
1385 fd = socket(AF_INET, SOCK_DGRAM, 0);
1389 channels.cmd = ETHTOOL_GCHANNELS;
1390 ifr.ifr_data = (void *)&channels;
1391 strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
1392 ret = ioctl(fd, SIOCETHTOOL, &ifr);
1394 if (errno == EOPNOTSUPP) {
1402 if (channels.max_combined == 0 || errno == EOPNOTSUPP) {
1403 /* If the device says it has no channels, then all traffic
1404 * is sent to a single stream, so max queues = 1.
1407 *combined_queues = 1;
1409 *max_queues = channels.max_combined;
1410 *combined_queues = channels.combined_count;
1419 parse_parameters(struct rte_kvargs *kvlist, char *if_name, int *start_queue,
1420 int *queue_cnt, int *shared_umem, char *prog_path)
1424 ret = rte_kvargs_process(kvlist, ETH_AF_XDP_IFACE_ARG,
1425 &parse_name_arg, if_name);
1429 ret = rte_kvargs_process(kvlist, ETH_AF_XDP_START_QUEUE_ARG,
1430 &parse_integer_arg, start_queue);
1434 ret = rte_kvargs_process(kvlist, ETH_AF_XDP_QUEUE_COUNT_ARG,
1435 &parse_integer_arg, queue_cnt);
1436 if (ret < 0 || *queue_cnt <= 0) {
1441 ret = rte_kvargs_process(kvlist, ETH_AF_XDP_SHARED_UMEM_ARG,
1442 &parse_integer_arg, shared_umem);
1446 ret = rte_kvargs_process(kvlist, ETH_AF_XDP_PROG_ARG,
1447 &parse_prog_arg, prog_path);
1452 rte_kvargs_free(kvlist);
1457 get_iface_info(const char *if_name,
1458 struct rte_ether_addr *eth_addr,
1462 int sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
1467 strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
1468 if (ioctl(sock, SIOCGIFINDEX, &ifr))
1471 *if_index = ifr.ifr_ifindex;
1473 if (ioctl(sock, SIOCGIFHWADDR, &ifr))
1476 rte_memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN);
1486 static struct rte_eth_dev *
1487 init_internals(struct rte_vdev_device *dev, const char *if_name,
1488 int start_queue_idx, int queue_cnt, int shared_umem,
1489 const char *prog_path)
1491 const char *name = rte_vdev_device_name(dev);
1492 const unsigned int numa_node = dev->device.numa_node;
1493 struct pmd_internals *internals;
1494 struct rte_eth_dev *eth_dev;
1498 internals = rte_zmalloc_socket(name, sizeof(*internals), 0, numa_node);
1499 if (internals == NULL)
1502 internals->start_queue_idx = start_queue_idx;
1503 internals->queue_cnt = queue_cnt;
1504 strlcpy(internals->if_name, if_name, IFNAMSIZ);
1505 strlcpy(internals->prog_path, prog_path, PATH_MAX);
1506 internals->custom_prog_configured = 0;
1508 #ifndef ETH_AF_XDP_SHARED_UMEM
1510 AF_XDP_LOG(ERR, "Shared UMEM feature not available. "
1511 "Check kernel and libbpf version\n");
1512 goto err_free_internals;
1515 internals->shared_umem = shared_umem;
1517 if (xdp_get_channels_info(if_name, &internals->max_queue_cnt,
1518 &internals->combined_queue_cnt)) {
1519 AF_XDP_LOG(ERR, "Failed to get channel info of interface: %s\n",
1521 goto err_free_internals;
1524 if (queue_cnt > internals->combined_queue_cnt) {
1525 AF_XDP_LOG(ERR, "Specified queue count %d is larger than combined queue count %d.\n",
1526 queue_cnt, internals->combined_queue_cnt);
1527 goto err_free_internals;
1530 internals->rx_queues = rte_zmalloc_socket(NULL,
1531 sizeof(struct pkt_rx_queue) * queue_cnt,
1533 if (internals->rx_queues == NULL) {
1534 AF_XDP_LOG(ERR, "Failed to allocate memory for rx queues.\n");
1535 goto err_free_internals;
1538 internals->tx_queues = rte_zmalloc_socket(NULL,
1539 sizeof(struct pkt_tx_queue) * queue_cnt,
1541 if (internals->tx_queues == NULL) {
1542 AF_XDP_LOG(ERR, "Failed to allocate memory for tx queues.\n");
1545 for (i = 0; i < queue_cnt; i++) {
1546 internals->tx_queues[i].pair = &internals->rx_queues[i];
1547 internals->rx_queues[i].pair = &internals->tx_queues[i];
1548 internals->rx_queues[i].xsk_queue_idx = start_queue_idx + i;
1549 internals->tx_queues[i].xsk_queue_idx = start_queue_idx + i;
1552 ret = get_iface_info(if_name, &internals->eth_addr,
1553 &internals->if_index);
1557 eth_dev = rte_eth_vdev_allocate(dev, 0);
1558 if (eth_dev == NULL)
1561 eth_dev->data->dev_private = internals;
1562 eth_dev->data->dev_link = pmd_link;
1563 eth_dev->data->mac_addrs = &internals->eth_addr;
1564 eth_dev->dev_ops = &ops;
1565 eth_dev->rx_pkt_burst = eth_af_xdp_rx;
1566 eth_dev->tx_pkt_burst = eth_af_xdp_tx;
1568 #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)
1569 AF_XDP_LOG(INFO, "Zero copy between umem and mbuf enabled.\n");
1575 rte_free(internals->tx_queues);
1577 rte_free(internals->rx_queues);
1579 rte_free(internals);
1584 rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
1586 struct rte_kvargs *kvlist;
1587 char if_name[IFNAMSIZ] = {'\0'};
1588 int xsk_start_queue_idx = ETH_AF_XDP_DFLT_START_QUEUE_IDX;
1589 int xsk_queue_cnt = ETH_AF_XDP_DFLT_QUEUE_COUNT;
1590 int shared_umem = 0;
1591 char prog_path[PATH_MAX] = {'\0'};
1592 struct rte_eth_dev *eth_dev = NULL;
1595 AF_XDP_LOG(INFO, "Initializing pmd_af_xdp for %s\n",
1596 rte_vdev_device_name(dev));
1598 name = rte_vdev_device_name(dev);
1599 if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
1600 strlen(rte_vdev_device_args(dev)) == 0) {
1601 eth_dev = rte_eth_dev_attach_secondary(name);
1602 if (eth_dev == NULL) {
1603 AF_XDP_LOG(ERR, "Failed to probe %s\n", name);
1606 eth_dev->dev_ops = &ops;
1607 rte_eth_dev_probing_finish(eth_dev);
1611 kvlist = rte_kvargs_parse(rte_vdev_device_args(dev), valid_arguments);
1612 if (kvlist == NULL) {
1613 AF_XDP_LOG(ERR, "Invalid kvargs key\n");
1617 if (dev->device.numa_node == SOCKET_ID_ANY)
1618 dev->device.numa_node = rte_socket_id();
1620 if (parse_parameters(kvlist, if_name, &xsk_start_queue_idx,
1621 &xsk_queue_cnt, &shared_umem, prog_path) < 0) {
1622 AF_XDP_LOG(ERR, "Invalid kvargs value\n");
1626 if (strlen(if_name) == 0) {
1627 AF_XDP_LOG(ERR, "Network interface must be specified\n");
1631 eth_dev = init_internals(dev, if_name, xsk_start_queue_idx,
1632 xsk_queue_cnt, shared_umem, prog_path);
1633 if (eth_dev == NULL) {
1634 AF_XDP_LOG(ERR, "Failed to init internals\n");
1638 rte_eth_dev_probing_finish(eth_dev);
1644 rte_pmd_af_xdp_remove(struct rte_vdev_device *dev)
1646 struct rte_eth_dev *eth_dev = NULL;
1648 AF_XDP_LOG(INFO, "Removing AF_XDP ethdev on numa socket %u\n",
1654 /* find the ethdev entry */
1655 eth_dev = rte_eth_dev_allocated(rte_vdev_device_name(dev));
1656 if (eth_dev == NULL)
1659 eth_dev_close(eth_dev);
1660 rte_eth_dev_release_port(eth_dev);
1666 static struct rte_vdev_driver pmd_af_xdp_drv = {
1667 .probe = rte_pmd_af_xdp_probe,
1668 .remove = rte_pmd_af_xdp_remove,
1671 RTE_PMD_REGISTER_VDEV(net_af_xdp, pmd_af_xdp_drv);
1672 RTE_PMD_REGISTER_PARAM_STRING(net_af_xdp,
1674 "start_queue=<int> "
1675 "queue_count=<int> "
1676 "shared_umem=<int> "
1677 "xdp_prog=<string> ");