net/ice: fix VSI array out of bounds access
[dpdk.git] / drivers / net / af_xdp / rte_eth_af_xdp.c
index 0c91a40..eb5660a 100644 (file)
@@ -60,7 +60,7 @@
 #define PF_XDP AF_XDP
 #endif
 
-RTE_LOG_REGISTER(af_xdp_logtype, pmd.net.af_xdp, NOTICE);
+RTE_LOG_REGISTER_DEFAULT(af_xdp_logtype, NOTICE);
 
 #define AF_XDP_LOG(level, fmt, args...)                        \
        rte_log(RTE_LOG_ ## level, af_xdp_logtype,      \
@@ -272,8 +272,18 @@ af_xdp_rx_zc(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
        nb_pkts = xsk_ring_cons__peek(rx, nb_pkts, &idx_rx);
 
        if (nb_pkts == 0) {
-               rx_syscall_handler(&rxq->fq, rxq->busy_budget, &rxq->fds[0],
-                                  rxq->xsk);
+               /* we can assume a kernel >= 5.11 is in use if busy polling is
+                * enabled and thus we can safely use the recvfrom() syscall
+                * which is only supported for AF_XDP sockets in kernels >=
+                * 5.11.
+                */
+               if (rxq->busy_budget) {
+                       (void)recvfrom(xsk_socket__fd(rxq->xsk), NULL, 0,
+                                      MSG_DONTWAIT, NULL, NULL);
+               } else if (xsk_ring_prod__needs_wakeup(fq)) {
+                       (void)poll(&rxq->fds[0], 1, 1000);
+               }
+
                return 0;
        }