Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9989212ybi; Wed, 24 Jul 2019 13:39:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvAf0XlG7v4MYofi+Bh1El3RG3Ce1T/8+7DKIe2kdiVjLM7wbD4OCymUDhF5WBnFyCVkRv X-Received: by 2002:a63:494d:: with SMTP id y13mr84483310pgk.109.1564000764999; Wed, 24 Jul 2019 13:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000764; cv=none; d=google.com; s=arc-20160816; b=m47mhPrJgvoAhechZcNS7ftChg7UoXMQ67RLH0hr7OD6uiOp1xWG/jfwYbgbgr6ght pyzMtWWfDnoj/4gOlOL9zGQzrtKssr3eeKnbFfKXiyXHm/SfKrRMrajFX8M4Syoja9Db LcC8nkLDveqGwbOhUNPKsJJroXllAxxP2yIcCuB+LI/LU4ESLvBWKk8QfFAyU5v+mlpX gVdQbUCUWqdufPfN1m9E0qwIOr8V6Rdv8CgCJ6TkQXufOlNIc9Kaj2KB49Y9CUfdgGTp aI4ra98zUqqRuufL4xB0zbxYqRzR0CNjpjLCDVvJdi382Pted9QECz2ueu8KEm8A2lf1 JFiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vXjjhMDSf2obmNyZhkustPgAJozWhT9WVNoZBvyi7WI=; b=VhIEgiUb9FXHwjhjml5DmaVULrr583OdD+mC6PxpEYf+nW/wlyj//GC2vEqaZVNsXu GkIdpwsbFNP7b5gq8ZqUdHn1quH5vR1BWKbSb4OgfFJjBuD46EfqtttBMPR3QjYduz4T daGgzdxLAxFVWoH4gIJs1ATsUkqG1W5vc1jOon6ayaN5RbIlGSLBczGswh9lr/swJ0m1 60fUAEOnryTTE423lur13LjZKq6zEJooFhI+iNZxwbfnnoTqRhJwteUU7CPcScuftru2 bEpOPESakSJc4diO3axDtZLic7mRc7zgMGtBy8JowW6kgCXTICXGxIS74FGfb52dzQbo K6NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lNL7ToT6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s24si15457211pfh.227.2019.07.24.13.39.10; Wed, 24 Jul 2019 13:39:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lNL7ToT6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387954AbfGXTYd (ORCPT + 99 others); Wed, 24 Jul 2019 15:24:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:40784 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729056AbfGXTYb (ORCPT ); Wed, 24 Jul 2019 15:24:31 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DD0522387; Wed, 24 Jul 2019 19:24:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996270; bh=/m+OpmSi6461DEttxrd1JK+QUeBO2w8QPWSmaVlv9LE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lNL7ToT6nIm2yvcR8GOvvohsgvlrrSk6Ub0PNkViwYD+zP8kTdIakLibDhhvpPuf+ pEZNHkUcBEWk7+wqom0DKSW1LmACckyvsnvMHSw3BjjTECqwECBRfPhWTyYax0iqgj acpc4sCKeqh/b45DPWBOW7Ievytkxt8lTDUsxpIk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brett Creeley , Anirudh Venkataramanan , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 5.2 032/413] ice: Fix couple of issues in ice_vsi_release Date: Wed, 24 Jul 2019 21:15:23 +0200 Message-Id: <20190724191737.862012030@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit aa6ccf3f2d7042f94c4e91538956ce7051e7856e ] Currently the driver is calling ice_napi_del() and then unregister_netdev(). The call to unregister_netdev() will result in a call to ice_stop() and then ice_vsi_close(). This is where we call napi_disable() for all the MSI-X vectors. This flow is reversed so make the changes to ensure napi_disable() happens prior to napi_del(). Before calling napi_del() and free_netdev() make sure unregister_netdev() was called. This is done by making sure the __ICE_DOWN bit is set in the vsi->state for the interested VSI. Signed-off-by: Brett Creeley Signed-off-by: Anirudh Venkataramanan Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice.h | 1 - drivers/net/ethernet/intel/ice/ice_lib.c | 24 ++++++++++++----------- drivers/net/ethernet/intel/ice/ice_main.c | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h index 792e6e42030e..754c7080c3fc 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h @@ -451,7 +451,6 @@ int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size); void ice_print_link_msg(struct ice_vsi *vsi, bool isup); -void ice_napi_del(struct ice_vsi *vsi); #ifdef CONFIG_DCB int ice_pf_ena_all_vsi(struct ice_pf *pf, bool locked); void ice_pf_dis_all_vsi(struct ice_pf *pf, bool locked); diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index fbf1eba0cc2a..f14fa51cc704 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -2754,19 +2754,14 @@ int ice_vsi_release(struct ice_vsi *vsi) if (vsi->type == ICE_VSI_VF) vf = &pf->vf[vsi->vf_id]; - /* do not unregister and free netdevs while driver is in the reset - * recovery pending state. Since reset/rebuild happens through PF - * service task workqueue, its not a good idea to unregister netdev - * that is associated to the PF that is running the work queue items - * currently. This is done to avoid check_flush_dependency() warning - * on this wq + /* do not unregister while driver is in the reset recovery pending + * state. Since reset/rebuild happens through PF service task workqueue, + * it's not a good idea to unregister netdev that is associated to the + * PF that is running the work queue items currently. This is done to + * avoid check_flush_dependency() warning on this wq */ - if (vsi->netdev && !ice_is_reset_in_progress(pf->state)) { - ice_napi_del(vsi); + if (vsi->netdev && !ice_is_reset_in_progress(pf->state)) unregister_netdev(vsi->netdev); - free_netdev(vsi->netdev); - vsi->netdev = NULL; - } if (test_bit(ICE_FLAG_RSS_ENA, pf->flags)) ice_rss_clean(vsi); @@ -2799,6 +2794,13 @@ int ice_vsi_release(struct ice_vsi *vsi) ice_rm_vsi_lan_cfg(vsi->port_info, vsi->idx); ice_vsi_delete(vsi); ice_vsi_free_q_vectors(vsi); + + /* make sure unregister_netdev() was called by checking __ICE_DOWN */ + if (vsi->netdev && test_bit(__ICE_DOWN, vsi->state)) { + free_netdev(vsi->netdev); + vsi->netdev = NULL; + } + ice_vsi_clear_rings(vsi); ice_vsi_put_qs(vsi); diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c index 7843abf4d44d..dbf3d39ad8b1 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -1667,7 +1667,7 @@ static int ice_req_irq_msix_misc(struct ice_pf *pf) * ice_napi_del - Remove NAPI handler for the VSI * @vsi: VSI for which NAPI handler is to be removed */ -void ice_napi_del(struct ice_vsi *vsi) +static void ice_napi_del(struct ice_vsi *vsi) { int v_idx; -- 2.20.1