[ovs-dev] [PATCH V7 01/13] netdev-offload: Add HW miss packet state recover API.

Eli Britstein elibr at nvidia.com
Wed Jun 23 15:52:40 UTC 2021


When the HW offload involves multiple flows, like in tunnel decap path,
it is possible that not all flows in the path are offloaded, resulting
in partial processing in HW. In order to proceed with rest of the
processing in SW, the packet state has to be recovered as if it was
processed in SW from the beginning. In the case of tunnel decap,
potential state to recover could be the outer tunneling layer to
metadata.
Add an API for that.

Signed-off-by: Eli Britstein <elibr at nvidia.com>
Reviewed-by: Gaetan Rivet <gaetanr at nvidia.com>
Acked-by: Sriharsha Basavapatna <sriharsha.basavapatna at broadcom.com>
Tested-by: Emma Finn <emma.finn at intel.com>
Tested-by: Marko Kovacevic <marko.kovacevic at intel.com>
Signed-off-by: Ilya Maximets <i.maximets at ovn.org>
---
 lib/netdev-offload-provider.h |  6 ++++++
 lib/netdev-offload.c          | 12 ++++++++++++
 lib/netdev-offload.h          |  1 +
 3 files changed, 19 insertions(+)

diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
index cf859d1b4..348ca7081 100644
--- a/lib/netdev-offload-provider.h
+++ b/lib/netdev-offload-provider.h
@@ -87,6 +87,12 @@ struct netdev_flow_api {
      * Return 0 if successful, otherwise returns a positive errno value. */
     int (*flow_get_n_flows)(struct netdev *, uint64_t *n_flows);
 
+    /* Recover the packet state (contents and data) for continued processing
+     * in software.
+     * Return 0 if successful, otherwise returns a positive errno value and
+     * takes ownership of a packet if errno != EOPNOTSUPP. */
+    int (*hw_miss_packet_recover)(struct netdev *, struct dp_packet *);
+
     /* Initializies the netdev flow api.
      * Return 0 if successful, otherwise returns a positive errno value. */
     int (*init_flow_api)(struct netdev *);
diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
index 6237667c3..e5d24651f 100644
--- a/lib/netdev-offload.c
+++ b/lib/netdev-offload.c
@@ -253,6 +253,18 @@ netdev_flow_put(struct netdev *netdev, struct match *match,
            : EOPNOTSUPP;
 }
 
+int
+netdev_hw_miss_packet_recover(struct netdev *netdev,
+                              struct dp_packet *packet)
+{
+    const struct netdev_flow_api *flow_api =
+        ovsrcu_get(const struct netdev_flow_api *, &netdev->flow_api);
+
+    return (flow_api && flow_api->hw_miss_packet_recover)
+            ? flow_api->hw_miss_packet_recover(netdev, packet)
+            : EOPNOTSUPP;
+}
+
 int
 netdev_flow_get(struct netdev *netdev, struct match *match,
                 struct nlattr **actions, const ovs_u128 *ufid,
diff --git a/lib/netdev-offload.h b/lib/netdev-offload.h
index 18b48790f..b063c43a3 100644
--- a/lib/netdev-offload.h
+++ b/lib/netdev-offload.h
@@ -89,6 +89,7 @@ bool netdev_flow_dump_next(struct netdev_flow_dump *, struct match *,
 int netdev_flow_put(struct netdev *, struct match *, struct nlattr *actions,
                     size_t actions_len, const ovs_u128 *,
                     struct offload_info *, struct dpif_flow_stats *);
+int netdev_hw_miss_packet_recover(struct netdev *, struct dp_packet *);
 int netdev_flow_get(struct netdev *, struct match *, struct nlattr **actions,
                     const ovs_u128 *, struct dpif_flow_stats *,
                     struct dpif_flow_attrs *, struct ofpbuf *wbuffer);
-- 
2.28.0.2311.g225365fb51



More information about the dev mailing list