Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1991467ybt; Thu, 2 Jul 2020 20:32:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH2kI1esT52oeN0uc6HtZhCqL2J3Be8M6VyXMMmnxLdsHJvlNontUpwZvn42Gd5cuO3Hn5 X-Received: by 2002:a17:906:398f:: with SMTP id h15mr23838671eje.391.1593747150849; Thu, 02 Jul 2020 20:32:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593747150; cv=none; d=google.com; s=arc-20160816; b=z+mCxQJv5HNB+a5btaeO6LgiAcaRC6T0KA+rWjlrR4+hBZ195/M8fh3Qas/j8ZOKST A4UgvIAEL/Q7NYe+Os9eg5CEMNr/PI+EhOyX+CjNhb38yhcWhJmD1cXm9QL+wpgD/hMH JXxL9cnsj66/Ua70rl5q9Wo0E8bqXQN/JlU/6nVvrYPuOEokEcztS/M/WWTnn97fuc0u 8NByln9KX8oC25M+YLjo8dWzvFJRgPe6y8N5PPO4I18is4DYI4w1oCODLyDQ+Gbf06KS fc6agdJbXpLWCYwd5jdKy/hR6acmn2gJw/UmgUkHZal0AzZPuX7ZuLvG4NRXGlgH/z1F 5haw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=PqpjpUM3kX4oVN6gYwvKINgQE9eg136f9PGb0w1ay74=; b=sQ0f13yZCB/8pBa5PRTZa3M1FiENhyUuY7slfSokzgiRjhYhO+L3MrU5SmoV6hBfeO EJL2H4MdRN+iuy1Y4HxoBWzyXTqsjPLKvRDVNDp2U2vwCsB2oCdiNQWZlJJq5LeDUZ8i 4MZw+r7ZYdpCe/HTqpk3DbsllCuJucGiSEwb0RWxPfRi9GiRvKAryYEAgovAQsYaiW1T uUJDbh8VDN+uQgZALNAbpuJC2e64xIvsENj6DH2A0h0ea3TEAf8m9cau8Hxbjkrec9lX mWitZPYUHNQ14xfmvL+1fbHVLtU+Rl4VQhytzDC0YWyu8ofSpSSa2OQqXHhuNqWNwc8B TNuQ== 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 h13si6281751ejl.692.2020.07.02.20.32.07; Thu, 02 Jul 2020 20:32:30 -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 S1726183AbgGCD2W (ORCPT + 99 others); Thu, 2 Jul 2020 23:28:22 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:33623 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726148AbgGCD2V (ORCPT ); Thu, 2 Jul 2020 23:28:21 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 3 Jul 2020 06:28:16 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (dev-l-vrt-136.mtl.labs.mlnx [10.234.136.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0633SFHC006800; Fri, 3 Jul 2020 06:28:15 +0300 Received: from dev-l-vrt-136.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id 0633SFT4006667; Fri, 3 Jul 2020 06:28:15 +0300 Received: (from moshe@localhost) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id 0633SF9J006666; Fri, 3 Jul 2020 06:28:15 +0300 From: Moshe Shemesh To: "David S. Miller" Cc: Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vladyslav Tarasiuk Subject: [PATCH net-next v2 6/7] net/mlx5e: Move devlink port register and unregister calls Date: Fri, 3 Jul 2020 06:27:37 +0300 Message-Id: <1593746858-6548-7-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1593746858-6548-1-git-send-email-moshe@mellanox.com> References: <1593746858-6548-1-git-send-email-moshe@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vladyslav Tarasiuk Register devlink ports upon NIC init. TX and RX health reporters handle errors which may occur early on at driver initialization. And because these reporters are to be moved to port context, they require devlink ports to be already registered. Signed-off-by: Vladyslav Tarasiuk Reviewed-by: Moshe Shemesh Reviewed-by: Jiri Pirko --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 046cfb0..f080c5a4 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5096,6 +5096,9 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev, if (err) mlx5_core_err(mdev, "TLS initialization failed, %d\n", err); mlx5e_build_nic_netdev(netdev); + err = mlx5e_devlink_port_register(priv); + if (err) + mlx5_core_err(mdev, "mlx5e_devlink_port_register failed, %d\n", err); mlx5e_health_create_reporters(priv); return 0; @@ -5104,6 +5107,7 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev, static void mlx5e_nic_cleanup(struct mlx5e_priv *priv) { mlx5e_health_destroy_reporters(priv); + mlx5e_devlink_port_unregister(priv); mlx5e_tls_cleanup(priv); mlx5e_ipsec_cleanup(priv); mlx5e_netdev_cleanup(priv->netdev, priv); @@ -5536,16 +5540,10 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev) goto err_destroy_netdev; } - err = mlx5e_devlink_port_register(priv); - if (err) { - mlx5_core_err(mdev, "mlx5e_devlink_port_register failed, %d\n", err); - goto err_detach; - } - err = register_netdev(netdev); if (err) { mlx5_core_err(mdev, "register_netdev failed, %d\n", err); - goto err_devlink_port_unregister; + goto err_detach; } mlx5e_devlink_port_type_eth_set(priv); @@ -5553,8 +5551,6 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev) mlx5e_dcbnl_init_app(priv); return priv; -err_devlink_port_unregister: - mlx5e_devlink_port_unregister(priv); err_detach: mlx5e_detach(mdev, priv); err_destroy_netdev: @@ -5575,7 +5571,6 @@ static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv) priv = vpriv; mlx5e_dcbnl_delete_app(priv); unregister_netdev(priv->netdev); - mlx5e_devlink_port_unregister(priv); mlx5e_detach(mdev, vpriv); mlx5e_destroy_netdev(priv); } -- 1.8.3.1