diff mbox series

[ovs-dev,V2,01/14] netdev-offload: Add HW miss packet state recover API

Message ID 20210210152702.4898-2-elibr@nvidia.com
State New
Headers show
Series Netdev vxlan-decap offload | expand

Commit Message

Eli Britstein Feb. 10, 2021, 3:26 p.m. UTC
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. Add API for that.

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Reviewed-by: Gaetan Rivet <gaetanr@nvidia.com>
---
 lib/netdev-offload-provider.h |  5 +++++
 lib/netdev-offload.c          | 12 ++++++++++++
 lib/netdev-offload.h          |  1 +
 3 files changed, 18 insertions(+)

Comments

Sriharsha Basavapatna Feb. 23, 2021, 1:10 p.m. UTC | #1
On Wed, Feb 10, 2021 at 8:57 PM Eli Britstein <elibr@nvidia.com> wrote:
>
> 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. Add API for that.

Can you be more specific/clear on what this API does ? What specific
packet state is this referring to and what is meant by recovering the
state here ? For example, if recovering  the packet state means to
check if the packet is encapsulated and to pop the tunnel header, then
it would make it clear to just state that.
Thanks,
-Harsha



>
> Signed-off-by: Eli Britstein <elibr@nvidia.com>
> Reviewed-by: Gaetan Rivet <gaetanr@nvidia.com>
> ---
>  lib/netdev-offload-provider.h |  5 +++++
>  lib/netdev-offload.c          | 12 ++++++++++++
>  lib/netdev-offload.h          |  1 +
>  3 files changed, 18 insertions(+)
>
> diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
> index cf859d1b4..f24c7dd19 100644
> --- a/lib/netdev-offload-provider.h
> +++ b/lib/netdev-offload-provider.h
> @@ -87,6 +87,11 @@ 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. */
> +    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.546.g385c171
>
Eli Britstein Feb. 23, 2021, 1:20 p.m. UTC | #2
On 2/23/2021 3:10 PM, Sriharsha Basavapatna wrote:
> On Wed, Feb 10, 2021 at 8:57 PM Eli Britstein<elibr@nvidia.com>  wrote:
>> 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. Add API for that.
> Can you be more specific/clear on what this API does ? What specific
> packet state is this referring to and what is meant by recovering the
> state here ? For example, if recovering  the packet state means to
> check if the packet is encapsulated and to pop the tunnel header, then
> it would make it clear to just state that.
> Thanks,
> -Harsha

The state refers to the state provided by the HW. This patch introduces 
a generic API to support all cases.

The case to pop in SW in case the info provided is that the packet is 
encapsulated is a private case.

>
>
>
Sriharsha Basavapatna Feb. 25, 2021, 7:34 a.m. UTC | #3
On Tue, Feb 23, 2021 at 6:51 PM Eli Britstein <elibr@nvidia.com> wrote:
>
>
> On 2/23/2021 3:10 PM, Sriharsha Basavapatna wrote:
>
> On Wed, Feb 10, 2021 at 8:57 PM Eli Britstein <elibr@nvidia.com> wrote:
>
> 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. Add API for that.
>
> Can you be more specific/clear on what this API does ? What specific
> packet state is this referring to and what is meant by recovering the
> state here ? For example, if recovering  the packet state means to
> check if the packet is encapsulated and to pop the tunnel header, then
> it would make it clear to just state that.
> Thanks,
> -Harsha
>
> The state refers to the state provided by the HW. This patch introduces a generic API to support all cases.
>
> The case to pop in SW in case the info provided is that the packet is encapsulated is a private case.

Private case ? IMO, the API/interface should provide sufficient
information on what is meant by the state and recovery for each use
case, starting with tunnel encapsulated packets for now.

>
>
>
Eli Britstein Feb. 25, 2021, 2:20 p.m. UTC | #4
On 2/25/2021 9:34 AM, Sriharsha Basavapatna wrote:
> On Tue, Feb 23, 2021 at 6:51 PM Eli Britstein <elibr@nvidia.com> wrote:
>>
>> On 2/23/2021 3:10 PM, Sriharsha Basavapatna wrote:
>>
>> On Wed, Feb 10, 2021 at 8:57 PM Eli Britstein <elibr@nvidia.com> wrote:
>>
>> 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. Add API for that.
>>
>> Can you be more specific/clear on what this API does ? What specific
>> packet state is this referring to and what is meant by recovering the
>> state here ? For example, if recovering  the packet state means to
>> check if the packet is encapsulated and to pop the tunnel header, then
>> it would make it clear to just state that.
>> Thanks,
>> -Harsha
>>
>> The state refers to the state provided by the HW. This patch introduces a generic API to support all cases.
>>
>> The case to pop in SW in case the info provided is that the packet is encapsulated is a private case.
> Private case ? IMO, the API/interface should provide sufficient
> information on what is meant by the state and recovery for each use
> case, starting with tunnel encapsulated packets for now.

This commit only adds a generic API, so its message is kept generic, 
even if currently in this series it will only be used for F1 and F2 miss.

The specifics of the recovery are in patch 5.

The documentation in rte_flow.h can be improved as well.


>>
>>
diff mbox series

Patch

diff --git a/lib/netdev-offload-provider.h b/lib/netdev-offload-provider.h
index cf859d1b4..f24c7dd19 100644
--- a/lib/netdev-offload-provider.h
+++ b/lib/netdev-offload-provider.h
@@ -87,6 +87,11 @@  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. */
+    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);