diff mbox series

[ovs-dev,15/25] dpif-netdev: Add HW miss packet state recover logic

Message ID 20200120150830.16262-16-elibr@mellanox.com
State Deferred
Delegated to: Ilya Maximets
Headers show
Series netdev datapath vxlan offload | expand

Commit Message

Eli Britstein Jan. 20, 2020, 3:08 p.m. UTC
From: Ophir Munk <ophirmu@mellanox.com>

Mark can have the legacy meaning of flow ID, or the ID for a flow miss
context, that might occur during multiple flows of HW offload. Use HW
miss packet recover callback in case there is a mark, to recover
potential state.

Co-authored-by: Eli Britstein <elibr@mellanox.com>
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Reviewed-by: Roni Bar Yanai <roniba@mellanox.com>
Signed-off-by: Eli Britstein <elibr@mellanox.com>
---
 lib/dpif-netdev.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index bd937f300..5618af0a9 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -6528,6 +6528,10 @@  smc_lookup_batch(struct dp_netdev_pmd_thread *pmd,
     pmd_perf_update_counter(&pmd->perf_stats, PMD_STAT_SMC_HIT, n_smc_hit);
 }
 
+static struct tx_port *
+pmd_send_port_cache_lookup(const struct dp_netdev_pmd_thread *pmd,
+                           odp_port_t port_no);
+
 /* Try to process all ('cnt') the 'packets' using only the datapath flow cache
  * 'pmd->flow_cache'. If a flow is not found for a packet 'packets[i]', the
  * miniflow is copied into 'keys' and the packet pointer is moved at the
@@ -6593,9 +6597,18 @@  dfc_processing(struct dp_netdev_pmd_thread *pmd,
 
         if ((*recirc_depth_get() == 0) &&
             dp_packet_has_flow_mark(packet, &mark)) {
-            flow = mark_to_flow_find(pmd, mark);
+            /* Restore the packet if it was interrupted in the middle
+             * of HW offload processing.
+             */
+            struct tx_port *p;
+            int hw_ret;
+
+            tcp_flags = parse_tcp_flags(packet);
+            p = pmd_send_port_cache_lookup(pmd, port_no);
+            hw_ret = p ? netdev_hw_miss_packet_recover(p->port->netdev, mark,
+                                                       packet) : -1;
+            flow = hw_ret == -1 ? mark_to_flow_find(pmd, mark) : NULL;
             if (OVS_LIKELY(flow)) {
-                tcp_flags = parse_tcp_flags(packet);
                 if (OVS_LIKELY(batch_enable)) {
                     dp_netdev_queue_batches(packet, flow, tcp_flags, batches,
                                             n_batches);