diff mbox series

[ovs-dev,V2,1/3] dpif-netdev: Do not flush PMD offloads on reload

Message ID 20210712150710.19197-2-elibr@nvidia.com
State Changes Requested
Headers show
Series dpif-netdev offload transitions | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot success github build: passed

Commit Message

Eli Britstein July 12, 2021, 3:07 p.m. UTC
Before flushing offloads of a removed port was supported by [1], it was
necessary to flush the 'marks'. In doing so, all offloads of the PMD are
removed, include the ones that are not related to the removed port and
that are not modified following this removal. As a result such flows are
evicted from being offloaded, and won't resume offloading.

As PMD offload flush is not necessary, avoid it.

[1] 62d1c28e9ce0 ("dpif-netdev: Flush offload rules upon port deletion.")

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Reviewed-by: Gaetan Rivet <gaetanr@nvidia.com>
---
 lib/dpif-netdev.c | 13 -------------
 1 file changed, 13 deletions(-)

Comments

David Marchand July 13, 2021, 2:57 p.m. UTC | #1
On Mon, Jul 12, 2021 at 5:07 PM Eli Britstein <elibr@nvidia.com> wrote:
>
> Before flushing offloads of a removed port was supported by [1], it was
> necessary to flush the 'marks'. In doing so, all offloads of the PMD are
> removed, include the ones that are not related to the removed port and
> that are not modified following this removal. As a result such flows are
> evicted from being offloaded, and won't resume offloading.
>
> As PMD offload flush is not necessary, avoid it.
>
> [1] 62d1c28e9ce0 ("dpif-netdev: Flush offload rules upon port deletion.")
>
> Signed-off-by: Eli Britstein <elibr@nvidia.com>
> Reviewed-by: Gaetan Rivet <gaetanr@nvidia.com>

Reviewed-by: David Marchand <david.marchand@redhat.com>
Ilya Maximets July 23, 2021, 6 p.m. UTC | #2
On 7/12/21 5:07 PM, Eli Britstein wrote:
> Before flushing offloads of a removed port was supported by [1], it was
> necessary to flush the 'marks'. In doing so, all offloads of the PMD are
> removed, include the ones that are not related to the removed port and
> that are not modified following this removal. As a result such flows are
> evicted from being offloaded, and won't resume offloading.
> 
> As PMD offload flush is not necessary, avoid it.
> 
> [1] 62d1c28e9ce0 ("dpif-netdev: Flush offload rules upon port deletion.")
> 
> Signed-off-by: Eli Britstein <elibr@nvidia.com>
> Reviewed-by: Gaetan Rivet <gaetanr@nvidia.com>
> ---

Is my understanding here correct:
On a port deletion netdev_fow_flush() will remove flows from HW and
offloading layer.  Later, ofproto will request to remove flows from
the datapath.  flow marks will be freed, but actual netdev_flow_del()
will fail, because netdev-offload already removed these flows.  But
we do not really care about this failure.  Right?

Best regards, Ilya Maximets.
Eli Britstein July 25, 2021, 6:40 a.m. UTC | #3
On 7/23/2021 9:00 PM, Ilya Maximets wrote:
> External email: Use caution opening links or attachments
>
>
> On 7/12/21 5:07 PM, Eli Britstein wrote:
>> Before flushing offloads of a removed port was supported by [1], it was
>> necessary to flush the 'marks'. In doing so, all offloads of the PMD are
>> removed, include the ones that are not related to the removed port and
>> that are not modified following this removal. As a result such flows are
>> evicted from being offloaded, and won't resume offloading.
>>
>> As PMD offload flush is not necessary, avoid it.
>>
>> [1] 62d1c28e9ce0 ("dpif-netdev: Flush offload rules upon port deletion.")
>>
>> Signed-off-by: Eli Britstein <elibr@nvidia.com>
>> Reviewed-by: Gaetan Rivet <gaetanr@nvidia.com>
>> ---
> Is my understanding here correct:
> On a port deletion netdev_fow_flush() will remove flows from HW and
> offloading layer.  Later, ofproto will request to remove flows from
> the datapath.  flow marks will be freed, but actual netdev_flow_del()
> will fail, because netdev-offload already removed these flows.  But
> we do not really care about this failure.  Right?

That is correct.

It was also the same before above [1], but then in the race condition, 
the offload memory was leaked, and the offloads themselves were either 
not destroyed (e.g. leaked) or removed by the PMD, which was PMD dependent.

[1] resolved the leaking, but didn't change the mentioned failure behavior.

This commit doesn't prevents this failure either, but removes the code 
that destroys offloads of flows that should not be destroyed.

>
> Best regards, Ilya Maximets.
Ilya Maximets July 25, 2021, 11:30 p.m. UTC | #4
On 7/25/21 8:40 AM, Eli Britstein wrote:
> 
> On 7/23/2021 9:00 PM, Ilya Maximets wrote:
>> External email: Use caution opening links or attachments
>>
>>
>> On 7/12/21 5:07 PM, Eli Britstein wrote:
>>> Before flushing offloads of a removed port was supported by [1], it was
>>> necessary to flush the 'marks'. In doing so, all offloads of the PMD are
>>> removed, include the ones that are not related to the removed port and
>>> that are not modified following this removal. As a result such flows are
>>> evicted from being offloaded, and won't resume offloading.
>>>
>>> As PMD offload flush is not necessary, avoid it.
>>>
>>> [1] 62d1c28e9ce0 ("dpif-netdev: Flush offload rules upon port deletion.")
>>>
>>> Signed-off-by: Eli Britstein <elibr@nvidia.com>
>>> Reviewed-by: Gaetan Rivet <gaetanr@nvidia.com>
>>> ---
>> Is my understanding here correct:
>> On a port deletion netdev_fow_flush() will remove flows from HW and
>> offloading layer.  Later, ofproto will request to remove flows from
>> the datapath.  flow marks will be freed, but actual netdev_flow_del()
>> will fail, because netdev-offload already removed these flows.  But
>> we do not really care about this failure.  Right?
> 
> That is correct.
> 
> It was also the same before above [1], but then in the race condition, the offload memory was leaked, and the offloads themselves were either not destroyed (e.g. leaked) or removed by the PMD, which was PMD dependent.
> 
> [1] resolved the leaking, but didn't change the mentioned failure behavior.
> 
> This commit doesn't prevents this failure either, but removes the code that destroys offloads of flows that should not be destroyed.

Make sense.  Thanks!
diff mbox series

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 610949f36..21b0e025d 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2232,18 +2232,6 @@  mark_to_flow_disassociate(struct dp_netdev_pmd_thread *pmd,
     return ret;
 }
 
-static void
-flow_mark_flush(struct dp_netdev_pmd_thread *pmd)
-{
-    struct dp_netdev_flow *flow;
-
-    CMAP_FOR_EACH (flow, mark_node, &flow_mark.mark_to_flow) {
-        if (flow->pmd_id == pmd->core_id) {
-            queue_netdev_flow_del(pmd, flow);
-        }
-    }
-}
-
 static struct dp_netdev_flow *
 mark_to_flow_find(const struct dp_netdev_pmd_thread *pmd,
                   const uint32_t mark)
@@ -4811,7 +4799,6 @@  reload_affected_pmds(struct dp_netdev *dp)
 
     CMAP_FOR_EACH (pmd, node, &dp->poll_threads) {
         if (pmd->need_reload) {
-            flow_mark_flush(pmd);
             dp_netdev_reload_pmd__(pmd);
         }
     }