Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp551688pxk; Wed, 2 Sep 2020 08:34:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVs0ENReRaF0wRatRyEsAAh1/2Y7btN3QryCUP1mMKYtQjekm3TVOfS3ejh43TQLwTff6J X-Received: by 2002:a17:906:fb85:: with SMTP id lr5mr604839ejb.328.1599060862936; Wed, 02 Sep 2020 08:34:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599060862; cv=none; d=google.com; s=arc-20160816; b=yDwyu3iH2xFsLlLAKBcM9sR/kcFJKeml9827OnHZcdVcC0W6KELTs4lN8eK6mHCaSe fUoPjpfkuAErI56u/bkq6ztLxVEU6mP9LXQOsr8jxFCzN1Fb+e1JKDTGg3kGVU/dXXzW GQNswA1MFVP/x/ZaUfoWHMxg0F5gt9rg8q0s1LF8jg6fHlhU8WwS7FxdSyq5IZFfXMwd e8Zzqa5l2Ui2xRcXRCvJbaz8cLxVtEDF6KEGSbF8laJkz2HndcIaEAXnUkrj7u1vjpIG K6BpgmExug2XmJw5wEuvxXR0jWNiOeo2DJ0MJi81ZBzQTEWevRem0mNgJU1VRcHRblGa NJFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=kRUjnf+MNNFPA+5Fq4KrkHW0zHQUnwyRK6dKZouewHI=; b=Wi2kFEH9U7zdvKT7zGMEwgBgvQ+1zeB3Z/M/GJFwp5aN+5n7CnuA/pXuSiCRNQM5hA p+IHUvBgrAlW2r+HUih4vJxo/9eM+cXiU7eK/OAtmXhhhOUKzUSKi2vYl1nK9Ky3EKLg 34FxtwfPGb1fydVHxcBgA9GBl83GW6fAd8a0JmJP0dU6aql7LHgPCobGsP7yO9L4mXBv 386Fo07bzxrFMVhSCV3RWHFmImc5MfFs3uScWENaRIXMcHuEFrz6ZkcB3Jw5VQEsMLlI wYvF+vxbcIxEUC/A1hd37v+O/+Oe/BMB/tvW7cfJIPVZpB50PhP/ttO77jGCEEogguAI Qr/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gw6si2819824ejb.240.2020.09.02.08.34.00; Wed, 02 Sep 2020 08:34:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbgIBPco (ORCPT + 99 others); Wed, 2 Sep 2020 11:32:44 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:52307 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728381AbgIBPcg (ORCPT ); Wed, 2 Sep 2020 11:32:36 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ayal@mellanox.com) with SMTP; 2 Sep 2020 18:32:28 +0300 Received: from dev-l-vrt-210.mtl.labs.mlnx (dev-l-vrt-210.mtl.labs.mlnx [10.234.210.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 082FWSaN014692; Wed, 2 Sep 2020 18:32:28 +0300 Received: from dev-l-vrt-210.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Debian-8ubuntu1) with ESMTP id 082FWSrs026687; Wed, 2 Sep 2020 18:32:28 +0300 Received: (from ayal@localhost) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id 082FWPW4026686; Wed, 2 Sep 2020 18:32:25 +0300 From: Aya Levin To: "David S. Miller" , Jakub Kicinski , Jiri Pirko , netdev@vger.kernel.org Cc: Moshe Shemesh , Eran Ben Elisha , Ido Schimmel , linux-kernel@vger.kernel.org, Aya Levin Subject: [PATCH net-next RFC v1 0/4] Add devlink traps in devlink port context Date: Wed, 2 Sep 2020 18:32:10 +0300 Message-Id: <1599060734-26617-1-git-send-email-ayal@mellanox.com> X-Mailer: git-send-email 1.8.4.3 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implement support for devlink traps on per-port basis. Dropped packets in the RX flow are related to the Ethernet port and thus should be in port context. Traps per device should trap global configuration which can cause drops. On top of that, enabling a trap on a device level should trigger this trap on its siblings ports. In addition, when devlink traps is enabled, it may cause a degradation in performance. Hence devlink traps should be regard as a debug mode. Considering that, it is preferred to encapsulate the debug mode as much as possible and not to effect all the device. Patchset: Patch 1: Refactors devlink trap for easier code re-use in the coming patches Patch 2: Adds devlink traps under devlink port context Patch 3: Adds a relation between traps in device context and traps in ports context. In a nutshell it allows enable/disable of a trap on all related ports which registered this trap. Patch 4: Display a use in devlink traps in port context in mlx5 ethernet driver. Aya Levin (4): devlink: Wrap trap related lists and ops in trap_mngr devlink: Add devlink traps under devlink_ports context devlink: Add hiererchy between traps in device level and port level net/mlx5e: Add devlink trap to catch oversize packets drivers/net/ethernet/mellanox/mlx5/core/Makefile | 2 +- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 + drivers/net/ethernet/mellanox/mlx5/core/en/traps.c | 32 ++ drivers/net/ethernet/mellanox/mlx5/core/en/traps.h | 13 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 41 ++ drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 11 +- drivers/net/ethernet/mellanox/mlxsw/core.c | 5 + include/net/devlink.h | 84 ++- net/core/devlink.c | 616 +++++++++++++++++---- 9 files changed, 665 insertions(+), 141 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/traps.c create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/en/traps.h -- 2.14.1