mbox series

[v4,00/15] add hairpin feature

Message ID 1571326337-42692-1-git-send-email-orika@mellanox.com (mailing list archive)
Headers
Series add hairpin feature |

Message

Ori Kam Oct. 17, 2019, 3:32 p.m. UTC
  s patch set implements the hairpin feature.
The hairpin feature was introduced in RFC[1]

The hairpin feature (different name can be forward) acts as "bump on the wire",
meaning that a packet that is received from the wire can be modified using
offloaded action and then sent back to the wire without application intervention
which save CPU cycles.

The hairpin is the inverse function of loopback in which application
sends a packet then it is received again by the
application without being sent to the wire.

The hairpin can be used by a number of different NVF, for example load
balancer, gateway and so on.

As can be seen from the hairpin description, hairpin is basically RX queue
connected to TX queue.

During the design phase I was thinking of two ways to implement this
feature the first one is adding a new rte flow action. and the second
one is create a special kind of queue.

The advantages of using the queue approch:
1. More control for the application. queue depth (the memory size that
should be used).
2. Enable QoS. QoS is normaly a parametr of queue, so in this approch it
will be easy to integrate with such system.
3. Native integression with the rte flow API. Just setting the target
queue/rss to hairpin queue, will result that the traffic will be routed
to the hairpin queue.
4. Enable queue offloading.

Each hairpin Rxq can be connected Txq / number of Txqs which can belong to a
different ports assuming the PMD supports it. The same goes the other
way each hairpin Txq can be connected to one or more Rxqs.
This is the reason that both the Txq setup and Rxq setup are getting the
hairpin configuration structure.

From PMD prespctive the number of Rxq/Txq is the total of standard
queues + hairpin queues.

To configure hairpin queue the user should call
rte_eth_rx_hairpin_queue_setup / rte_eth_tx_hairpin_queue_setup insteed
of the normal queue setup functions.

The hairpin queues are not part of the normal RSS functiosn.

To use the queues the user simply create a flow that points to RSS/queue
actions that are hairpin queues.
The reason for selecting 2 new functions for hairpin queue setup are:
1. avoid API break.
2. avoid extra and unused parameters.


This series must be applied after series[2]

[1] https://inbox.dpdk.org/dev/1565703468-55617-1-git-send-email-orika@mellanox.com/
[2] https://inbox.dpdk.org/dev/1569398015-6027-1-git-send-email-viacheslavo@mellanox.com/

Cc: wenzhuo.lu@intel.com
Cc: bernard.iremonger@intel.com
Cc: thomas@monjalon.net
Cc: ferruh.yigit@intel.com
Cc: arybchenko@solarflare.com
Cc: viacheslavo@mellanox.com

------
V4:
 - update according to comments from ML.

V3:
 - update according to comments from ML.

V2:
 - update according to comments from ML.

Ori Kam (15):
  ethdev: move queue state defines to private file
  ethdev: add support for hairpin queue
  net/mlx5: query hca hairpin capabilities
  net/mlx5: support Rx hairpin queues
  net/mlx5: prepare txq to work with different types
  net/mlx5: support Tx hairpin queues
  net/mlx5: add get hairpin capabilities
  app/testpmd: add hairpin support
  net/mlx5: add hairpin binding function
  net/mlx5: add support for hairpin hrxq
  net/mlx5: add internal tag item and action
  net/mlx5: add id generation function
  net/mlx5: add default flows for hairpin
  net/mlx5: split hairpin flows
  doc: add hairpin feature

 app/test-pmd/parameters.c                |  28 +++
 app/test-pmd/testpmd.c                   | 109 ++++++++-
 app/test-pmd/testpmd.h                   |   3 +
 doc/guides/rel_notes/release_19_11.rst   |   6 +
 drivers/net/mlx5/mlx5.c                  | 170 ++++++++++++-
 drivers/net/mlx5/mlx5.h                  |  69 +++++-
 drivers/net/mlx5/mlx5_devx_cmds.c        | 194 +++++++++++++++
 drivers/net/mlx5/mlx5_ethdev.c           | 129 ++++++++--
 drivers/net/mlx5/mlx5_flow.c             | 393 ++++++++++++++++++++++++++++++-
 drivers/net/mlx5/mlx5_flow.h             |  73 +++++-
 drivers/net/mlx5/mlx5_flow_dv.c          | 231 +++++++++++++++++-
 drivers/net/mlx5/mlx5_flow_verbs.c       |  11 +-
 drivers/net/mlx5/mlx5_prm.h              | 127 +++++++++-
 drivers/net/mlx5/mlx5_rss.c              |   1 +
 drivers/net/mlx5/mlx5_rxq.c              | 318 ++++++++++++++++++++++---
 drivers/net/mlx5/mlx5_rxtx.c             |   2 +-
 drivers/net/mlx5/mlx5_rxtx.h             |  68 +++++-
 drivers/net/mlx5/mlx5_trigger.c          | 140 ++++++++++-
 drivers/net/mlx5/mlx5_txq.c              | 294 +++++++++++++++++++----
 lib/librte_ethdev/rte_ethdev.c           | 229 ++++++++++++++++++
 lib/librte_ethdev/rte_ethdev.h           | 149 +++++++++++-
 lib/librte_ethdev/rte_ethdev_core.h      |  91 ++++++-
 lib/librte_ethdev/rte_ethdev_driver.h    |   7 +
 lib/librte_ethdev/rte_ethdev_version.map |   5 +
 24 files changed, 2677 insertions(+), 170 deletions(-)
  

Comments

Ferruh Yigit Oct. 18, 2019, 7:07 p.m. UTC | #1
On 10/17/2019 4:32 PM, Ori Kam wrote:
> s patch set implements the hairpin feature.
> The hairpin feature was introduced in RFC[1]
> 
> The hairpin feature (different name can be forward) acts as "bump on the wire",
> meaning that a packet that is received from the wire can be modified using
> offloaded action and then sent back to the wire without application intervention
> which save CPU cycles.
> 
> The hairpin is the inverse function of loopback in which application
> sends a packet then it is received again by the
> application without being sent to the wire.
> 
> The hairpin can be used by a number of different NVF, for example load
> balancer, gateway and so on.
> 
> As can be seen from the hairpin description, hairpin is basically RX queue
> connected to TX queue.
> 
> During the design phase I was thinking of two ways to implement this
> feature the first one is adding a new rte flow action. and the second
> one is create a special kind of queue.
> 
> The advantages of using the queue approch:
> 1. More control for the application. queue depth (the memory size that
> should be used).
> 2. Enable QoS. QoS is normaly a parametr of queue, so in this approch it
> will be easy to integrate with such system.
> 3. Native integression with the rte flow API. Just setting the target
> queue/rss to hairpin queue, will result that the traffic will be routed
> to the hairpin queue.
> 4. Enable queue offloading.
> 
> Each hairpin Rxq can be connected Txq / number of Txqs which can belong to a
> different ports assuming the PMD supports it. The same goes the other
> way each hairpin Txq can be connected to one or more Rxqs.
> This is the reason that both the Txq setup and Rxq setup are getting the
> hairpin configuration structure.
> 
> From PMD prespctive the number of Rxq/Txq is the total of standard
> queues + hairpin queues.
> 
> To configure hairpin queue the user should call
> rte_eth_rx_hairpin_queue_setup / rte_eth_tx_hairpin_queue_setup insteed
> of the normal queue setup functions.
> 
> The hairpin queues are not part of the normal RSS functiosn.
> 
> To use the queues the user simply create a flow that points to RSS/queue
> actions that are hairpin queues.
> The reason for selecting 2 new functions for hairpin queue setup are:
> 1. avoid API break.
> 2. avoid extra and unused parameters.
> 
> 
> This series must be applied after series[2]

This dependency already merged right? If so can drop from cover letter.

> 
> [1] https://inbox.dpdk.org/dev/1565703468-55617-1-git-send-email-orika@mellanox.com/
> [2] https://inbox.dpdk.org/dev/1569398015-6027-1-git-send-email-viacheslavo@mellanox.com/
> 
> Cc: wenzhuo.lu@intel.com
> Cc: bernard.iremonger@intel.com
> Cc: thomas@monjalon.net
> Cc: ferruh.yigit@intel.com
> Cc: arybchenko@solarflare.com
> Cc: viacheslavo@mellanox.com
> 
> ------
> V4:
>  - update according to comments from ML.
> 
> V3:
>  - update according to comments from ML.
> 
> V2:
>  - update according to comments from ML.
> 
> Ori Kam (15):
>   ethdev: move queue state defines to private file
>   ethdev: add support for hairpin queue
>   net/mlx5: query hca hairpin capabilities
>   net/mlx5: support Rx hairpin queues
>   net/mlx5: prepare txq to work with different types
>   net/mlx5: support Tx hairpin queues
>   net/mlx5: add get hairpin capabilities
>   app/testpmd: add hairpin support
>   net/mlx5: add hairpin binding function
>   net/mlx5: add support for hairpin hrxq
>   net/mlx5: add internal tag item and action
>   net/mlx5: add id generation function
>   net/mlx5: add default flows for hairpin
>   net/mlx5: split hairpin flows
>   doc: add hairpin feature

There are build error as patchwork status also shows.