diff mbox series

[ovs-dev,13/25] netdev-offload: Add HW miss packet state recover API

Message ID 20200120150830.16262-14-elibr@mellanox.com
State Under Review
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: Oz Shlomo <ozsh@mellanox.com>

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 the rest of the
processing in SW, the packet has to be recovered to its state as if it
was processed in SW from the beginning of the path. Add API for that.

Co-authored-by: Ophir Munk <ophirmu@mellanox.com>
Co-authored-by: Eli Britstein <elibr@mellanox.com>
Signed-off-by: Oz Shlomo <ozsh@mellanox.com>
Reviewed-by: Roni Bar Yanai <roniba@mellanox.com>
Signed-off-by: Eli Britstein <elibr@mellanox.com>
---
 lib/netdev-offload-provider.h |  6 ++++++
 lib/netdev-offload.c          | 14 ++++++++++++++
 lib/netdev-offload.h          |  3 +++
 3 files changed, 23 insertions(+)

Comments

0-day Robot Jan. 20, 2020, 4:36 p.m. UTC | #1
Bleep bloop.  Greetings Eli Britstein, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
ERROR: Co-author Ophir Munk <ophirmu@mellanox.com> needs to sign off.
Lines checked: 81, Warnings: 0, Errors: 1


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
index 5a809c0cd..22de2247e 100644
--- a/lib/netdev-offload-provider.h
+++ b/lib/netdev-offload-provider.h
@@ -82,6 +82,12 @@  struct netdev_flow_api {
     int (*flow_del)(struct netdev *, const ovs_u128 *ufid,
                     struct dpif_flow_stats *);
 
+    /* Recover the packet state (contents and data) for continued processing
+     * in software.
+     * Return 0 if successful, otherwise returns a positive errno value. */
+    int (*hw_miss_packet_recover)(struct netdev *, uint32_t flow_miss_ctx_id,
+                                  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 3469b71c6..7c24ecb75 100644
--- a/lib/netdev-offload.c
+++ b/lib/netdev-offload.c
@@ -255,6 +255,20 @@  netdev_flow_put(struct netdev *netdev, struct match *match,
            : EOPNOTSUPP;
 }
 
+int
+netdev_hw_miss_packet_recover(struct netdev *netdev,
+                              uint32_t flow_miss_ctx_id,
+                              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, flow_miss_ctx_id,
+                                               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 25ff308df..3b5e636f0 100644
--- a/lib/netdev-offload.h
+++ b/lib/netdev-offload.h
@@ -87,6 +87,9 @@  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 *netdev,
+                                  uint32_t flow_miss_ctx_id,
+                                  struct dp_packet *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);