From a41f593f1bce27cd94eae0e85a8085c592b14b30 Mon Sep 17 00:00:00 2001
From: Ferruh Yigit <ferruh.yigit@intel.com>
Date: Fri, 11 Feb 2022 19:11:42 +0000
Subject: [PATCH] ethdev: introduce generic dummy packet burst function

[ upstream commit a41f593f1bce27cd94eae0e85a8085c592b14b30 ]

MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Multiple PMDs have dummy/noop Rx/Tx packet burst functions.

These dummy functions are very simple, introduce a common function in
the ethdev and update drivers to use it instead of each driver having
its own functions.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/net/af_xdp/rte_eth_af_xdp.c | 26 ++-------------
 1 files changed, 73 insertions(+), 325 deletions(-)
 create mode 100644 lib/ethdev/ethdev_driver.c

diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 4a37c11960..6ac710c6bd 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1916,28 +1916,6 @@ afxdp_mp_send_fds(const struct rte_mp_msg *request, const void *peer)
 	return 0;
 }
 
-/* Secondary process rx function. RX is disabled because memory mapping of the
- * rings being assigned by the kernel in the primary process only.
- */
-static uint16_t
-eth_af_xdp_rx_noop(void *queue __rte_unused,
-		struct rte_mbuf **bufs __rte_unused,
-		uint16_t nb_pkts __rte_unused)
-{
-	return 0;
-}
-
-/* Secondary process tx function. TX is disabled because memory mapping of the
- * rings being assigned by the kernel in the primary process only.
- */
-static uint16_t
-eth_af_xdp_tx_noop(void *queue __rte_unused,
-			struct rte_mbuf **bufs __rte_unused,
-			uint16_t nb_pkts __rte_unused)
-{
-	return 0;
-}
-
 static int
 rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 {
@@ -1961,8 +1939,8 @@ rte_pmd_af_xdp_probe(struct rte_vdev_device *dev)
 		}
 		eth_dev->dev_ops = &ops;
 		eth_dev->device = &dev->device;
-		eth_dev->rx_pkt_burst = eth_af_xdp_rx_noop;
-		eth_dev->tx_pkt_burst = eth_af_xdp_tx_noop;
+		eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+		eth_dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
 		eth_dev->process_private = (struct pmd_process_private *)
 			rte_zmalloc_socket(name,
 					   sizeof(struct pmd_process_private),
-- 
2.33.0

