Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp472346pxb; Wed, 29 Sep 2021 03:22:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOKZh6a4lQL+3w3ieFLyCcmAEVue7eBNO99VJr00vi/wbjkCcuPitLxPlqf91XaWI1p8B4 X-Received: by 2002:a17:906:4346:: with SMTP id z6mr13126816ejm.403.1632910932542; Wed, 29 Sep 2021 03:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632910932; cv=none; d=google.com; s=arc-20160816; b=bCnqSrhHl/a8MTWJxX4XFF7fjSDiTaafrfXTjEJcsooGmr32w9+lWvsmEBLeGlmSLZ dvCDkCT62aHmcbT0Ra1khNEYbO0RvjIaiv78QSCofFdpVPynHNGVzgQfq3qkbHSzVUbU GfuF26Do6zYU841Mi8EnoMZQlIx5WI3XsHoHGVqEmMV1J1h+02fmE2d5c1K50ju1ftyM f4HsC+pVwB/EEp7+7AC5xvx2va4nQCWH9Jj5To0qZAIuzAYdTnUE5898EBDKSeBUgoGl 1SF+KoD1I47N34x7fmf+c4gAcGQny+FEp4buT5uWoYSh7RmSt/sG7BzznJPwUVjMEHBx f5Mw== 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=JfAA6tYizyrLLFG5n98liNGXKahfIaYmZCSpyPce33R05lVrAR35uGqsiMY68/MbAi OQgUzE0rL6XmT6l3RgykqAbR7xHF5M4KxILG1ibWTCThOsHzAO0zfBHb+D9vSxazINIC CCC0hg6eR1G8QtkirrXWdEUqHbZ7xC4/VYJEKaEIEseJZJkkNTltNwuIJc547YdciR+K 7OOr9bDa6fQEnQwLUAjE8dXK7dM/DPqegQdOKGZgfszzoFOrbWgmT7+KR7lw0ffCIlmP iHSj5HFU4AiPduz81m4sl5jkRoX7Sc7OCV+4Lf1FAJKUMktpZ/OSTug+pfEA6ceOEIgI rJCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QsyKu2Bn; 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 b88si2723898edf.312.2021.09.29.03.21.46; Wed, 29 Sep 2021 03:22:12 -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=QsyKu2Bn; 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 S245469AbhI2KSw (ORCPT + 99 others); Wed, 29 Sep 2021 06:18:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:49632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245475AbhI2KSm (ORCPT ); Wed, 29 Sep 2021 06:18:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 96C3A6135E; Wed, 29 Sep 2021 10:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632910621; bh=lXfh5WGrONF4SJ4gvPOiSDik2vUfqacZzHc0ckI9xmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QsyKu2BnDHy4iS9k1fHzU0z8EZzQMPAA8eu/JdF1SJn/5mhvNoSUY3Dic/RyLrBUA 6Yw2Iln+5FbHhSzRe0prPx3P7XWIsuARbd6pZ1zoUp6eJuDd9OOliX2J87LBZ3KvKQ rkljvN6tfBUB7aR4R358ExU9rcUK0CGO1wpUhodeBFSLJMN75s0M/+mEehs7yNGvDC mKIXVQ7mxP9gBjWUq5WSSHxkIuFIK/38CZpkBwjjzVuAHrPxLKntuoloh8fGkOoo3L vaklhaBR72HkLW+u5jkJpLJ1PqOc3sX3RRpQQah0ocIAcCOfk+QDmNJfF2H6ivw9u/ 7baOCUE2lVn1Q== 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 4/5] net/mlx5: Register separate reload devlink ops for multiport device Date: Wed, 29 Sep 2021 13:16:38 +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