Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp497826ybt; Fri, 10 Jul 2020 05:26:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxaQIwhDmdXDP39RiETg3HNB42karO75F2lPAbIg/0ZqrwParBVtyNxiodoJ3w8Afp9DFx X-Received: by 2002:a17:906:9348:: with SMTP id p8mr39479551ejw.467.1594384017460; Fri, 10 Jul 2020 05:26:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594384017; cv=none; d=google.com; s=arc-20160816; b=WrXKCDVDuJNWcOHg++98Cz2nE3IrV+u22Mg60Q0MuGADinjeO1DwPvrUj0ciDxCYHk 5/ZXgU25dgqsLlnGlptKKSLR0q2ch5UR3jxc9j5prfELa1bsz8d5EUGUUicUsBxtYvFM IRqGIER9Rus6Veew2fN06KdTlGWFrpNvjUTXJupdJzmbhWjnpnstooiovAaObZEMFfVE EjfM+I+mX+gGDWWfN7MXp7XUHxYb/dxdg9J778UDKAeVAV7M/6SyXDA5a7syvAY9L0iw JfRRrN3dH3oOkDF6UDGRpZOVTW8UtrCUd1QVMqg00QpSPjQgc0/kZI6haGP41m7jkDHM 5HFw== 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=wVpPODyxAMD21kUIsFT+d7PF9eUJRt69uPOZeIxE5ss=; b=T9LT7QkoQCmN9DGsCngbclHw6WO/FZyM/buECVwMOzU6Zms1vbm9DnrH/w13Nmwtej 9E9e9X8D25QJJUexJTAspvu+dEhBkjf59+wsu0OX6/pBsd5FOMBLqk71Jd3S+2vhmpXg jp/LLoi/5uc8ifmCYaV1Dk2xYI3O6P7Whu+tvlsA4apSjS4SvmLMWUBPXuRnUH/0oYrv 1lTZ4I4IjxHe4vwpVa7dnRXYDUWjbXKxLm043Waa8cgZrpH8e0sPh3zwBR2axuZLbyva /RV2sUGs494zlg19cJfZPsv8kplceWovZTKYjtK+coG1oQOOvRlgwWeGcyFP2m6Y12MZ oPqA== 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 dd11si3643904edb.79.2020.07.10.05.26.32; Fri, 10 Jul 2020 05:26:57 -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 S1727989AbgGJM0E (ORCPT + 99 others); Fri, 10 Jul 2020 08:26:04 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:51799 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727886AbgGJMZz (ORCPT ); Fri, 10 Jul 2020 08:25:55 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from moshe@mellanox.com) with SMTP; 10 Jul 2020 15:25:49 +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 06ACPnIQ012404; Fri, 10 Jul 2020 15:25:49 +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 06ACPnhw003380; Fri, 10 Jul 2020 15:25:49 +0300 Received: (from moshe@localhost) by dev-l-vrt-136.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id 06ACPnBx003379; Fri, 10 Jul 2020 15:25:49 +0300 From: Moshe Shemesh To: "David S. Miller" , Jakub Kicinski Cc: Jiri Pirko , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Vladyslav Tarasiuk Subject: [PATCH net-next v3 6/7] net/mlx5e: Move devlink port register and unregister calls Date: Fri, 10 Jul 2020 15:25:12 +0300 Message-Id: <1594383913-3295-7-git-send-email-moshe@mellanox.com> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1594383913-3295-1-git-send-email-moshe@mellanox.com> References: <1594383913-3295-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 b04c857..e054726 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -5086,6 +5086,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; @@ -5094,6 +5097,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); @@ -5526,16 +5530,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); @@ -5543,8 +5541,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: @@ -5565,7 +5561,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