Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3859113pxk; Tue, 22 Sep 2020 04:40:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVmokiwaEZfW8g3FGocWAGw34+WWqPP4WFN9BprAJcALFwcECZqbbqj+HzeRYQps1Z+oRl X-Received: by 2002:a17:907:20d9:: with SMTP id qq25mr4256263ejb.382.1600774831658; Tue, 22 Sep 2020 04:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600774831; cv=none; d=google.com; s=arc-20160816; b=Ce511rU+v3V79BPkoBxZf8+z2CjWl/aEiZvIpTzivxpdpPaZUit+johMrJz/yPlAvr bHb/PJn/ugPbhRiNz2GOyrs7l7lk7fSy9HKAhhhwRsZlDvIxmRZZEMaHjPtaAU4Rtui6 Wva+CBUslfARbOsFaUQBCvxieGzsAqnJpFL5NNa/hYrXbXOqBuySiu+BG06GUr587CRN AesIrMuZLrhpK5xsUHqgkhR7NWqNHMFy6SbqP/CTchee6ARronDVtYc0Y7X/F7Vq3aYV dO2IWBUMO7txjeJT1JHqieMoWoqbEoZYkxTVDw05Yh9kVusJVDDWCG5WEtf54rEmDYaV 60Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=pAkCipHQ+5vK2MwSodUfqE0K7hq2pLSTh/z3bmzgDTI=; b=LR8Pwc3nyBrxO5ATNeQcu4AeDh4/4DIoPTta0U+1/l8X0nWGkxIlADuztLSVgsR8fE 9MP3zUf7JHKhk6t+A5J/GvaUdzILjmH1HcS3zVkVa1FB+Qb8Mb+fYw/YImOc++OOWbOG Fx/irPYSlxX07WzrZqpzUdxMgbb2AErPPl128ArmVuahpmAXmresmjoD8fLQYfz/6V1Z Ol3f2IE5ET4Zora5PcrLzOSLg+SkFFF+E2RqAOcshsNvXsBdHLJZUZjhP4r7QjOKQ32G L+sAmNl9Rxm3Xbrs8K94sRAbC2s6hSp7nfHCvbaTNBOyunRQqV4Nt1kXS05B9dXtPapa CD9w== 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rv10si10012524ejb.453.2020.09.22.04.40.07; Tue, 22 Sep 2020 04:40:31 -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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726666AbgIVLfj (ORCPT + 99 others); Tue, 22 Sep 2020 07:35:39 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:45734 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726652AbgIVLfi (ORCPT ); Tue, 22 Sep 2020 07:35:38 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ayal@mellanox.com) with SMTP; 22 Sep 2020 14:35:35 +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 08MBZZXI014357; Tue, 22 Sep 2020 14:35:35 +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 08MBZYTl009503; Tue, 22 Sep 2020 14:35:34 +0300 Received: (from ayal@localhost) by dev-l-vrt-210.mtl.labs.mlnx (8.15.2/8.15.2/Submit) id 08MBZRCh009499; Tue, 22 Sep 2020 14:35:27 +0300 From: Aya Levin To: "David S. Miller" , Jakub Kicinski , Jiri Pirko , Ido Schimmel , netdev Cc: Moshe Shemesh , Eran Ben Elisha , , Aya Levin Subject: [PATCH net-next RFC v2 repost 0/3] Add devlink traps in Date: Tue, 22 Sep 2020 14:35:22 +0300 Message-Id: <1600774525-9461-1-git-send-email-ayal@nvidia.com> X-Mailer: git-send-email 1.8.4.3 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 may cause drops. Devlink traps is regard as a debug mode. Using traps per port enable debug which doesn't effect other ports on a 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 ports context. In a nutshell it allows enable/disable of a trap on all related ports which registered this trap. Patch 3: Display a use in devlink traps in port context in mlx5 ethernet driver. Changelog: Minor changes in cover letter v1->v2: Patch 1: -Gather only the traps lists for future code reuse. Don't try to reuse the traps ops. Ptach 2: -Add traps lock in devlink_port -Add devlink_port ops and in it, add the trap ops -Add support onlty for traps and exclude groups and policy -Add separate netlink commands for port trap get and set -Allow trap registration without a corresponding group Patch 3: removed Ptach 4: -Is now patch 3 -Minor changes in trap's definition -Adjustments to trap API and ops Aya Levin (3): devlink: Wrap trap related lists a trap_lists struct devlink: Add devlink traps under devlink_ports context 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 | 38 ++ drivers/net/ethernet/mellanox/mlx5/core/en/traps.h | 14 + drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 48 +++ drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 11 +- include/net/devlink.h | 54 ++- include/uapi/linux/devlink.h | 5 + net/core/devlink.c | 453 ++++++++++++++++++--- 9 files changed, 556 insertions(+), 71 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