[ovs-dev] [PATCH ovs-dev v1] netdev-offload: Flush offloaded rules when ports removed

xiangxia.m.yue at gmail.com xiangxia.m.yue at gmail.com
Thu Jun 11 10:36:35 UTC 2020


From: Tonghao Zhang <xiangxia.m.yue at gmail.com>

When ports were removed from bridge, we should flush the
offload rules on the ports. The main reason is two factors:

* The ports removed from bridge, will be managed by OvS, so
  flush the rules which installed by OvS.
* If using the TC flower offload, for example, tc rules still
  are on the ports. And the information still are maintained by
  OvS, such as the mapping for tc and ufid.
  Then if adding the port to bridge and installing the rules
  to it again, *del_filter_and_ufid_mapping will be invoked,
  and delete the tc rule using tc handle which may not exist
  (offload init api flushed them.) on kernel or is used by other
  previous rules (if so, that rules will be deleted that is not
  we expected.).

Cc: Simon Horman <simon.horman at netronome.com>
Cc: Paul Blakey <paulb at mellanox.com>
Cc: Roi Dayan <roid at mellanox.com>
Cc: Ben Pfaff <blp at ovn.org>
Cc: William Tu <u9012063 at gmail.com>
Cc: Ilya Maximets <i.maximets at ovn.org>
Tested-at: https://travis-ci.com/github/ovn-open-virtual-networks/ovs/builds/170832624
Co-authored-by: Wengang Hou <houwengang at didiglobal.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue at gmail.com>
---
 lib/netdev-offload.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/netdev-offload.c b/lib/netdev-offload.c
index ab97a292ebac..964566caab1e 100644
--- a/lib/netdev-offload.c
+++ b/lib/netdev-offload.c
@@ -593,6 +593,7 @@ netdev_ports_remove(odp_port_t port_no, const struct dpif_class *dpif_class)
     data = netdev_ports_lookup(port_no, dpif_class);
     if (data) {
         dpif_port_destroy(&data->dpif_port);
+        netdev_flow_flush(data->netdev); /* flush offloaded rules. */
         netdev_close(data->netdev); /* unref and possibly close */
         hmap_remove(&port_to_netdev, &data->portno_node);
         hmap_remove(&ifindex_to_port, &data->ifindex_node);
-- 
2.26.1



More information about the dev mailing list