Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp554510pxb; Wed, 29 Sep 2021 05:06:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzoqjJdx9aC9WMvimQ8cQjBE126UAOWjE4UJgta0+VTQKZQdDEeic8pWlmJCMNNOv1FDBT9 X-Received: by 2002:a17:90a:9909:: with SMTP id b9mr6030853pjp.55.1632917174216; Wed, 29 Sep 2021 05:06:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632917174; cv=none; d=google.com; s=arc-20160816; b=vmd5M52Rh7ifXyC5Z5uAOFAQ0CTYw3n/F9UKF7Fgv2Q3qTMmM8jU3cXK9pcke5D09o kHJcvS2jtYeU7VUVeerSrFZnHQzfffHUHY9ws2E5+IOrMU1LCDS3hb7upC2a1Z0giLOe iuAoZW3mipaU/SvuWqd2MxkcHjVbXGIRD1vnZ+kZHpQG1WTdmKm6N2sPOoEAYBQWr5qV dtYCix05P4GS5gZC2d4xkF5NaDWUKf9XZGYlgIL7VPd1tEmxCT2zAZmle1qmqVZMHaho C7WR05jUSg/UkaO1WrCv7XHJQLM+wNX4tRdXYZYQdobeANBCN4gyHS0iMgSxj7sOgPoS 8h3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JYdceRjWjwXVeyctM3WjAQ2XFEgRzbNltmG29C3yV6o=; b=LekHKrclGBWJl4V9xmqTv+qDxblUuxahMPFx8MvgL9FXCs3lgJ/W9VFa9be5T3HqUE IdnmrAvItQV+raw1EBuqCpcXj9A0iZbygUn00VCe8jNM0Z+r43PYty247WYCeCC0G411 11dtLKtCvDTv5JNS5GCoKb/KN8bJd+hzFOUgLWmVN7NVZqNOG/e69/uoUPXUWfKGo5nP R/cCkTsv2sw0BE/YEqLDI4MCWzhd/6dY0l10VoGPY8ZKkWmnZ7D37xSa2reYab6LzJf7 9jOvyKMKm1nts7S96MXJMr5oEvzC0gh+dJksOY87JGAb1DLCtFURqc74ljw2H4B8AgyU taLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="k+SaC/XR"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 23si3059715pfw.196.2021.09.29.05.06.01; Wed, 29 Sep 2021 05:06:14 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="k+SaC/XR"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343501AbhI2MDl (ORCPT + 99 others); Wed, 29 Sep 2021 08:03:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:52802 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343672AbhI2MCt (ORCPT ); Wed, 29 Sep 2021 08:02:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 571F161458; Wed, 29 Sep 2021 12:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632916868; bh=lXfh5WGrONF4SJ4gvPOiSDik2vUfqacZzHc0ckI9xmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k+SaC/XRY78lkMZMf/9ZlPVWz42NJag/7vrrv5aq1Qk9gs+mNu44Vtn3x3bQFUTS6 bo6gzrBWbPMMqnjABLLOQkgqYgq5KoJPUn5+IaUw4y9RtWKEf12NLXQMNyPvhaEzlk /zS4g9c83rDl9j/TeAYmTBrLJh7VbEuCPQfOwhsr9YdUu640cKCYUx05tJSyODsBU1 YBM70A+4307elg6yASJ0lZKBW2Mga7XtrtWiv2stlfdWGniA3H1BqVKfXZXro2OrMt FJHV6ztCZ5eVuovmB933WtgXaWZWooVOOyFyribGiEnRY+Nnghr9ezH40H3wCZXMB1 ffC3REvybWkdw== From: Leon Romanovsky To: "David S . Miller" , Jakub Kicinski Cc: Leon Romanovsky , Alexandre Belloni , Andrew Lunn , Ariel Elior , Bin Luo , Claudiu Manoil , Coiby Xu , Derek Chickles , drivers@pensando.io, Eric Dumazet , Felix Manlunas , Florian Fainelli , Geetha sowjanya , Greg Kroah-Hartman , GR-everest-linux-l2@marvell.com, GR-Linux-NIC-Dev@marvell.com, hariprasad , Ido Schimmel , intel-wired-lan@lists.osuosl.org, Ioana Ciornei , Jerin Jacob , Jesse Brandeburg , Jiri Pirko , Jonathan Lemon , Linu Cherian , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-rdma@vger.kernel.org, linux-staging@lists.linux.dev, Manish Chopra , Michael Chan , Moshe Shemesh , netdev@vger.kernel.org, oss-drivers@corigine.com, Richard Cochran , Saeed Mahameed , Salil Mehta , Satanand Burla , Shannon Nelson , Shay Drory , Simon Horman , Subbaraya Sundeep , Sunil Goutham , Taras Chornyi , Tariq Toukan , Tony Nguyen , UNGLinuxDriver@microchip.com, Vadym Kochan , Vivien Didelot , Vladimir Oltean , Yisen Zhuang Subject: [PATCH net-next v1 4/5] net/mlx5: Register separate reload devlink ops for multiport device Date: Wed, 29 Sep 2021 15:00:45 +0300 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky Mulitport slave device doesn't support devlink reload, so instead of complicating initialization flow with devlink_reload_enable() which will be removed in next patch, set specialized devlink ops callbacks for reload operations. This fixes an error when reload counters exposed (and equal zero) for the mode that is not supported at all. Fixes: d89ddaae1766 ("net/mlx5: Disable devlink reload for multi port slave device") Signed-off-by: Leon Romanovsky --- drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c index 47c9f7f5bb79..e85eca6976a9 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c @@ -309,14 +309,17 @@ static struct devlink_ops mlx5_devlink_ops = { #endif .flash_update = mlx5_devlink_flash_update, .info_get = mlx5_devlink_info_get, + .trap_init = mlx5_devlink_trap_init, + .trap_fini = mlx5_devlink_trap_fini, + .trap_action_set = mlx5_devlink_trap_action_set, +}; + +static struct devlink_ops mlx5_devlink_reload = { .reload_actions = BIT(DEVLINK_RELOAD_ACTION_DRIVER_REINIT) | BIT(DEVLINK_RELOAD_ACTION_FW_ACTIVATE), .reload_limits = BIT(DEVLINK_RELOAD_LIMIT_NO_RESET), .reload_down = mlx5_devlink_reload_down, .reload_up = mlx5_devlink_reload_up, - .trap_init = mlx5_devlink_trap_init, - .trap_fini = mlx5_devlink_trap_fini, - .trap_action_set = mlx5_devlink_trap_action_set, }; void mlx5_devlink_trap_report(struct mlx5_core_dev *dev, int trap_id, struct sk_buff *skb, @@ -791,6 +794,7 @@ static void mlx5_devlink_traps_unregister(struct devlink *devlink) int mlx5_devlink_register(struct devlink *devlink) { + struct mlx5_core_dev *dev = devlink_priv(devlink); int err; err = devlink_params_register(devlink, mlx5_devlink_params, @@ -808,6 +812,9 @@ int mlx5_devlink_register(struct devlink *devlink) if (err) goto traps_reg_err; + if (!mlx5_core_is_mp_slave(dev)) + devlink_set_ops(devlink, &mlx5_devlink_reload); + return 0; traps_reg_err: -- 2.31.1