From patchwork Thu Jun 11 10:36:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tonghao Zhang X-Patchwork-Id: 1307446 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Q5qTkc7s; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49jL016kmKz9sQx for ; Thu, 11 Jun 2020 20:37:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9B0EB879E8; Thu, 11 Jun 2020 10:37:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MYUvOsoT0Lpn; Thu, 11 Jun 2020 10:37:18 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 970B287664; Thu, 11 Jun 2020 10:37:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7A6F2C0178; Thu, 11 Jun 2020 10:37:18 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 17998C016F for ; Thu, 11 Jun 2020 10:37:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0BA8488750 for ; Thu, 11 Jun 2020 10:37:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H-KKzAHZXx3i for ; Thu, 11 Jun 2020 10:37:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by whitealder.osuosl.org (Postfix) with ESMTPS id 44F4B8874E for ; Thu, 11 Jun 2020 10:37:16 +0000 (UTC) Received: by mail-pf1-f195.google.com with SMTP id s23so2501014pfh.7 for ; Thu, 11 Jun 2020 03:37:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=NSYT6vYidrL4YNWMPr/lVKwDbtWDR+5IsGYcAjnKA+Q=; b=Q5qTkc7s4/rHNUbrRCjDzOeBWozKUTFOmLPzBGejHORSwwk7FM2qVnuW2YlGdEPacG rn94hfglVDP5C8PZkYnNYGCdv0XV5EEv/OS75Pb9FgBZIgEhx3U1z/7hy6gWS31fRhgg 2StgA269lA9h1lD0DDF1Gp6cJPm54kji0YmFnazfXKHW6lxoFPIMJIWcZiO1CaMqeFF0 qmB8O3nMPcmYd5gyL4bBow/Eq4Z9PMVdtRKNn3DDPRHWvEDG8tx441+RRcIXgFeqkhcl og0lVA4Mkhvgz6qrmyZ/GFQgVoLhKtHeAxafCE/RbbZgJ9nutw8kxVXh2hC+0/1X3CA+ zGNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NSYT6vYidrL4YNWMPr/lVKwDbtWDR+5IsGYcAjnKA+Q=; b=C5/8arrqqECk9+q+zCpgVy86ooBRkWaMdcKqV6Hg+nlq8fZ1lNTcwWh3uoZ7rWwhtT BoLg3DeMUP4z7KKCSw9sX1eIaZpg7BXy6BdisRmUZrKiv87+YpIasDLwOx7B4eVbqksY n+m6clJLJnbwD7snJYuvvIz5Wz9FsqynsSxAXPdqsx+o6nUv42go1+BsuZDd3Llm23Pp ZkSY2LqAdV901SKhrBUlVQYtcFjiBe2ZddjOlYCuGeVvnys+IaGWAVgoLBs32Bp1Bbwo nmmm82RuFHFfhUo6WIpicPqSAEXqEx9YavWgQ29xBqHnyhgpR8bNaQCm5qhbNb0gUOl+ ljZw== X-Gm-Message-State: AOAM530GwF7X/CcEudB/6jAC0oaaOdxcBGn/shkwPCa2l4xI38un+/pQ 2eCry+nixks8JIQDcTMaUqozv5+VyqQ= X-Google-Smtp-Source: ABdhPJzcA/erb8XZI20YYaPK0XHyTaYUWtTHVxfe+/d7Z1ZIsTtfY6zqEtUrH3iu3B7eKe80FjTiXw== X-Received: by 2002:aa7:9553:: with SMTP id w19mr6585178pfq.160.1591871835461; Thu, 11 Jun 2020 03:37:15 -0700 (PDT) Received: from localhost.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id cm13sm2333735pjb.5.2020.06.11.03.37.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2020 03:37:14 -0700 (PDT) From: xiangxia.m.yue@gmail.com To: dev@openvswitch.org Date: Thu, 11 Jun 2020 18:36:35 +0800 Message-Id: <20200611103635.53367-1-xiangxia.m.yue@gmail.com> X-Mailer: git-send-email 2.15.0 Cc: Simon Horman , Ilya Maximets , houwengang@didiglobal.com Subject: [ovs-dev] [PATCH ovs-dev v1] netdev-offload: Flush offloaded rules when ports removed X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Tonghao Zhang 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 Cc: Paul Blakey Cc: Roi Dayan Cc: Ben Pfaff Cc: William Tu Cc: Ilya Maximets Tested-at: https://travis-ci.com/github/ovn-open-virtual-networks/ovs/builds/170832624 Co-authored-by: Wengang Hou Signed-off-by: Tonghao Zhang --- 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);