From patchwork Tue Nov 20 22:12:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Saeed Mahameed X-Patchwork-Id: 10691341 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E17A13AD for ; Tue, 20 Nov 2018 22:19:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07A7F2A8F0 for ; Tue, 20 Nov 2018 22:19:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE8A72A92F; Tue, 20 Nov 2018 22:19:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DF0A2A8F0 for ; Tue, 20 Nov 2018 22:19:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725913AbeKUIuX (ORCPT ); Wed, 21 Nov 2018 03:50:23 -0500 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:41779 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726047AbeKUIuW (ORCPT ); Wed, 21 Nov 2018 03:50:22 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from saeedm@mellanox.com) with ESMTPS (AES256-SHA encrypted); 21 Nov 2018 00:18:28 +0200 Received: from sx1.mtl.com ([172.16.5.54]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wAKMChKC026480; Wed, 21 Nov 2018 00:12:43 +0200 From: Saeed Mahameed To: Leon Romanovsky , saeedm@mellanox.com Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, Jason Gunthorpe Subject: [PATCH mlx5-next 00/11] mlx5 core internal firmware events handling improvements Date: Tue, 20 Nov 2018 14:12:17 -0800 Message-Id: <20181120221228.18365-1-saeedm@mellanox.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi This patchset is for mlx5-next shared branch, and will be applied there once the review is done. The main idea of this change is to define a flexible scalable and simpler low level mlx5 core APIs to upper level components for better features decoupling and maximum code locality and modularity. Improve and simplify mlx5 core internal firmware and device async events handling and subscription, currently all async firmware events are handled in one place (switch case in eq.c) and every time we need to update one of the mlx5_core handlers or add new events handling to the system, the driver needs to be changed in many places in order to deliver the new event to its consumer. To improve this we will use atomic_notifier_chain to fire firmware events at internal mlx5 core components such as eswitch/fpga/clock/FW tracer/etc.., this is to avoid explicit calls from low level mlx5_core to upper components and to simplify the mlx5_core API for future developments. Provide register/unregister notifiers API and call the notifier chain on firmware async events. Example to subscribe to a FW event: struct mlx5_nb port_event; MLX5_NB_INIT(&port_event, port_event_handler, PORT_CHANGE); mlx5_eq_notifier_register(mdev, &port_event); Where: - port_event_handler is the notifier block callback. - PORT_EVENT is the suffix of MLX5_EVENT_TYPE_PORT_CHANGE (The event type to subscribe to) The above will guarantee that port_event_handler will receive all FW events of the type MLX5_EVENT_TYPE_PORT_CHANGE. To receive all FW/HW events one can subscribe to MLX5_EVENT_TYPE_NOTIFY_ANY. There can be only 128 types of firmware events each has its own 64Byte EQE (Event Queue Element) data, we will have one atomic_notifier_chain per event type for maximum performance and verbosity. Each handler is going to receive the event_type as unsigned long and the event data as void pointer, exactly as defined in the notifier block handlers prototype. This API is implemented in the first patch of this series all following patches are modifying the existing mlx5 components to use the new API to subscribe to FW events. Thanks, Saeed. --- Saeed Mahameed (11): net/mlx5: EQ, Introduce atomic notifier chain subscription API net/mlx5: FWTrace, Use async events chain net/mlx5: FPGA, Use async events chain net/mlx5: Clock, Use async events chain net/mlx5: E-Switch, Use async events chain net/mlx5: FWPage, Use async events chain net/mlx5: CmdIF, Use async events chain net/mlx5: Resource tables, Use async events chain net/mlx5: CQ ERR, Use async events chain net/mlx5: Device events, Use async events chain net/mlx5: Improve core device events handling .../net/ethernet/mellanox/mlx5/core/Makefile | 2 +- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 48 ++- .../mellanox/mlx5/core/diag/fw_tracer.c | 27 +- .../mellanox/mlx5/core/diag/fw_tracer.h | 2 +- .../ethernet/mellanox/mlx5/core/en_stats.c | 9 +- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 322 +++++------------ .../net/ethernet/mellanox/mlx5/core/eswitch.c | 44 ++- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 3 +- .../net/ethernet/mellanox/mlx5/core/events.c | 332 ++++++++++++++++++ .../ethernet/mellanox/mlx5/core/fpga/core.c | 38 +- .../ethernet/mellanox/mlx5/core/fpga/core.h | 11 +- .../net/ethernet/mellanox/mlx5/core/health.c | 25 +- .../ethernet/mellanox/mlx5/core/lib/clock.c | 24 +- .../ethernet/mellanox/mlx5/core/lib/clock.h | 3 - .../net/ethernet/mellanox/mlx5/core/lib/eq.h | 5 + .../ethernet/mellanox/mlx5/core/lib/mlx5.h | 34 ++ .../net/ethernet/mellanox/mlx5/core/main.c | 41 ++- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 13 +- .../ethernet/mellanox/mlx5/core/pagealloc.c | 44 ++- .../net/ethernet/mellanox/mlx5/core/port.c | 57 --- drivers/net/ethernet/mellanox/mlx5/core/qp.c | 68 +++- drivers/net/ethernet/mellanox/mlx5/core/srq.c | 55 ++- include/linux/mlx5/device.h | 10 +- include/linux/mlx5/driver.h | 46 +-- include/linux/mlx5/eq.h | 16 +- include/linux/mlx5/port.h | 3 - 26 files changed, 811 insertions(+), 471 deletions(-) create mode 100644 drivers/net/ethernet/mellanox/mlx5/core/events.c