[ovs-dev,6/6] dpif-netdev: Accelerate peer port forwarding by bypassing DP processing

Message ID 20190402145712.7290-7-elibr@mellanox.com
State New
Headers show
Series
  • Accelerate peer port forwarding by bypassing DP processing
Related show

Commit Message

Eli Britstein April 2, 2019, 2:57 p.m.
Packet parsing and rule matching introduce a large processing overhead
for simple port-to-port forwarding scenarios. Accelerate port-to-port
forwarding by bypassing the datapath packet processing if a peer-port
property is defined.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
---
 lib/dpif-netdev.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 4d6d0c372..7751805ef 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -759,7 +759,8 @@  static void dp_netdev_execute_actions(struct dp_netdev_pmd_thread *pmd,
                                       const struct nlattr *actions,
                                       size_t actions_len);
 static void dp_netdev_input(struct dp_netdev_pmd_thread *,
-                            struct dp_packet_batch *, odp_port_t port_no);
+                            struct dp_packet_batch *, odp_port_t port_no,
+                            struct netdev_rxq *);
 static void dp_netdev_recirculate(struct dp_netdev_pmd_thread *,
                                   struct dp_packet_batch *);
 
@@ -4271,7 +4272,7 @@  dp_netdev_process_rxq_port(struct dp_netdev_pmd_thread *pmd,
             }
         }
         /* Process packet batch. */
-        dp_netdev_input(pmd, &batch, port_no);
+        dp_netdev_input(pmd, &batch, port_no, rxq->rx);
 
         /* Assign processing cycles to rx queue. */
         cycles = cycle_timer_stop(&pmd->perf_stats, &timer);
@@ -6766,9 +6767,17 @@  dp_netdev_input__(struct dp_netdev_pmd_thread *pmd,
 static void
 dp_netdev_input(struct dp_netdev_pmd_thread *pmd,
                 struct dp_packet_batch *packets,
-                odp_port_t port_no)
+                odp_port_t port_no,
+                struct netdev_rxq *rxq)
 {
-    dp_netdev_input__(pmd, packets, false, port_no);
+    if (!rxq->netdev->peer) {
+        dp_netdev_input__(pmd, packets, false, port_no);
+    } else {
+        /* Bypassing standard DP processing and forward the packets directly
+         * to its peer port */
+        netdev_send(rxq->netdev->peer, rxq->queue_id, packets, true);
+        packets->count = 0;
+    }
 }
 
 static void