Skip to content

Commit

Permalink
dpif-netdev: Move port flush after datapath reconfiguration.
Browse files Browse the repository at this point in the history
Port flush and offload uninit should be moved after the datapath
has been reconfigured. That way, no other thread such as PMDs will
find this port to poll and enqueue further offload requests.

After a flush, almost no further offload request for this port should
be found in the queue.

There will still be some issued by revalidators, but they
will be caught when the offload thread fails to take a netdev ref.

This change fixes the issue of datapath reference being improperly
accessed by offload threads while it is being destroyed.

Fixes: 5b0aa55 ("dpif-netdev: Execute flush from offload thread.")
Fixes: 62d1c28 ("dpif-netdev: Flush offload rules upon port deletion.")
Suggested-by: Ilya Maximets <[email protected]>
Acked-by: Sriharsha Basavapatna <[email protected]>
Signed-off-by: Gaetan Rivet <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
Gaetan Rivet authored and igsilya committed Feb 16, 2022
1 parent f92e694 commit a81bb67
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/dpif-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2315,13 +2315,22 @@ static void
do_del_port(struct dp_netdev *dp, struct dp_netdev_port *port)
OVS_REQ_WRLOCK(dp->port_rwlock)
{
dp_netdev_offload_flush(dp, port);
netdev_uninit_flow_api(port->netdev);
hmap_remove(&dp->ports, &port->node);
seq_change(dp->port_seq);

reconfigure_datapath(dp);

/* Flush and disable offloads only after 'port' has been made
* inaccessible through datapath reconfiguration.
* This prevents having PMDs enqueuing offload requests after
* the flush.
* When only this port is deleted instead of the whole datapath,
* revalidator threads are still active and can still enqueue
* offload modification or deletion. Managing those stray requests
* is done in the offload threads. */
dp_netdev_offload_flush(dp, port);
netdev_uninit_flow_api(port->netdev);

port_destroy(port);
}

Expand Down

0 comments on commit a81bb67

Please sign in to comment.