]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: introduce generic dummy packet burst function
authorFerruh Yigit <ferruh.yigit@intel.com>
Fri, 11 Feb 2022 19:11:42 +0000 (19:11 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 11 Feb 2022 20:17:34 +0000 (21:17 +0100)
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>
42 files changed:
drivers/net/af_xdp/rte_eth_af_xdp.c
drivers/net/ark/ark_ethdev.c
drivers/net/ark/ark_ethdev_rx.c
drivers/net/ark/ark_ethdev_rx.h
drivers/net/ark/ark_ethdev_tx.c
drivers/net/ark/ark_ethdev_tx.h
drivers/net/bnx2x/bnx2x_rxtx.c
drivers/net/bnxt/bnxt.h
drivers/net/bnxt/bnxt_cpr.c
drivers/net/bnxt/bnxt_rxr.c
drivers/net/bnxt/bnxt_txr.c
drivers/net/cnxk/cnxk_ethdev.c
drivers/net/dpaa2/dpaa2_ethdev.c
drivers/net/dpaa2/dpaa2_ethdev.h
drivers/net/dpaa2/dpaa2_rxtx.c
drivers/net/enic/enic.h
drivers/net/enic/enic_ethdev.c
drivers/net/enic/enic_main.c
drivers/net/enic/enic_rxtx.c
drivers/net/hns3/hns3_rxtx.c
drivers/net/hns3/hns3_rxtx.h
drivers/net/mlx4/mlx4.c
drivers/net/mlx4/mlx4_mp.c
drivers/net/mlx4/mlx4_rxtx.c
drivers/net/mlx4/mlx4_rxtx.h
drivers/net/mlx5/linux/mlx5_mp_os.c
drivers/net/mlx5/linux/mlx5_os.c
drivers/net/mlx5/mlx5.c
drivers/net/mlx5/mlx5_rx.c
drivers/net/mlx5/mlx5_rx.h
drivers/net/mlx5/mlx5_trigger.c
drivers/net/mlx5/mlx5_tx.c
drivers/net/mlx5/mlx5_tx.h
drivers/net/mlx5/windows/mlx5_os.c
drivers/net/pfe/pfe_ethdev.c
drivers/net/qede/qede_ethdev.c
drivers/net/qede/qede_rxtx.c
drivers/net/qede/qede_rxtx.h
lib/ethdev/ethdev_driver.c [new file with mode: 0644]
lib/ethdev/ethdev_driver.h
lib/ethdev/meson.build
lib/ethdev/version.map

index 4a37c11960e1f876806f5bd81ad9850fc72252f8..6ac710c6bdc6d86af253fdd3700e71509fab7965 100644 (file)
@@ -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),
index b618cba3f02356bdbfc90d7c1219d0c6e870cb5a..230a1272e9864e82c0635808a1ffa3838b9dfb97 100644 (file)
@@ -271,8 +271,8 @@ eth_ark_dev_init(struct rte_eth_dev *dev)
        dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS;
 
        /* Use dummy function until setup */
-       dev->rx_pkt_burst = &eth_ark_recv_pkts_noop;
-       dev->tx_pkt_burst = &eth_ark_xmit_pkts_noop;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
 
        ark->bar0 = (uint8_t *)pci_dev->mem_resource[0].addr;
        ark->a_bar = (uint8_t *)pci_dev->mem_resource[2].addr;
@@ -605,8 +605,8 @@ eth_ark_dev_stop(struct rte_eth_dev *dev)
        if (ark->start_pg)
                ark_pktgen_pause(ark->pg);
 
-       dev->rx_pkt_burst = &eth_ark_recv_pkts_noop;
-       dev->tx_pkt_burst = &eth_ark_xmit_pkts_noop;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
 
        /* STOP TX Side */
        for (i = 0; i < dev->data->nb_tx_queues; i++) {
index 98658ce621e26d10cbd8d513e4abd07e6f30c700..37a88cbedee4bd8f511de570a1431b2b20aa1a42 100644 (file)
@@ -228,15 +228,6 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
        return 0;
 }
 
-/* ************************************************************************* */
-uint16_t
-eth_ark_recv_pkts_noop(void *rx_queue __rte_unused,
-                      struct rte_mbuf **rx_pkts __rte_unused,
-                      uint16_t nb_pkts __rte_unused)
-{
-       return 0;
-}
-
 /* ************************************************************************* */
 uint16_t
 eth_ark_recv_pkts(void *rx_queue,
index 859fcf1e6f7134cfe1d2c53a39e765793970c40b..f64b3dd137b39d9a0f09e29f489ad5dd2db02649 100644 (file)
@@ -20,8 +20,6 @@ int eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev,
 uint32_t eth_ark_dev_rx_queue_count(void *rx_queue);
 int eth_ark_rx_stop_queue(struct rte_eth_dev *dev, uint16_t queue_id);
 int eth_ark_rx_start_queue(struct rte_eth_dev *dev, uint16_t queue_id);
-uint16_t eth_ark_recv_pkts_noop(void *rx_queue, struct rte_mbuf **rx_pkts,
-                               uint16_t nb_pkts);
 uint16_t eth_ark_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                           uint16_t nb_pkts);
 void eth_ark_dev_rx_queue_release(void *rx_queue);
index 676e4115d3bf700d370368720170c5aa39953014..abdce6a8cc0d39570cbfb7f682eabd68d3b74aa2 100644 (file)
@@ -105,15 +105,6 @@ eth_ark_tx_desc_fill(struct ark_tx_queue *queue,
 }
 
 
-/* ************************************************************************* */
-uint16_t
-eth_ark_xmit_pkts_noop(void *vtxq __rte_unused,
-                      struct rte_mbuf **tx_pkts __rte_unused,
-                      uint16_t nb_pkts __rte_unused)
-{
-       return 0;
-}
-
 /* ************************************************************************* */
 uint16_t
 eth_ark_xmit_pkts(void *vtxq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
index 12c71a7158a92b258607408551bdc84ee4d40556..7134dbfeed81f6e198be9b2a1fdb4e351a530c85 100644 (file)
@@ -10,9 +10,6 @@
 #include <ethdev_driver.h>
 
 
-uint16_t eth_ark_xmit_pkts_noop(void *vtxq,
-                               struct rte_mbuf **tx_pkts,
-                               uint16_t nb_pkts);
 uint16_t eth_ark_xmit_pkts(void *vtxq,
                           struct rte_mbuf **tx_pkts,
                           uint16_t nb_pkts);
index 00ddccf151fd92cba8e5b0dace72a47bae9e0353..fbc0bb7698740d6910912b41392f0a7fcbe8db50 100644 (file)
@@ -463,18 +463,10 @@ next_rx:
        return nb_rx;
 }
 
-static uint16_t
-bnx2x_rxtx_pkts_dummy(__rte_unused void *p_rxq,
-                     __rte_unused struct rte_mbuf **rx_pkts,
-                     __rte_unused uint16_t nb_pkts)
-{
-       return 0;
-}
-
 void bnx2x_dev_rxtx_init_dummy(struct rte_eth_dev *dev)
 {
-       dev->rx_pkt_burst = bnx2x_rxtx_pkts_dummy;
-       dev->tx_pkt_burst = bnx2x_rxtx_pkts_dummy;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
 }
 
 void bnx2x_dev_rxtx_init(struct rte_eth_dev *dev)
index 0cbb58b2cf3e9889d9af5afd0f36c4183e7cc392..44724a9dfe9124715aebff3a98f4d68b30a16eee 100644 (file)
@@ -1014,10 +1014,6 @@ void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp);
 int bnxt_link_update_op(struct rte_eth_dev *eth_dev,
                        int wait_to_complete);
-uint16_t bnxt_dummy_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
-                             uint16_t nb_pkts);
-uint16_t bnxt_dummy_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
-                             uint16_t nb_pkts);
 
 extern const struct rte_flow_ops bnxt_flow_ops;
 
index 9b9285b799030d577b1df44b338bad6b354d3238..99af0f9e87ee202d7875ed2af1cb3bfd4c76f671 100644 (file)
@@ -408,8 +408,8 @@ bool bnxt_is_recovery_enabled(struct bnxt *bp)
 
 void bnxt_stop_rxtx(struct rte_eth_dev *eth_dev)
 {
-       eth_dev->rx_pkt_burst = &bnxt_dummy_recv_pkts;
-       eth_dev->tx_pkt_burst = &bnxt_dummy_xmit_pkts;
+       eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       eth_dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
 
        rte_eth_fp_ops[eth_dev->data->port_id].rx_pkt_burst =
                eth_dev->rx_pkt_burst;
index b60c2470f39ec58ca9d7a630405af1f04656c3e8..5a9cf48e6739029aeb58391473db07bc61513ea3 100644 (file)
@@ -1147,20 +1147,6 @@ done:
        return nb_rx_pkts;
 }
 
-/*
- * Dummy DPDK callback for RX.
- *
- * This function is used to temporarily replace the real callback during
- * unsafe control operations on the queue, or in case of error.
- */
-uint16_t
-bnxt_dummy_recv_pkts(void *rx_queue __rte_unused,
-                    struct rte_mbuf **rx_pkts __rte_unused,
-                    uint16_t nb_pkts __rte_unused)
-{
-       return 0;
-}
-
 void bnxt_free_rx_rings(struct bnxt *bp)
 {
        int i;
index 3b8f2382f92e341753ca21d4b44d2f2e5da454de..7a7196a237312fd59df33d7838d4aefd16572f4d 100644 (file)
@@ -527,20 +527,6 @@ uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
        return nb_tx_pkts;
 }
 
-/*
- * Dummy DPDK callback for TX.
- *
- * This function is used to temporarily replace the real callback during
- * unsafe control operations on the queue, or in case of error.
- */
-uint16_t
-bnxt_dummy_xmit_pkts(void *tx_queue __rte_unused,
-                    struct rte_mbuf **tx_pkts __rte_unused,
-                    uint16_t nb_pkts __rte_unused)
-{
-       return 0;
-}
-
 int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id)
 {
        struct bnxt *bp = dev->data->dev_private;
index 945600cdaf64133511e9e5b8ad46ab119cf6873d..27751a6956cc8278ac6d8436a20b48c2c609a6da 100644 (file)
@@ -940,16 +940,6 @@ fail:
        return rc;
 }
 
-static uint16_t
-nix_eth_nop_burst(void *queue, struct rte_mbuf **mbufs, uint16_t pkts)
-{
-       RTE_SET_USED(queue);
-       RTE_SET_USED(mbufs);
-       RTE_SET_USED(pkts);
-
-       return 0;
-}
-
 static void
 nix_set_nop_rxtx_function(struct rte_eth_dev *eth_dev)
 {
@@ -960,8 +950,8 @@ nix_set_nop_rxtx_function(struct rte_eth_dev *eth_dev)
         * which caused app crash since rx/tx burst is still
         * on different lcores
         */
-       eth_dev->tx_pkt_burst = nix_eth_nop_burst;
-       eth_dev->rx_pkt_burst = nix_eth_nop_burst;
+       eth_dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
+       eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
        rte_mb();
 }
 
index ee14a064ef2226cd48c46ea69e96781c23738d25..52eb6df31052955351e13542ab6f508ce103ab98 100644 (file)
@@ -2004,7 +2004,7 @@ dpaa2_dev_set_link_down(struct rte_eth_dev *dev)
        }
 
        /*changing  tx burst function to avoid any more enqueues */
-       dev->tx_pkt_burst = dummy_dev_tx;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
 
        /* Loop while dpni_disable() attempts to drain the egress FQs
         * and confirm them back to us.
index 1b49f43103a72121619332f0fa726728ab83db2d..e79a7fc2e286e27c25a547d00dcae0f9a41e7be3 100644 (file)
@@ -264,7 +264,6 @@ __rte_internal
 uint16_t dpaa2_dev_tx_multi_txq_ordered(void **queue,
                struct rte_mbuf **bufs, uint16_t nb_pkts);
 
-uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
 void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci);
 void dpaa2_flow_clean(struct rte_eth_dev *dev);
 uint16_t dpaa2_dev_tx_conf(void *queue)  __rte_unused;
index 81b28e20cb47102ca69f7663f10800c6dfe97906..b8844fbdf1070442cd6c9f8644d20f5f5e05980a 100644 (file)
@@ -1802,31 +1802,6 @@ skip_tx:
        return num_tx;
 }
 
-/**
- * Dummy DPDK callback for TX.
- *
- * This function is used to temporarily replace the real callback during
- * unsafe control operations on the queue, or in case of error.
- *
- * @param dpdk_txq
- *   Generic pointer to TX queue structure.
- * @param[in] pkts
- *   Packets to transmit.
- * @param pkts_n
- *   Number of packets in array.
- *
- * @return
- *   Number of packets successfully transmitted (<= pkts_n).
- */
-uint16_t
-dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
-{
-       (void)queue;
-       (void)bufs;
-       (void)nb_pkts;
-       return 0;
-}
-
 #if defined(RTE_TOOLCHAIN_GCC)
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wcast-qual"
index d5493c98345dbd48386409e38d96eaf6daf3477a..163a1f037e26515d0f6f1ccab4d4aa7fff5e6fd9 100644 (file)
@@ -426,9 +426,6 @@ uint16_t enic_recv_pkts_64(void *rx_queue, struct rte_mbuf **rx_pkts,
                           uint16_t nb_pkts);
 uint16_t enic_noscatter_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
                                  uint16_t nb_pkts);
-uint16_t enic_dummy_recv_pkts(void *rx_queue,
-                             struct rte_mbuf **rx_pkts,
-                             uint16_t nb_pkts);
 uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
                        uint16_t nb_pkts);
 uint16_t enic_simple_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
index 163be09809b1ebbea35a84957bc29c02105f2d0c..a8d470e8ac93f4f66213e7249d8b904fdad16867 100644 (file)
@@ -538,7 +538,7 @@ static const uint32_t *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
                RTE_PTYPE_UNKNOWN
        };
 
-       if (dev->rx_pkt_burst != enic_dummy_recv_pkts &&
+       if (dev->rx_pkt_burst != rte_eth_pkt_burst_dummy &&
            dev->rx_pkt_burst != NULL) {
                struct enic *enic = pmd_priv(dev);
                if (enic->overlay_offload)
index 97d97ea793f2c3991aafb93852ec07ecdb8092e9..9f351de72eb4e487b086bf875214df3258dd731b 100644 (file)
@@ -1664,7 +1664,7 @@ int enic_set_mtu(struct enic *enic, uint16_t new_mtu)
        }
 
        /* replace Rx function with a no-op to avoid getting stale pkts */
-       eth_dev->rx_pkt_burst = enic_dummy_recv_pkts;
+       eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
        rte_eth_fp_ops[enic->port_id].rx_pkt_burst = eth_dev->rx_pkt_burst;
        rte_mb();
 
index 74a90694c7187f3e04ce679e1b4bc56608bfc3f6..7a66d72275d9d002c6e3d7bfdef9dbeb3dfbda02 100644 (file)
 #define rte_packet_prefetch(p) do {} while (0)
 #endif
 
-/* dummy receive function to replace actual function in
- * order to do safe reconfiguration operations.
- */
-uint16_t
-enic_dummy_recv_pkts(__rte_unused void *rx_queue,
-                    __rte_unused struct rte_mbuf **rx_pkts,
-                    __rte_unused uint16_t nb_pkts)
-{
-       return 0;
-}
-
 static inline uint16_t
 enic_recv_pkts_common(void *rx_queue, struct rte_mbuf **rx_pkts,
                      uint16_t nb_pkts, const bool use_64b_desc)
index 2d98db377f722b9df834d17aa016a533f97b92f3..a28de06dfdf0d436dca183a7cd31bd4206219ee4 100644 (file)
@@ -4380,14 +4380,6 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep)
        return hns3_xmit_pkts;
 }
 
-uint16_t
-hns3_dummy_rxtx_burst(void *dpdk_txq __rte_unused,
-                     struct rte_mbuf **pkts __rte_unused,
-                     uint16_t pkts_n __rte_unused)
-{
-       return 0;
-}
-
 static void
 hns3_trace_rxtx_function(struct rte_eth_dev *dev)
 {
@@ -4429,14 +4421,14 @@ hns3_set_rxtx_function(struct rte_eth_dev *eth_dev)
                eth_dev->rx_pkt_burst = hns3_get_rx_function(eth_dev);
                eth_dev->rx_descriptor_status = hns3_dev_rx_descriptor_status;
                eth_dev->tx_pkt_burst = hw->set_link_down ?
-                                       hns3_dummy_rxtx_burst :
+                                       rte_eth_pkt_burst_dummy :
                                        hns3_get_tx_function(eth_dev, &prep);
                eth_dev->tx_pkt_prepare = prep;
                eth_dev->tx_descriptor_status = hns3_dev_tx_descriptor_status;
                hns3_trace_rxtx_function(eth_dev);
        } else {
-               eth_dev->rx_pkt_burst = hns3_dummy_rxtx_burst;
-               eth_dev->tx_pkt_burst = hns3_dummy_rxtx_burst;
+               eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+               eth_dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
                eth_dev->tx_pkt_prepare = NULL;
        }
 
@@ -4629,7 +4621,7 @@ hns3_tx_done_cleanup(void *txq, uint32_t free_cnt)
 
        if (dev->tx_pkt_burst == hns3_xmit_pkts)
                return hns3_tx_done_cleanup_full(q, free_cnt);
-       else if (dev->tx_pkt_burst == hns3_dummy_rxtx_burst)
+       else if (dev->tx_pkt_burst == rte_eth_pkt_burst_dummy)
                return 0;
        else
                return -ENOTSUP;
@@ -4739,7 +4731,7 @@ hns3_enable_rxd_adv_layout(struct hns3_hw *hw)
 void
 hns3_stop_tx_datapath(struct rte_eth_dev *dev)
 {
-       dev->tx_pkt_burst = hns3_dummy_rxtx_burst;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
        dev->tx_pkt_prepare = NULL;
        hns3_eth_dev_fp_ops_config(dev);
 
index 094b65b7de70c629f84e7c90157f5284a6599b45..a000318357abbffe2b424481df2231a15cf08a47 100644 (file)
@@ -729,9 +729,6 @@ void hns3_init_rx_ptype_tble(struct rte_eth_dev *dev);
 void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev);
 eth_tx_burst_t hns3_get_tx_function(struct rte_eth_dev *dev,
                                    eth_tx_prep_t *prep);
-uint16_t hns3_dummy_rxtx_burst(void *dpdk_txq __rte_unused,
-                              struct rte_mbuf **pkts __rte_unused,
-                              uint16_t pkts_n __rte_unused);
 
 uint32_t hns3_get_tqp_intr_reg_offset(uint16_t tqp_intr_id);
 void hns3_set_queue_intr_gl(struct hns3_hw *hw, uint16_t queue_id,
index 3f3c4a7c72148127d7c9412f71cb10764c1bad68..910b76a92c4244db75b219289bcbe2514ef4f625 100644 (file)
@@ -350,8 +350,8 @@ mlx4_dev_stop(struct rte_eth_dev *dev)
                return 0;
        DEBUG("%p: detaching flows from all RX queues", (void *)dev);
        priv->started = 0;
-       dev->tx_pkt_burst = mlx4_tx_burst_removed;
-       dev->rx_pkt_burst = mlx4_rx_burst_removed;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
        rte_wmb();
        /* Disable datapath on secondary process. */
        mlx4_mp_req_stop_rxtx(dev);
@@ -383,8 +383,8 @@ mlx4_dev_close(struct rte_eth_dev *dev)
        DEBUG("%p: closing device \"%s\"",
              (void *)dev,
              ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
-       dev->rx_pkt_burst = mlx4_rx_burst_removed;
-       dev->tx_pkt_burst = mlx4_tx_burst_removed;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
        rte_wmb();
        /* Disable datapath on secondary process. */
        mlx4_mp_req_stop_rxtx(dev);
index 8fcfb5490ee967a228981b6e83f62ca2860f2fb1..1da64910aadd6ad04a997057bd90117e3e56abe2 100644 (file)
@@ -150,8 +150,8 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer)
                break;
        case MLX4_MP_REQ_STOP_RXTX:
                INFO("port %u stopping datapath", dev->data->port_id);
-               dev->tx_pkt_burst = mlx4_tx_burst_removed;
-               dev->rx_pkt_burst = mlx4_rx_burst_removed;
+               dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
+               dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
                rte_mb();
                mp_init_msg(dev, &mp_res, param->type);
                res->result = 0;
index ed9e41fcdea9118c6de6d7a339d98fe60a932994..059e432a63fc1cf47d345ea191fdf7305021e80a 100644 (file)
@@ -1338,55 +1338,3 @@ skip:
        rxq->stats.ipackets += i;
        return i;
 }
-
-/**
- * Dummy DPDK callback for Tx.
- *
- * This function is used to temporarily replace the real callback during
- * unsafe control operations on the queue, or in case of error.
- *
- * @param dpdk_txq
- *   Generic pointer to Tx queue structure.
- * @param[in] pkts
- *   Packets to transmit.
- * @param pkts_n
- *   Number of packets in array.
- *
- * @return
- *   Number of packets successfully transmitted (<= pkts_n).
- */
-uint16_t
-mlx4_tx_burst_removed(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n)
-{
-       (void)dpdk_txq;
-       (void)pkts;
-       (void)pkts_n;
-       rte_mb();
-       return 0;
-}
-
-/**
- * Dummy DPDK callback for Rx.
- *
- * This function is used to temporarily replace the real callback during
- * unsafe control operations on the queue, or in case of error.
- *
- * @param dpdk_rxq
- *   Generic pointer to Rx queue structure.
- * @param[out] pkts
- *   Array to store received packets.
- * @param pkts_n
- *   Maximum number of packets in array.
- *
- * @return
- *   Number of packets successfully received (<= pkts_n).
- */
-uint16_t
-mlx4_rx_burst_removed(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
-{
-       (void)dpdk_rxq;
-       (void)pkts;
-       (void)pkts_n;
-       rte_mb();
-       return 0;
-}
index 83e9534cd0a7cab02be5ed655e4318f5714ba151..70f3cd868058bf3024c6194f0bb4a94e31b782f5 100644 (file)
@@ -149,10 +149,6 @@ uint16_t mlx4_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts,
                       uint16_t pkts_n);
 uint16_t mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts,
                       uint16_t pkts_n);
-uint16_t mlx4_tx_burst_removed(void *dpdk_txq, struct rte_mbuf **pkts,
-                              uint16_t pkts_n);
-uint16_t mlx4_rx_burst_removed(void *dpdk_rxq, struct rte_mbuf **pkts,
-                              uint16_t pkts_n);
 
 /* mlx4_txq.c */
 
index c448a3e9eb872e34a00fa70abced0877f717114f..e607089e0e20c11acac2a104ee29d28cb32ab5b0 100644 (file)
@@ -192,8 +192,8 @@ struct rte_mp_msg mp_res;
                break;
        case MLX5_MP_REQ_STOP_RXTX:
                DRV_LOG(INFO, "port %u stopping datapath", dev->data->port_id);
-               dev->rx_pkt_burst = removed_rx_burst;
-               dev->tx_pkt_burst = removed_tx_burst;
+               dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+               dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
                rte_mb();
                mp_init_msg(&priv->mp_id, &mp_res, param->type);
                res->result = 0;
index aecdc5a68abb5b41885fcaade1c6dc7b77dff8e5..bbe05bb837e01bc5b22143e71dd44d2b5fa84ec2 100644 (file)
@@ -1623,8 +1623,8 @@ err_secondary:
        DRV_LOG(DEBUG, "port %u MTU is %u", eth_dev->data->port_id,
                priv->mtu);
        /* Initialize burst functions to prevent crashes before link-up. */
-       eth_dev->rx_pkt_burst = removed_rx_burst;
-       eth_dev->tx_pkt_burst = removed_tx_burst;
+       eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       eth_dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
        eth_dev->dev_ops = &mlx5_dev_ops;
        eth_dev->rx_descriptor_status = mlx5_rx_descriptor_status;
        eth_dev->tx_descriptor_status = mlx5_tx_descriptor_status;
index 67eda41a60a5a6b6740fe85ce366739c4138b8c8..5571e9067787c62c109ea46a649784aeb22383f8 100644 (file)
@@ -1559,8 +1559,8 @@ mlx5_dev_close(struct rte_eth_dev *dev)
        mlx5_action_handle_flush(dev);
        mlx5_flow_meter_flush(dev, NULL);
        /* Prevent crashes when queues are still in use. */
-       dev->rx_pkt_burst = removed_rx_burst;
-       dev->tx_pkt_burst = removed_tx_burst;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
        rte_wmb();
        /* Disable datapath on secondary process. */
        mlx5_mp_os_req_stop_rxtx(dev);
index f388fcc31395162e594f461a718e4ad142ef3e25..11ea935d72f0c3360466a0a096221bd9f1ed81c0 100644 (file)
@@ -252,7 +252,7 @@ mlx5_rx_queue_count(void *rx_queue)
        dev = &rte_eth_devices[rxq->port_id];
 
        if (dev->rx_pkt_burst == NULL ||
-           dev->rx_pkt_burst == removed_rx_burst) {
+           dev->rx_pkt_burst == rte_eth_pkt_burst_dummy) {
                rte_errno = ENOTSUP;
                return -rte_errno;
        }
@@ -1153,31 +1153,6 @@ mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
        return i;
 }
 
-/**
- * Dummy DPDK callback for RX.
- *
- * This function is used to temporarily replace the real callback during
- * unsafe control operations on the queue, or in case of error.
- *
- * @param dpdk_rxq
- *   Generic pointer to RX queue structure.
- * @param[out] pkts
- *   Array to store received packets.
- * @param pkts_n
- *   Maximum number of packets in array.
- *
- * @return
- *   Number of packets successfully received (<= pkts_n).
- */
-uint16_t
-removed_rx_burst(void *dpdk_rxq __rte_unused,
-                struct rte_mbuf **pkts __rte_unused,
-                uint16_t pkts_n __rte_unused)
-{
-       rte_mb();
-       return 0;
-}
-
 /*
  * Vectorized Rx routines are not compiled in when required vector instructions
  * are not supported on a target architecture.
index cb5d51340db72bd846b7ff0d8c957ccc1f322c4f..7e417819f7e8e98dde3ff4a9e2b78daa26134224 100644 (file)
@@ -275,8 +275,6 @@ __rte_noinline int mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec);
 void mlx5_mprq_buf_free(struct mlx5_mprq_buf *buf);
 uint16_t mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts,
                            uint16_t pkts_n);
-uint16_t removed_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts,
-                         uint16_t pkts_n);
 int mlx5_rx_descriptor_status(void *rx_queue, uint16_t offset);
 uint32_t mlx5_rx_queue_count(void *rx_queue);
 void mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
index 74c9c0a4fff8c82df12db4cb8d002b02dfb756cd..3a59237b1a7a8c6a67549878c556dcb05b36cf9b 100644 (file)
@@ -1244,8 +1244,8 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
 
        dev->data->dev_started = 0;
        /* Prevent crashes when queues are still in use. */
-       dev->rx_pkt_burst = removed_rx_burst;
-       dev->tx_pkt_burst = removed_tx_burst;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
        rte_wmb();
        /* Disable datapath on secondary process. */
        mlx5_mp_os_req_stop_rxtx(dev);
index fd2cf20967536d890f4fb1dde831c527996d6189..8453b2701a9f47219a65d49dd7d992f1b178e9bf 100644 (file)
@@ -135,31 +135,6 @@ mlx5_tx_error_cqe_handle(struct mlx5_txq_data *__rte_restrict txq,
        return 0;
 }
 
-/**
- * Dummy DPDK callback for TX.
- *
- * This function is used to temporarily replace the real callback during
- * unsafe control operations on the queue, or in case of error.
- *
- * @param dpdk_txq
- *   Generic pointer to TX queue structure.
- * @param[in] pkts
- *   Packets to transmit.
- * @param pkts_n
- *   Number of packets in array.
- *
- * @return
- *   Number of packets successfully transmitted (<= pkts_n).
- */
-uint16_t
-removed_tx_burst(void *dpdk_txq __rte_unused,
-                struct rte_mbuf **pkts __rte_unused,
-                uint16_t pkts_n __rte_unused)
-{
-       rte_mb();
-       return 0;
-}
-
 /**
  * Update completion queue consuming index via doorbell
  * and flush the completed data buffers.
index 398cadfeaa46fa5d28ca13370ed16fe6857757d4..c4b8271f6fb3fe3c779ead631a55eb72ee32501f 100644 (file)
@@ -221,8 +221,6 @@ void mlx5_txq_dynf_timestamp_set(struct rte_eth_dev *dev);
 
 /* mlx5_tx.c */
 
-uint16_t removed_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts,
-                         uint16_t pkts_n);
 void mlx5_tx_handle_completion(struct mlx5_txq_data *__rte_restrict txq,
                               unsigned int olx __rte_unused);
 int mlx5_tx_descriptor_status(void *tx_queue, uint16_t offset);
index ac0af0ff7d43c091c6e9b719fa67e28d921e6f9b..7f3532426f1fb3c531ba3fe471bea19a41312dda 100644 (file)
@@ -574,8 +574,8 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
        DRV_LOG(DEBUG, "port %u MTU is %u.", eth_dev->data->port_id,
                priv->mtu);
        /* Initialize burst functions to prevent crashes before link-up. */
-       eth_dev->rx_pkt_burst = removed_rx_burst;
-       eth_dev->tx_pkt_burst = removed_tx_burst;
+       eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       eth_dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
        eth_dev->dev_ops = &mlx5_dev_ops;
        eth_dev->rx_descriptor_status = mlx5_rx_descriptor_status;
        eth_dev->tx_descriptor_status = mlx5_tx_descriptor_status;
index edf32aa70da660db2a65ce2a0cf883c542934d5b..c2991ab1ccaa5025fed87daf09acb083431d0a1f 100644 (file)
@@ -235,22 +235,6 @@ pfe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
        return nb_pkts;
 }
 
-static uint16_t
-pfe_dummy_xmit_pkts(__rte_unused void *tx_queue,
-               __rte_unused struct rte_mbuf **tx_pkts,
-               __rte_unused uint16_t nb_pkts)
-{
-       return 0;
-}
-
-static uint16_t
-pfe_dummy_recv_pkts(__rte_unused void *rxq,
-               __rte_unused struct rte_mbuf **rx_pkts,
-               __rte_unused uint16_t nb_pkts)
-{
-       return 0;
-}
-
 static int
 pfe_eth_open(struct rte_eth_dev *dev)
 {
@@ -383,8 +367,8 @@ pfe_eth_stop(struct rte_eth_dev *dev/*, int wake*/)
        gemac_disable(priv->EMAC_baseaddr);
        gpi_disable(priv->GPI_baseaddr);
 
-       dev->rx_pkt_burst = &pfe_dummy_recv_pkts;
-       dev->tx_pkt_burst = &pfe_dummy_xmit_pkts;
+       dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
 
        return 0;
 }
index a1122a297e6b248cf14c69fa412c325563b0db1a..ea6b71f093559d67c0f596b3effdda4ea8a79e53 100644 (file)
@@ -322,8 +322,8 @@ qede_assign_rxtx_handlers(struct rte_eth_dev *dev, bool is_dummy)
        bool use_tx_offload = false;
 
        if (is_dummy) {
-               dev->rx_pkt_burst = qede_rxtx_pkts_dummy;
-               dev->tx_pkt_burst = qede_rxtx_pkts_dummy;
+               dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
+               dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
                return;
        }
 
index 1c0a6ba5f1bf6e595f7c148759b0bbb923bf439e..911bb1a260998be96e80addbff8bb91b55a5f0d4 100644 (file)
@@ -2732,15 +2732,6 @@ qede_xmit_pkts_cmt(void *p_fp_cmt, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
        return eng0_pkts + eng1_pkts;
 }
 
-uint16_t
-qede_rxtx_pkts_dummy(__rte_unused void *p_rxq,
-                    __rte_unused struct rte_mbuf **pkts,
-                    __rte_unused uint16_t nb_pkts)
-{
-       return 0;
-}
-
-
 /* this function does a fake walk through over completion queue
  * to calculate number of BDs used by HW.
  * At the end, it restores the state of completion queue.
index 11ed1d9b9c502d5cb905cf1774ff37ab4d2abbd3..013a4a07c7169c346bf65246121ef191607dd8b3 100644 (file)
@@ -272,9 +272,6 @@ uint16_t qede_recv_pkts_cmt(void *p_rxq, struct rte_mbuf **rx_pkts,
 uint16_t
 qede_recv_pkts_regular(void *p_rxq, struct rte_mbuf **rx_pkts,
                       uint16_t nb_pkts);
-uint16_t qede_rxtx_pkts_dummy(void *p_rxq,
-                             struct rte_mbuf **pkts,
-                             uint16_t nb_pkts);
 
 int qede_start_queues(struct rte_eth_dev *eth_dev);
 
diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c
new file mode 100644 (file)
index 0000000..fb7323f
--- /dev/null
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2022 Intel Corporation
+ */
+
+#include "ethdev_driver.h"
+
+uint16_t
+rte_eth_pkt_burst_dummy(void *queue __rte_unused,
+               struct rte_mbuf **pkts __rte_unused,
+               uint16_t nb_pkts __rte_unused)
+{
+       return 0;
+}
index 41a7deab8e877f59d8b1f5946747bdb0d0d24a6b..6d697a879a9aa0cfbcbf546d82369696b886225d 100644 (file)
@@ -1509,6 +1509,23 @@ rte_eth_linkstatus_get(const struct rte_eth_dev *dev,
        *dst = __atomic_load_n(src, __ATOMIC_SEQ_CST);
 }
 
+/**
+ * @internal
+ * Dummy DPDK callback for Rx/Tx packet burst.
+ *
+ * @param queue
+ *  Pointer to Rx/Tx queue
+ * @param pkts
+ *  Packet array
+ * @param nb_pkts
+ *  Number of packets in packet array
+ */
+__rte_internal
+uint16_t
+rte_eth_pkt_burst_dummy(void *queue __rte_unused,
+               struct rte_mbuf **pkts __rte_unused,
+               uint16_t nb_pkts __rte_unused);
+
 /**
  * Allocate an unique switch domain identifier.
  *
index 0205c853df5367af2981f9d7ae65d7e16e134f70..a094585bf71536cded822ee8d0a64c0f37843d00 100644 (file)
@@ -2,6 +2,7 @@
 # Copyright(c) 2017 Intel Corporation
 
 sources = files(
+        'ethdev_driver.c',
         'ethdev_private.c',
         'ethdev_profile.c',
         'ethdev_trace_points.c',
index 1a43282ce45d147beddc628344e3905481d5a434..d5cc56a560234deb3bbc7a5589997db41c8764b1 100644 (file)
@@ -289,6 +289,7 @@ INTERNAL {
        rte_eth_hairpin_queue_peer_unbind;
        rte_eth_hairpin_queue_peer_update;
        rte_eth_ip_reassembly_dynfield_register;
+       rte_eth_pkt_burst_dummy;
        rte_eth_representor_id_get;
        rte_eth_switch_domain_alloc;
        rte_eth_switch_domain_free;