From patchwork Wed Sep 22 07:36:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ido Schimmel X-Patchwork-Id: 12509617 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=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 86B6FC433F5 for ; Wed, 22 Sep 2021 07:37:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6F30261178 for ; Wed, 22 Sep 2021 07:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233357AbhIVHi5 (ORCPT ); Wed, 22 Sep 2021 03:38:57 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:56577 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233059AbhIVHiy (ORCPT ); Wed, 22 Sep 2021 03:38:54 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 5B44B5C00C2; Wed, 22 Sep 2021 03:37:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 22 Sep 2021 03:37:24 -0400 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=fm3; bh=Z7nichfp0RqNTuBPz O0y9b2HXZcvDZJlUtpwa/C4mek=; b=Z+42xpRye4FUcBtRgYPFG9mI/PWvfTTDY wU93bIm7mDH2GZtofHskjG6xsPxovO4P/KA3Bsj8PTlUbSRkvGCMCozf7GvygHLD 2ueRM0U6GwM/wllj1JySgtpuxK0XIOPimkV9znhJ0SiiNktcqjNZpU8Y+Ay2anEA sX1iGIAJEAQ/E9RAsUHXgtbdrDSezRfevbgWzeDAt4Ue/r8jw5OVDc+++5D+ewT+ zVo1dyVMdl50oLuIbbHK/KaH1kqeBZkCx6+jOUg9AP1KwKpmFmwtSRPVv7gWJxlD IVMCKyBM5sakphjWOfIdWg+u2XALeitIZhszg6BTcdVp+tcTkRWtg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeiiedgudduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertd ertddtnecuhfhrohhmpefkughoucfutghhihhmmhgvlhcuoehiughoshgthhesihguohhs tghhrdhorhhgqeenucggtffrrghtthgvrhhnpeekkefgteeguedvtdegffeitefgueeiie dutefhtdfhkeetteelgfevleetueeigeenucffohhmrghinhepghhithhhuhgsrdgtohhm necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepihguoh hstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 22 Sep 2021 03:37:22 -0400 (EDT) From: Ido Schimmel To: netdev@vger.kernel.org Cc: davem@davemloft.net, kuba@kernel.org, jiri@nvidia.com, mlxsw@nvidia.com, Ido Schimmel Subject: [PATCH net-next 0/2] mlxsw: Alter trap adjacency entry allocation scheme Date: Wed, 22 Sep 2021 10:36:40 +0300 Message-Id: <20210922073642.796559-1-idosch@idosch.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Ido Schimmel In commit 0c3cbbf96def ("mlxsw: Add specific trap for packets routed via invalid nexthops"), mlxsw started allocating a new adjacency entry during driver initialization, to trap packets routed via invalid nexthops. This behavior was later altered in commit 983db6198f0d ("mlxsw: spectrum_router: Allocate discard adjacency entry when needed") to only allocate the entry upon the first route that requires it. The motivation for the change is explained in the commit message. The problem with the current behavior is that the entry shows up as a "leak" in a new BPF resource monitoring tool [1]. This is caused by the asymmetry of the allocation/free scheme. While the entry is allocated upon the first route that requires it, it is only freed during de-initialization of the driver. Instead, this patchset tracks the number of active nexthop groups and allocates the adjacency entry upon the creation of the first group. The entry is freed when the number of active groups reaches zero. Patch #1 adds the new entry. Patch #2 converts mlxsw to start using the new entry and removes the old one. [1] https://github.com/Mellanox/mlxsw/tree/master/Debugging/libbpf-tools/resmon Ido Schimmel (2): mlxsw: spectrum_router: Add trap adjacency entry upon first nexthop group mlxsw: spectrum_router: Start using new trap adjacency entry .../ethernet/mellanox/mlxsw/spectrum_router.c | 129 +++++++++++------- .../ethernet/mellanox/mlxsw/spectrum_router.h | 4 +- 2 files changed, 81 insertions(+), 52 deletions(-)