From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2F12C34031 for ; Thu, 20 Feb 2020 07:08:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A39D724656 for ; Thu, 20 Feb 2020 07:08:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="UxZEJHCb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726501AbgBTHIV (ORCPT ); Thu, 20 Feb 2020 02:08:21 -0500 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:59557 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbgBTHIV (ORCPT ); Thu, 20 Feb 2020 02:08:21 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 50B8E21ACE; Thu, 20 Feb 2020 02:08:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 20 Feb 2020 02:08:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Ylv2Md1H2trcaaM3H efYeHsPgHBAqBTejzurAUnrIYg=; b=UxZEJHCbxSSB/tuCqFqVKitaJIVYHqeLP TqTRWeyNc2qnZXQ0rrMEkb/Xkjkhgw5T6+3COrn6Qv8sIB7FbGEGf4QqUKdDkn3d 6gqc0BLMJo3Dw/K1z0qYreyD2YxwYWUkFZTggWEN1M7QSXFsELwH2gTw4FDa8ntv YRihXe5H+od2qk7Xqrpxdhyt8XKeAWj0yCI5g99qEnxwWVc9nVlIjsuQW+PkNwyU ttR1NObD5pXrR9IDJxGLbjANGnMb37SZUgBXQiyWOxkkLZUcOJ4jwAF9nSPQADsa o5RouiviGBn0NfeLOXasnOoHj2VEbdUUZ1tbbP8PGEIPyi9LQ+c+Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrkedugddutdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgggfestdekredtre dttdenucfhrhhomhepkfguohcuufgthhhimhhmvghluceoihguohhstghhsehiughoshgt hhdrohhrgheqnecukfhppeduleefrdegjedrudeihedrvdehudenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehiughoshgthhesihguohhstghh rdhorhhg X-ME-Proxy: Received: from splinter.mtl.com (unknown [193.47.165.251]) by mail.messagingengine.com (Postfix) with ESMTPA id E14CD3060C21; Thu, 20 Feb 2020 02:08:18 -0500 (EST) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, jiri@mellanox.com, mlxsw@mellanox.com, Ido Schimmel Subject: [PATCH net-next 00/15] mlxsw: Preparation for RTNL removal Date: Thu, 20 Feb 2020 09:07:45 +0200 Message-Id: <20200220070800.364235-1-idosch@idosch.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Ido Schimmel The driver currently acquires RTNL in its route insertion path, which contributes to very large control plane latencies. This patch set prepares mlxsw for RTNL removal from its route insertion path in a follow-up patch set. Patches #1-#2 protect shared resources - KVDL and counter pool - with their own locks. All allocations of these resources are currently performed under RTNL, so no locks were required. Patches #3-#7 ensure that updates to mirroring sessions only take place in case there are active mirroring sessions. This allows us to avoid taking RTNL when it is unnecessary, as updating of the mirroring sessions must be performed under RTNL for the time being. Patches #8-#10 replace the use of APIs that assume that RTNL is taken with their RCU counterparts. Specifically, patches #8 and #9 replace __in_dev_get_rtnl() with __in_dev_get_rcu() under RCU read-side critical section. Patch #10 replaces __dev_get_by_index() with dev_get_by_index_rcu(). Patches #11-#15 perform small adjustments in the code to make it easier to later introduce a router lock instead of relying on RTNL. Ido Schimmel (15): mlxsw: spectrum_kvdl: Protect allocations with a lock mlxsw: spectrum: Protect counter pool with a lock mlxsw: spectrum_span: Do no expose mirroring agents to entire driver mlxsw: spectrum_span: Use struct_size() to simplify allocation mlxsw: spectrum_span: Prepare work item to update mirroring agents mlxsw: spectrum: Convert callers to use new mirroring API mlxsw: spectrum_span: Only update mirroring agents if present mlxsw: spectrum_router: Do not assume RTNL is taken during nexthop init mlxsw: spectrum_router: Do not assume RTNL is taken during RIF teardown mlxsw: spectrum_router: Do not assume RTNL is taken when resolving underlay device mlxsw: spectrum_router: Prepare function for router lock introduction mlxsw: spectrum_router: Prepare function for router lock introduction mlxsw: spectrum: Prevent RIF access outside of routing code mlxsw: spectrum: Export function to check if RIF exists mlxsw: spectrum_nve: Make tunnel initialization symmetric .../net/ethernet/mellanox/mlxsw/spectrum.c | 8 +- .../net/ethernet/mellanox/mlxsw/spectrum.h | 12 +- .../ethernet/mellanox/mlxsw/spectrum_cnt.c | 25 +++- .../ethernet/mellanox/mlxsw/spectrum_kvdl.c | 16 ++- .../ethernet/mellanox/mlxsw/spectrum_nve.c | 5 +- .../ethernet/mellanox/mlxsw/spectrum_router.c | 112 ++++++++++++++---- .../ethernet/mellanox/mlxsw/spectrum_span.c | 102 ++++++++++------ .../mellanox/mlxsw/spectrum_switchdev.c | 42 +------ 8 files changed, 199 insertions(+), 123 deletions(-) -- 2.24.1