ethdev: use hairpin helper functions
authorFerruh Yigit <ferruh.yigit@intel.com>
Wed, 9 Sep 2020 13:01:46 +0000 (14:01 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 18 Sep 2020 16:55:08 +0000 (18:55 +0200)
Hairpin helper functions were not used by drivers, but it was used only
local to ethdev. They are:
'rte_eth_dev_is_rx_hairpin_queue()'
'rte_eth_dev_is_tx_hairpin_queue()'

Exposing them as internal APIs and update mlx5 driver (only user of
hairpin) to use them.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: David Marchand <david.marchand@redhat.com>
drivers/net/mlx5/mlx5_rxq.c
drivers/net/mlx5/mlx5_txq.c
lib/librte_ethdev/rte_ethdev_driver.h
lib/librte_ethdev/rte_ethdev_version.map

index 0b3e813..487f997 100644 (file)
@@ -547,7 +547,7 @@ mlx5_rx_queue_stop(struct rte_eth_dev *dev, uint16_t idx)
        eth_rx_burst_t pkt_burst = dev->rx_pkt_burst;
        int ret;
 
-       if (dev->data->rx_queue_state[idx] == RTE_ETH_QUEUE_STATE_HAIRPIN) {
+       if (rte_eth_dev_is_rx_hairpin_queue(dev, idx)) {
                DRV_LOG(ERR, "Hairpin queue can't be stopped");
                rte_errno = EINVAL;
                return -EINVAL;
@@ -644,7 +644,7 @@ mlx5_rx_queue_start(struct rte_eth_dev *dev, uint16_t idx)
 {
        int ret;
 
-       if (dev->data->rx_queue_state[idx] == RTE_ETH_QUEUE_STATE_HAIRPIN) {
+       if (rte_eth_dev_is_rx_hairpin_queue(dev, idx)) {
                DRV_LOG(ERR, "Hairpin queue can't be started");
                rte_errno = EINVAL;
                return -EINVAL;
index 66ad368..450d964 100644 (file)
@@ -244,7 +244,7 @@ mlx5_tx_queue_stop(struct rte_eth_dev *dev, uint16_t idx)
 {
        int ret;
 
-       if (dev->data->tx_queue_state[idx] == RTE_ETH_QUEUE_STATE_HAIRPIN) {
+       if (rte_eth_dev_is_tx_hairpin_queue(dev, idx)) {
                DRV_LOG(ERR, "Hairpin queue can't be stopped");
                rte_errno = EINVAL;
                return -EINVAL;
@@ -371,7 +371,7 @@ mlx5_tx_queue_start(struct rte_eth_dev *dev, uint16_t idx)
 {
        int ret;
 
-       if (dev->data->tx_queue_state[idx] == RTE_ETH_QUEUE_STATE_HAIRPIN) {
+       if (rte_eth_dev_is_tx_hairpin_queue(dev, idx)) {
                DRV_LOG(ERR, "Hairpin queue can't be started");
                rte_errno = EINVAL;
                return -EINVAL;
index 3d1bc33..5dfe9fd 100644 (file)
@@ -734,6 +734,7 @@ struct eth_dev_ops {
  * @return
  *   - (1) if the queue is hairpin queue, 0 otherwise.
  */
+__rte_internal
 int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
 
 /**
@@ -748,6 +749,7 @@ int rte_eth_dev_is_rx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
  * @return
  *   - (1) if the queue is hairpin queue, 0 otherwise.
  */
+__rte_internal
 int rte_eth_dev_is_tx_hairpin_queue(struct rte_eth_dev *dev, uint16_t queue_id);
 
 /**
index 4ade809..6f42234 100644 (file)
@@ -237,6 +237,8 @@ INTERNAL {
        rte_eth_dev_attach_secondary;
        rte_eth_dev_create;
        rte_eth_dev_destroy;
+       rte_eth_dev_is_rx_hairpin_queue;
+       rte_eth_dev_is_tx_hairpin_queue;
        rte_eth_dev_probing_finish;
        rte_eth_dev_release_port;
        rte_eth_devargs_parse;