From patchwork Sun Jun 11 15:58:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eli Britstein X-Patchwork-Id: 1793592 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=XZ7Ndpts; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QfKJ20QSMz20QH for ; Mon, 12 Jun 2023 01:59:12 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 3F6408228E; Sun, 11 Jun 2023 15:59:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3F6408228E Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=XZ7Ndpts X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id irvKqoWSaufJ; Sun, 11 Jun 2023 15:59:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6C6EB8214B; Sun, 11 Jun 2023 15:59:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6C6EB8214B Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3A0D8C0037; Sun, 11 Jun 2023 15:59:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 550F7C0029 for ; Sun, 11 Jun 2023 15:59:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 19CDD821AE for ; Sun, 11 Jun 2023 15:59:05 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 19CDD821AE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WDwmJSKb--1u for ; Sun, 11 Jun 2023 15:59:04 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E8AFA8214B Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20600.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::600]) by smtp1.osuosl.org (Postfix) with ESMTPS id E8AFA8214B for ; Sun, 11 Jun 2023 15:59:03 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QLnEFAqepGDMWnaXpsDxYxcEpvc44/ZrzijDqYo+/Hse+q6jVibrLveKYJuK/88CuqIcXslbtJNNYxZbTAO9UYvJm4h1mNda8oZuSCTMfYSqIaJaLfMqEYZhvbYoDkq3tbkPcI9d3795m+O5frG4HD3GNrrNcLdtmbFPIqz5PxJF59dY+UNGK+pisfQK0/WMM15jsyXbjMHcUdQXi0s2sviJtrFz8vtF7Wv//6TEU8f39jsp0aw8fSVNpO2HUFNigPpkQ2frLSRMhYW00U52Aaaq6xoKbn9ASE0gw0pCkZ4KaaYKryNBPzfJNgyIc324auK0kAi6BIu7SqwORAAbbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h1BoCI87uXu5c9wPAQHzea80L92ueWSfOok7VujU3i0=; b=ke5R2dD8GsQ7e8SjqsTIDeIOM723gE2AFgx01T8LPdAXKJTMLTQLD5ligNp274jqPH8MyviLjcnpfPwvmedf9/h581fCH6JtMsVeX4HFyKp5Q54Wn2Jbbf1V5o3gJfgDKcoh3m4e4JN48VhIhzVn6VPrhO6uHle0cd98Ue7dnhwzT3fP+YODxkew75TUCjhurVxfz6C15PqOa5AqezhQRjUz6lUUAHK/e/Td4rAphJ+eOVCHJxTC9pv2uiAVYLMpUAT/hI16mIt1rS8+W8i7TBzFeiFr9Fry0/8ZjY0M2QvsDMEYK7YPnXdWxxBcbeatj+hJxigPa8ANSW2Bh/HyTQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h1BoCI87uXu5c9wPAQHzea80L92ueWSfOok7VujU3i0=; b=XZ7NdptsonQd2hcW8Oxkf4VPtM1LM82sbDzAMhlIUe63qdz5MrYwzzQggIoQJsi0ztRMqHW+vpcvHDfh4WGqG0cSQpI5voF/3KrlBI9DtAdoax7rwbPerZnyZfiVK7nuIUYaSjtdqHRxH6Cs1lRf4y7AoSefawkMKn2othIsc+OmXOb11tkSiq3IlNDwKFjRE75VL9BMVHbc6YL2dxDU9Ef152HxVGWoRoM6I5km+iexiQjGkaoOjeNqpgMrCMQcegCql9K3IEFAc85nYbO6ejKuJgTJrJmw4Mnbhdws4N+aVLeZWYcJmKULjwSXIQsU+djJ2eQ1YXsExgzAV+5kew== Received: from MW4PR03CA0219.namprd03.prod.outlook.com (2603:10b6:303:b9::14) by CH3PR12MB8284.namprd12.prod.outlook.com (2603:10b6:610:12e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Sun, 11 Jun 2023 15:58:59 +0000 Received: from CO1NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b9:cafe::6b) by MW4PR03CA0219.outlook.office365.com (2603:10b6:303:b9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.33 via Frontend Transport; Sun, 11 Jun 2023 15:58:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT047.mail.protection.outlook.com (10.13.174.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.31 via Frontend Transport; Sun, 11 Jun 2023 15:58:58 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sun, 11 Jun 2023 08:58:56 -0700 Received: from nvidia.com (10.126.231.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sun, 11 Jun 2023 08:58:54 -0700 To: Date: Sun, 11 Jun 2023 18:58:26 +0300 Message-ID: <20230611155827.1957023-1-elibr@nvidia.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.126.231.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT047:EE_|CH3PR12MB8284:EE_ X-MS-Office365-Filtering-Correlation-Id: 164ae8cb-f479-4f2b-3bc5-08db6a94c43c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TgEb7UH8VUkACNrFShWupmPsQScpa9MVL2pWxV/mP9GcsWdYCvbH6A2kxgu/mWfub/a4gmp37H2DwDh1BWfC4s2FWAXFOjn53czWcOTYs1RUMaqPzCypmn0yC4OFlybdKcYBdRL5iwYo0X/LYU5sI/nVfkQQzaDCSSW29mYKjAA+49EhGpR+bAaCKkCPxzTg58N408orG8404LN+ClmZWbwYT0wzpYs6wx3WxJsz5zRxW0ph+pTf/xisGZed59SSt44/dYzTorHhYwMO5/Vcm6rTiihn/BrPudu4jnhvvPRibs3UK7tW1SYIJ9/+xWhyjL8IgxaxW/6Y1R2c837R1MRr8K5S5oxjpatxZ3Ha4kCNAhWGUmN1JQx9+p2eZbIJuklu1UvHbtHRHR4lbtjVr5NtO1jmzJu0SyE/2g0jVS/FNiD18j3FKqJD5sZy9/s7bkKev4GoTAUQ0GdcD58jJMd3KZ3UfYmDmqGvGhrSgOI8fP5kGaVHbWywjqVSagFbKwPKhVgFklcEnFrWrI/hh9n9hp9E14PvZsT+VRc6Y0UuSpmx32UimwBARl2Ry4/+l1Wd8Ab39yDFxZzSsuF2IxfU20DAbEjPTNUDkeUyXhf+yoPCy6wS7q5IQ7qGZ6EqSivWGVJrMKmLNCQb+JFMwbmxvXZPYVnn5cUYpiQfD9sfK1nJ5wXwobaMrxmLiF9bLeycSmAeMiURzd45jf59064mSCxQC9qMi2tXeQCs/VXy/JLu3bCCyMROVISXXhA9 X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199021)(46966006)(36840700001)(40470700004)(316002)(7696005)(40460700003)(41300700001)(336012)(426003)(82310400005)(83380400001)(86362001)(2616005)(36860700001)(26005)(1076003)(186003)(107886003)(2906002)(47076005)(16526019)(6286002)(7636003)(356005)(82740400003)(55016003)(40480700001)(8676002)(36756003)(5660300002)(8936002)(70586007)(70206006)(478600001)(54906003)(6666004)(4326008)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2023 15:58:58.2105 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 164ae8cb-f479-4f2b-3bc5-08db6a94c43c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8284 Cc: wuxi_seu@163.com, Simon Horman , David Marchand , Ilya Maximets , Eli Britstein Subject: [ovs-dev] [PATCH V3 1/2] netdev-offload-dpdk: Fix flushing of a physdev 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: , X-Patchwork-Original-From: Eli Britstein via dev From: Eli Britstein Reply-To: Eli Britstein Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Vport's offloads are done on the tracked orig-in-port, but the flow itself is associated in the vport's map. Removing the physdev will flush all the ports that are on its map, but not the ones on other netdevs' maps. Since flows take reference count on both their vport and their physdev, the physdev still has references on. Trying to remove it and re-add it fails with "already in use" error. Fix it by flushing the physdev's offload flows in all related netdevs, e.g. the netdev itself, or for physical devices, all vports. Fixes: adbd4301a249 ("netdev-offload-dpdk: Use per-netdev offload metadata.") Reported-by: 15895987278 Signed-off-by: Eli Britstein Acked-by: Simon Horman --- lib/netdev-offload-dpdk.c | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c index 14bc87771..992627fa2 100644 --- a/lib/netdev-offload-dpdk.c +++ b/lib/netdev-offload-dpdk.c @@ -2537,15 +2537,15 @@ out: return ret; } -static int -netdev_offload_dpdk_flow_flush(struct netdev *netdev) +static void +flush_netdev_flows_in_related(struct netdev *netdev, struct netdev *related) { - struct cmap *map = offload_data_map(netdev); - struct ufid_to_rte_flow_data *data; unsigned int tid = netdev_offload_thread_id(); + struct cmap *map = offload_data_map(related); + struct ufid_to_rte_flow_data *data; if (!map) { - return -1; + return; } CMAP_FOR_EACH (data, node, map) { @@ -2556,6 +2556,31 @@ netdev_offload_dpdk_flow_flush(struct netdev *netdev) netdev_offload_dpdk_flow_destroy(data); } } +} + +static bool +flush_in_vport_cb(struct netdev *vport, + odp_port_t odp_port OVS_UNUSED, + void *aux) +{ + struct netdev *netdev = aux; + + /* Only vports are related to physical devices. */ + if (netdev_vport_is_vport_class(vport->netdev_class)) { + flush_netdev_flows_in_related(netdev, vport); + } + + return false; +} + +static int +netdev_offload_dpdk_flow_flush(struct netdev *netdev) +{ + flush_netdev_flows_in_related(netdev, netdev); + + if (!netdev_vport_is_vport_class(netdev->netdev_class)) { + netdev_ports_traverse(netdev->dpif_type, flush_in_vport_cb, netdev); + } return 0; }