ethdev: introduce generic dummy packet burst function
Checks
Commit Message
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>
---
Cc: Ciara Loftus <ciara.loftus@intel.com>
---
drivers/net/ark/ark_ethdev.c | 8 ++---
drivers/net/ark/ark_ethdev_rx.c | 9 -----
drivers/net/ark/ark_ethdev_rx.h | 2 --
drivers/net/ark/ark_ethdev_tx.c | 9 -----
drivers/net/ark/ark_ethdev_tx.h | 3 --
drivers/net/bnx2x/bnx2x_rxtx.c | 12 ++-----
drivers/net/bnxt/bnxt.h | 4 ---
drivers/net/bnxt/bnxt_cpr.c | 4 +--
drivers/net/bnxt/bnxt_rxr.c | 14 --------
drivers/net/bnxt/bnxt_txr.c | 14 --------
drivers/net/cnxk/cnxk_ethdev.c | 14 ++------
drivers/net/dpaa2/dpaa2_ethdev.c | 2 +-
drivers/net/dpaa2/dpaa2_ethdev.h | 1 -
drivers/net/dpaa2/dpaa2_rxtx.c | 25 --------------
drivers/net/enic/enic.h | 3 --
drivers/net/enic/enic_ethdev.c | 2 +-
drivers/net/enic/enic_main.c | 2 +-
drivers/net/enic/enic_rxtx.c | 11 ------
drivers/net/hns3/hns3_rxtx.c | 18 +++-------
drivers/net/hns3/hns3_rxtx.h | 3 --
drivers/net/mlx4/mlx4.c | 8 ++---
drivers/net/mlx4/mlx4_mp.c | 4 +--
drivers/net/mlx4/mlx4_rxtx.c | 52 -----------------------------
drivers/net/mlx4/mlx4_rxtx.h | 4 ---
drivers/net/mlx5/linux/mlx5_mp_os.c | 4 +--
drivers/net/mlx5/linux/mlx5_os.c | 4 +--
drivers/net/mlx5/mlx5.c | 4 +--
drivers/net/mlx5/mlx5_rx.c | 27 +--------------
drivers/net/mlx5/mlx5_rx.h | 2 --
drivers/net/mlx5/mlx5_trigger.c | 4 +--
drivers/net/mlx5/mlx5_tx.c | 25 --------------
drivers/net/mlx5/mlx5_tx.h | 2 --
drivers/net/mlx5/windows/mlx5_os.c | 4 +--
drivers/net/pfe/pfe_ethdev.c | 20 ++---------
drivers/net/qede/qede_ethdev.c | 4 +--
drivers/net/qede/qede_rxtx.c | 9 -----
drivers/net/qede/qede_rxtx.h | 3 --
lib/ethdev/ethdev_driver.h | 19 +++++++++++
38 files changed, 58 insertions(+), 301 deletions(-)
Comments
> Subject: [PATCH] ethdev: introduce generic dummy packet burst function
>
> 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>
> ---
> Cc: Ciara Loftus <ciara.loftus@intel.com>
> ---
[snip]
> diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
> index 3f3c4a7c7214..910b76a92c42 100644
> --- a/drivers/net/mlx4/mlx4.c
> +++ b/drivers/net/mlx4/mlx4.c
> @@ -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);
> diff --git a/drivers/net/mlx4/mlx4_mp.c b/drivers/net/mlx4/mlx4_mp.c
> index 8fcfb5490ee9..1da64910aadd 100644
> --- a/drivers/net/mlx4/mlx4_mp.c
> +++ b/drivers/net/mlx4/mlx4_mp.c
> @@ -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;
> diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c
> index ed9e41fcdea9..059e432a63fc 100644
> --- a/drivers/net/mlx4/mlx4_rxtx.c
> +++ b/drivers/net/mlx4/mlx4_rxtx.c
> @@ -1338,55 +1338,3 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf
> **pkts, uint16_t pkts_n)
> 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();
The mlx4 and mlx5 PMDs lose a call to rte_mb() when switching over to the new dummy functions. Maybe the maintainer can comment on whether that's an issue or not? Other than that LGTM.
Ciara
> - 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;
> -}
> diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h
> index 83e9534cd0a7..70f3cd868058 100644
> --- a/drivers/net/mlx4/mlx4_rxtx.h
> +++ b/drivers/net/mlx4/mlx4_rxtx.h
> @@ -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 */
>
> diff --git a/drivers/net/mlx5/linux/mlx5_mp_os.c
> b/drivers/net/mlx5/linux/mlx5_mp_os.c
> index c448a3e9eb87..e607089e0e20 100644
> --- a/drivers/net/mlx5/linux/mlx5_mp_os.c
> +++ b/drivers/net/mlx5/linux/mlx5_mp_os.c
> @@ -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;
> diff --git a/drivers/net/mlx5/linux/mlx5_os.c
> b/drivers/net/mlx5/linux/mlx5_os.c
> index aecdc5a68abb..bbe05bb837e0 100644
> --- a/drivers/net/mlx5/linux/mlx5_os.c
> +++ b/drivers/net/mlx5/linux/mlx5_os.c
> @@ -1623,8 +1623,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;
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index 67eda41a60a5..5571e9067787 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -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);
> diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
> index f388fcc31395..11ea935d72f0 100644
> --- a/drivers/net/mlx5/mlx5_rx.c
> +++ b/drivers/net/mlx5/mlx5_rx.c
> @@ -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.
> diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h
> index cb5d51340db7..7e417819f7e8 100644
> --- a/drivers/net/mlx5/mlx5_rx.h
> +++ b/drivers/net/mlx5/mlx5_rx.h
> @@ -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,
> diff --git a/drivers/net/mlx5/mlx5_trigger.c
> b/drivers/net/mlx5/mlx5_trigger.c
> index 74c9c0a4fff8..3a59237b1a7a 100644
> --- a/drivers/net/mlx5/mlx5_trigger.c
> +++ b/drivers/net/mlx5/mlx5_trigger.c
> @@ -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);
> diff --git a/drivers/net/mlx5/mlx5_tx.c b/drivers/net/mlx5/mlx5_tx.c
> index fd2cf2096753..8453b2701a9f 100644
> --- a/drivers/net/mlx5/mlx5_tx.c
> +++ b/drivers/net/mlx5/mlx5_tx.c
> @@ -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.
> diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h
> index 099e72935a3a..31eb0a1ce28e 100644
> --- a/drivers/net/mlx5/mlx5_tx.h
> +++ b/drivers/net/mlx5/mlx5_tx.h
> @@ -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);
> diff --git a/drivers/net/mlx5/windows/mlx5_os.c
> b/drivers/net/mlx5/windows/mlx5_os.c
> index ac0af0ff7d43..7f3532426f1f 100644
> --- a/drivers/net/mlx5/windows/mlx5_os.c
> +++ b/drivers/net/mlx5/windows/mlx5_os.c
> @@ -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;
> diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
> index edf32aa70da6..c2991ab1ccaa 100644
> --- a/drivers/net/pfe/pfe_ethdev.c
> +++ b/drivers/net/pfe/pfe_ethdev.c
> @@ -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;
> }
> diff --git a/drivers/net/qede/qede_ethdev.c
> b/drivers/net/qede/qede_ethdev.c
> index a1122a297e6b..ea6b71f09355 100644
> --- a/drivers/net/qede/qede_ethdev.c
> +++ b/drivers/net/qede/qede_ethdev.c
> @@ -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;
> }
>
> diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
> index 7088c57b501d..85784f4a82a6 100644
> --- a/drivers/net/qede/qede_rxtx.c
> +++ b/drivers/net/qede/qede_rxtx.c
> @@ -2734,15 +2734,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.
> diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h
> index 11ed1d9b9c50..013a4a07c716 100644
> --- a/drivers/net/qede/qede_rxtx.h
> +++ b/drivers/net/qede/qede_rxtx.h
> @@ -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.h b/lib/ethdev/ethdev_driver.h
> index 8f0ac0adf0ae..075f97a4b37a 100644
> --- a/lib/ethdev/ethdev_driver.h
> +++ b/lib/ethdev/ethdev_driver.h
> @@ -1432,6 +1432,25 @@ 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
> + */
> +static inline 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;
> +}
> +
> /**
> * Allocate an unique switch domain identifier.
> *
> --
> 2.34.1
On 2/10/2022 7:38 AM, Loftus, Ciara wrote:
>> Subject: [PATCH] ethdev: introduce generic dummy packet burst function
>>
>> 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>
>> ---
>> Cc: Ciara Loftus <ciara.loftus@intel.com>
>> ---
>
> [snip]
>
>> diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
>> index 3f3c4a7c7214..910b76a92c42 100644
>> --- a/drivers/net/mlx4/mlx4.c
>> +++ b/drivers/net/mlx4/mlx4.c
>> @@ -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);
>> diff --git a/drivers/net/mlx4/mlx4_mp.c b/drivers/net/mlx4/mlx4_mp.c
>> index 8fcfb5490ee9..1da64910aadd 100644
>> --- a/drivers/net/mlx4/mlx4_mp.c
>> +++ b/drivers/net/mlx4/mlx4_mp.c
>> @@ -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;
>> diff --git a/drivers/net/mlx4/mlx4_rxtx.c b/drivers/net/mlx4/mlx4_rxtx.c
>> index ed9e41fcdea9..059e432a63fc 100644
>> --- a/drivers/net/mlx4/mlx4_rxtx.c
>> +++ b/drivers/net/mlx4/mlx4_rxtx.c
>> @@ -1338,55 +1338,3 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf
>> **pkts, uint16_t pkts_n)
>> 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();
>
> The mlx4 and mlx5 PMDs lose a call to rte_mb() when switching over to the new dummy functions. Maybe the maintainer can comment on whether that's an issue or not? Other than that LGTM.
>
I wasn't also sure why dummy Rx/Tx needs meeory barrier.
Matan, Slava, can you please comment?
> Ciara
>
>> - 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;
>> -}
>> diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h
>> index 83e9534cd0a7..70f3cd868058 100644
>> --- a/drivers/net/mlx4/mlx4_rxtx.h
>> +++ b/drivers/net/mlx4/mlx4_rxtx.h
>> @@ -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 */
>>
>> diff --git a/drivers/net/mlx5/linux/mlx5_mp_os.c
>> b/drivers/net/mlx5/linux/mlx5_mp_os.c
>> index c448a3e9eb87..e607089e0e20 100644
>> --- a/drivers/net/mlx5/linux/mlx5_mp_os.c
>> +++ b/drivers/net/mlx5/linux/mlx5_mp_os.c
>> @@ -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;
>> diff --git a/drivers/net/mlx5/linux/mlx5_os.c
>> b/drivers/net/mlx5/linux/mlx5_os.c
>> index aecdc5a68abb..bbe05bb837e0 100644
>> --- a/drivers/net/mlx5/linux/mlx5_os.c
>> +++ b/drivers/net/mlx5/linux/mlx5_os.c
>> @@ -1623,8 +1623,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;
>> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
>> index 67eda41a60a5..5571e9067787 100644
>> --- a/drivers/net/mlx5/mlx5.c
>> +++ b/drivers/net/mlx5/mlx5.c
>> @@ -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);
>> diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
>> index f388fcc31395..11ea935d72f0 100644
>> --- a/drivers/net/mlx5/mlx5_rx.c
>> +++ b/drivers/net/mlx5/mlx5_rx.c
>> @@ -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.
>> diff --git a/drivers/net/mlx5/mlx5_rx.h b/drivers/net/mlx5/mlx5_rx.h
>> index cb5d51340db7..7e417819f7e8 100644
>> --- a/drivers/net/mlx5/mlx5_rx.h
>> +++ b/drivers/net/mlx5/mlx5_rx.h
>> @@ -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,
>> diff --git a/drivers/net/mlx5/mlx5_trigger.c
>> b/drivers/net/mlx5/mlx5_trigger.c
>> index 74c9c0a4fff8..3a59237b1a7a 100644
>> --- a/drivers/net/mlx5/mlx5_trigger.c
>> +++ b/drivers/net/mlx5/mlx5_trigger.c
>> @@ -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);
>> diff --git a/drivers/net/mlx5/mlx5_tx.c b/drivers/net/mlx5/mlx5_tx.c
>> index fd2cf2096753..8453b2701a9f 100644
>> --- a/drivers/net/mlx5/mlx5_tx.c
>> +++ b/drivers/net/mlx5/mlx5_tx.c
>> @@ -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.
>> diff --git a/drivers/net/mlx5/mlx5_tx.h b/drivers/net/mlx5/mlx5_tx.h
>> index 099e72935a3a..31eb0a1ce28e 100644
>> --- a/drivers/net/mlx5/mlx5_tx.h
>> +++ b/drivers/net/mlx5/mlx5_tx.h
>> @@ -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);
>> diff --git a/drivers/net/mlx5/windows/mlx5_os.c
>> b/drivers/net/mlx5/windows/mlx5_os.c
>> index ac0af0ff7d43..7f3532426f1f 100644
>> --- a/drivers/net/mlx5/windows/mlx5_os.c
>> +++ b/drivers/net/mlx5/windows/mlx5_os.c
>> @@ -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;
>> diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
>> index edf32aa70da6..c2991ab1ccaa 100644
>> --- a/drivers/net/pfe/pfe_ethdev.c
>> +++ b/drivers/net/pfe/pfe_ethdev.c
>> @@ -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;
>> }
>> diff --git a/drivers/net/qede/qede_ethdev.c
>> b/drivers/net/qede/qede_ethdev.c
>> index a1122a297e6b..ea6b71f09355 100644
>> --- a/drivers/net/qede/qede_ethdev.c
>> +++ b/drivers/net/qede/qede_ethdev.c
>> @@ -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;
>> }
>>
>> diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
>> index 7088c57b501d..85784f4a82a6 100644
>> --- a/drivers/net/qede/qede_rxtx.c
>> +++ b/drivers/net/qede/qede_rxtx.c
>> @@ -2734,15 +2734,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.
>> diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h
>> index 11ed1d9b9c50..013a4a07c716 100644
>> --- a/drivers/net/qede/qede_rxtx.h
>> +++ b/drivers/net/qede/qede_rxtx.h
>> @@ -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.h b/lib/ethdev/ethdev_driver.h
>> index 8f0ac0adf0ae..075f97a4b37a 100644
>> --- a/lib/ethdev/ethdev_driver.h
>> +++ b/lib/ethdev/ethdev_driver.h
>> @@ -1432,6 +1432,25 @@ 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
>> + */
>> +static inline 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;
>> +}
>> +
>> /**
>> * Allocate an unique switch domain identifier.
>> *
>> --
>> 2.34.1
>
> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> Sent: Tuesday, 8 February 2022 20.45
>
> 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>
After briefly considering if the dummy TX should free the burst, I concluded that the current behavior is correct.
Good clean-up. :-)
Acked-by: Morten Brørup <mb@smartsharesystems.com>
On 2/10/22 14:04, Morten Brørup wrote:
>> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
>> Sent: Tuesday, 8 February 2022 20.45
>>
>> 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>
>
> After briefly considering if the dummy TX should free the burst, I concluded that the current behavior is correct.
Could you share your thoughts, please. I'm wondering as well.
>
> Good clean-up. :-)
>
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
>
> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> Sent: Thursday, 10 February 2022 12.39
>
> On 2/10/22 14:04, Morten Brørup wrote:
> >> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> >> Sent: Tuesday, 8 February 2022 20.45
> >>
> >> 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>
> >
> > After briefly considering if the dummy TX should free the burst, I
> concluded that the current behavior is correct.
>
> Could you share your thoughts, please. I'm wondering as well.
Returning 0 means that the packets were not transmitted.
This leaves it up to the application to decide what to do: drop or retransmit.
If the dummy TX function frees the burst, it would effectively mean that the driver dropped the packets. (In that case, some drop counters should probably also be updated in the driver; but that is irrelevant now.)
Not dropping the packets could be significant during startup.
>
> >
> > Good clean-up. :-)
> >
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> >
>
On 2/10/22 14:47, Morten Brørup wrote:
>> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
>> Sent: Thursday, 10 February 2022 12.39
>>
>> On 2/10/22 14:04, Morten Brørup wrote:
>>>> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
>>>> Sent: Tuesday, 8 February 2022 20.45
>>>>
>>>> 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>
>>>
>>> After briefly considering if the dummy TX should free the burst, I
>> concluded that the current behavior is correct.
>>
>> Could you share your thoughts, please. I'm wondering as well.
>
> Returning 0 means that the packets were not transmitted.
>
> This leaves it up to the application to decide what to do: drop or retransmit.
>
> If the dummy TX function frees the burst, it would effectively mean that the driver dropped the packets. (In that case, some drop counters should probably also be updated in the driver; but that is irrelevant now.)
Makes sense, thank you.
>
> Not dropping the packets could be significant during startup.
>
>>
>>>
>>> Good clean-up. :-)
>>>
>>> Acked-by: Morten Brørup <mb@smartsharesystems.com>
>>>
>>
>
On 2/8/2022 7:44 PM, Ferruh Yigit wrote:
> diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
> index aecdc5a68abb..bbe05bb837e0 100644
> --- a/drivers/net/mlx5/linux/mlx5_os.c
> +++ b/drivers/net/mlx5/linux/mlx5_os.c
> @@ -1623,8 +1623,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;
> diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> index 67eda41a60a5..5571e9067787 100644
> --- a/drivers/net/mlx5/mlx5.c
> +++ b/drivers/net/mlx5/mlx5.c
> @@ -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);
> diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
> index f388fcc31395..11ea935d72f0 100644
> --- a/drivers/net/mlx5/mlx5_rx.c
> +++ b/drivers/net/mlx5/mlx5_rx.c
> @@ -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;
> }
Thinking twice I am not sure if above change works.
Since function is in the header file, and the .c file that assign
the 'dev->rx_pkt_burst' and the .c file that check function pointer
are different, these two different instance of same function may
have different addresses and above check may fail when it should match.
I guess solution is move the function to a .c file and export it
internally.
I was thinking to add ethdev_driver.c file, perhaps this can be
a motivation to start that file.
Thomas, Andrew, what do you think about ethdev_driver.c file?
Hi,
For mlx4/mlx5 tx_burst we build hardware descriptors, push ones into hardware and write
doorbell register. The doorbell register can be mapped by mlx4/mlx5 into user space either
with non-cache or with write-combining (just regular attribute) memory attributes.
The write-combining mapping requires the explicit memory barrier to push the written
data to the destination hardware, it takes noticeable time and PMDs try to optimize out.
mlx4 just does not perform wmb after the doorbelling, it is always supposed it will happen
on the next call.
For mlx5 we have the very special Tx doorbelling mode (explicitly controlled via "tx_db_nc" devarg)
to skip the last wmb in tx_burst routine. The user requesting this should understand all risks
and take countermeasures in application if he/she cares about packet drops on queue/device stop.
In the worst case, if wmb is postponed (even never happens anymore) it just causes
the increased send latency for the packets in the last burst. If queue stop happens during
the "non-promoted doorbell time period" the last burst packets might be dropped (and we suppose
this is not crucial for service being terminated)
To summarize:
- mlx4 is in moderate risk of final send burst packet drop (we've never seen this in practice, just did not check though)
- mlx5 is in minor risk of final send burst packet drop (in very special mode only, and we observed latency issues in practice), can be disregarded
- barrier in dummy routine does not fully resolve this mlx specific issue (not invoked in guaranteed way on right core)
My conclusion - I would prefer to keep barrier in dummy, "just for the case", but have no strong objections about removing,
we can accept the patch being discussed.
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
With best regards,
Slava
> -----Original Message-----
> From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> Sent: Thursday, February 10, 2022 13:52
> To: Morten Brørup <mb@smartsharesystems.com>; Ferruh Yigit
> <ferruh.yigit@intel.com>; Shepard Siegel <shepard.siegel@atomicrules.com>;
> Ed Czeck <ed.czeck@atomicrules.com>; John Miller
> <john.miller@atomicrules.com>; Rasesh Mody <rmody@marvell.com>;
> Shahed Shaikh <shshaikh@marvell.com>; Ajit Khaparde
> <ajit.khaparde@broadcom.com>; Somnath Kotur
> <somnath.kotur@broadcom.com>; Nithin Dabilpuram
> <ndabilpuram@marvell.com>; Kiran Kumar K <kirankumark@marvell.com>;
> Sunil Kumar Kori <skori@marvell.com>; Satha Rao
> <skoteshwar@marvell.com>; Hemant Agrawal <hemant.agrawal@nxp.com>;
> Sachin Saxena <sachin.saxena@oss.nxp.com>; John Daley
> <johndale@cisco.com>; Hyong Youb Kim <hyonkim@cisco.com>; Min Hu
> (Connor) <humin29@huawei.com>; Yisen Zhuang
> <yisen.zhuang@huawei.com>; Lijun Ou <oulijun@huawei.com>; Matan Azrad
> <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> Gagandeep Singh <g.singh@nxp.com>; Devendra Singh Rawat
> <dsinghrawat@marvell.com>; NBU-Contact-Thomas Monjalon (EXTERNAL)
> <thomas@monjalon.net>
> Cc: dev@dpdk.org; Ciara Loftus <ciara.loftus@intel.com>
> Subject: Re: [PATCH] ethdev: introduce generic dummy packet burst function
>
> On 2/10/22 14:47, Morten Brørup wrote:
> >> From: Andrew Rybchenko [mailto:andrew.rybchenko@oktetlabs.ru]
> >> Sent: Thursday, 10 February 2022 12.39
> >>
> >> On 2/10/22 14:04, Morten Brørup wrote:
> >>>> From: Ferruh Yigit [mailto:ferruh.yigit@intel.com]
> >>>> Sent: Tuesday, 8 February 2022 20.45
> >>>>
> >>>> 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>
> >>>
> >>> After briefly considering if the dummy TX should free the burst, I
> >> concluded that the current behavior is correct.
> >>
> >> Could you share your thoughts, please. I'm wondering as well.
> >
> > Returning 0 means that the packets were not transmitted.
> >
> > This leaves it up to the application to decide what to do: drop or retransmit.
> >
> > If the dummy TX function frees the burst, it would effectively mean that the
> driver dropped the packets. (In that case, some drop counters should
> probably also be updated in the driver; but that is irrelevant now.)
>
> Makes sense, thank you.
>
> >
> > Not dropping the packets could be significant during startup.
> >
> >>
> >>>
> >>> Good clean-up. :-)
> >>>
> >>> Acked-by: Morten Brørup <mb@smartsharesystems.com>
> >>>
> >>
> >
On Thu, 10 Feb 2022 13:58:43 +0000
Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> On 2/8/2022 7:44 PM, Ferruh Yigit wrote:
> > diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
> > index aecdc5a68abb..bbe05bb837e0 100644
> > --- a/drivers/net/mlx5/linux/mlx5_os.c
> > +++ b/drivers/net/mlx5/linux/mlx5_os.c
> > @@ -1623,8 +1623,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;
> > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
> > index 67eda41a60a5..5571e9067787 100644
> > --- a/drivers/net/mlx5/mlx5.c
> > +++ b/drivers/net/mlx5/mlx5.c
> > @@ -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);
> > diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
> > index f388fcc31395..11ea935d72f0 100644
> > --- a/drivers/net/mlx5/mlx5_rx.c
> > +++ b/drivers/net/mlx5/mlx5_rx.c
> > @@ -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;
> > }
>
> Thinking twice I am not sure if above change works.
>
> Since function is in the header file, and the .c file that assign
> the 'dev->rx_pkt_burst' and the .c file that check function pointer
> are different, these two different instance of same function may
> have different addresses and above check may fail when it should match.
>
> I guess solution is move the function to a .c file and export it
> internally.
> I was thinking to add ethdev_driver.c file, perhaps this can be
> a motivation to start that file.
> Thomas, Andrew, what do you think about ethdev_driver.c file?
Right putting it the header file ends up with multiple copies of same
code compiled into each driver.
10/02/2022 17:30, Stephen Hemminger:
> On Thu, 10 Feb 2022 13:58:43 +0000
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > On 2/8/2022 7:44 PM, Ferruh Yigit wrote:
> > > --- a/drivers/net/mlx5/mlx5.c
> > > +++ b/drivers/net/mlx5/mlx5.c
> > > @@ -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);
> > > diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
> > > index f388fcc31395..11ea935d72f0 100644
> > > --- a/drivers/net/mlx5/mlx5_rx.c
> > > +++ b/drivers/net/mlx5/mlx5_rx.c
> > > @@ -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;
> > > }
> >
> > Thinking twice I am not sure if above change works.
> >
> > Since function is in the header file, and the .c file that assign
> > the 'dev->rx_pkt_burst' and the .c file that check function pointer
> > are different, these two different instance of same function may
> > have different addresses and above check may fail when it should match.
> >
> > I guess solution is move the function to a .c file and export it
> > internally.
> > I was thinking to add ethdev_driver.c file, perhaps this can be
> > a motivation to start that file.
> > Thomas, Andrew, what do you think about ethdev_driver.c file?
>
> Right putting it the header file ends up with multiple copies of same
> code compiled into each driver.
I'm OK with introducing such .c 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 = ð_ark_recv_pkts_noop;
- dev->tx_pkt_burst = ð_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 = ð_ark_recv_pkts_noop;
- dev->tx_pkt_burst = ð_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++) {
@@ -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,
@@ -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);
@@ -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)
@@ -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);
@@ -465,18 +465,10 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
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)
@@ -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;
@@ -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;
@@ -1147,20 +1147,6 @@ uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
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;
@@ -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;
@@ -942,16 +942,6 @@ nix_restore_queue_cfg(struct rte_eth_dev *eth_dev)
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)
{
@@ -962,8 +952,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();
}
@@ -2005,7 +2005,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.
@@ -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;
@@ -1802,31 +1802,6 @@ dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
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"
@@ -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,
@@ -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)
@@ -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();
@@ -31,17 +31,6 @@
#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)
@@ -4383,14 +4383,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)
{
@@ -4432,14 +4424,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;
}
@@ -4632,7 +4624,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;
@@ -4742,7 +4734,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);
@@ -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,
@@ -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);
@@ -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;
@@ -1338,55 +1338,3 @@ mlx4_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n)
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;
-}
@@ -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 */
@@ -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;
@@ -1623,8 +1623,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;
@@ -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);
@@ -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.
@@ -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,
@@ -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);
@@ -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.
@@ -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);
@@ -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;
@@ -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;
}
@@ -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;
}
@@ -2734,15 +2734,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.
@@ -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);
@@ -1432,6 +1432,25 @@ 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
+ */
+static inline 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;
+}
+
/**
* Allocate an unique switch domain identifier.
*