Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp150809pxk; Wed, 16 Sep 2020 22:10:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQw7N74HXrxovBHODtiUlxJ0B45+JD6+k3yEVqRQOPFyRE8RQ5xPfuX+pLnHqo+dHW4DLA X-Received: by 2002:a17:906:c830:: with SMTP id dd16mr29652078ejb.196.1600319414861; Wed, 16 Sep 2020 22:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600319414; cv=none; d=google.com; s=arc-20160816; b=kPvLEETHTJsqEJY5e+vbyakgur5lkkHtdc0phuGPYFt+SrIm+9kjG7JrSpj7TbvbHX tRoQXeIBTys8Y7V2Dnw6KpChPwu0TvhlRcLg+OwmsKEe3Pu0uq53M/A9pzewFmhClHTW WR6Pp3oJ6ae1V7Vs2tI4CuWrNhkYf6kWUhInCrMbJb8CoTTIIsbCApina8TicvmA2esM FTL0/wCvqiFe23eoXFu4hriq0Qe8lsuXOMTLsLQYJ8Lt2bmjN8cGuUutVl89hcje+C78 GIBCPFP1wz6sZYESBc90nDu8tgVt8d1JPtXFqsNvAiXpTkw6DJPiQ9FUYdGDy+kxfKZ4 esYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:ironport-sdr :ironport-sdr; bh=qxasiFDnc1h7ODd9u0D4qDsELMf8lv5905hsik0X9A8=; b=CLNes6z1zKJX93IGeoMEMbgvdNa9qvv8Gau4GRHyRMR8ruQ6VqrpfG2BVsRvlkcN79 Y3PJw09SCaPMkaBfBiCm0dkueuJKfoQ/otCYCwDnYOYKc+Dy5XhdafEtB+g3/qdxVEWj AYqAVhOVJGfouOcarR96KOEzPr1jR6U5mHQLy5JAM8QAknNfBwnqUR3Rk48MvSSQeWQE J41d8UqkbeImegID5AQnzR2SW6pk+GrQBDxE/K9c8g/6lKQtyJx3v+71bSJKRf+1VSE9 8fEsZlKFPag/GaR4MqXUGUNUYN/fZWdgngD9e5qnYzGoeG+CAbSZ2ShomUPfA0/U2icI dgMg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn20si15263069ejc.196.2020.09.16.22.09.49; Wed, 16 Sep 2020 22:10: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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726139AbgIQFHl (ORCPT + 99 others); Thu, 17 Sep 2020 01:07:41 -0400 Received: from mga09.intel.com ([134.134.136.24]:6023 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726072AbgIQFHj (ORCPT ); Thu, 17 Sep 2020 01:07:39 -0400 X-Greylist: delayed 431 seconds by postgrey-1.27 at vger.kernel.org; Thu, 17 Sep 2020 01:07:39 EDT IronPort-SDR: FD7SVIALda3pF/NeBxGpzzV0YtII6kDNtoJU/dgeP+GsyVC5Ag5c5X5RzyWNwxkt5Js8kCOMjq eKFcMHKosVpQ== X-IronPort-AV: E=McAfee;i="6000,8403,9746"; a="160554351" X-IronPort-AV: E=Sophos;i="5.76,435,1592895600"; d="scan'208";a="160554351" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2020 22:00:27 -0700 IronPort-SDR: I2vTLVsvX8h5UF3mjIn+RSOOfj8ujvCbbBOZ/jLwXgFn+5ric5R27/Gx/NcaTmohGr5vo0j2bz KubqHSfrvIVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,435,1592895600"; d="scan'208";a="508258776" Received: from glass.png.intel.com ([172.30.181.92]) by fmsmga005.fm.intel.com with ESMTP; 16 Sep 2020 22:00:24 -0700 From: Wong Vee Khee To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , Maxime Coquelin Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ong Boon Leong , Voon Wei Feng , Tan Tee Min , Wong Vee Khee , Vijaya Balan Sadhishkhanna , Seow Chen Yong Subject: [PATCH net-next] net: stmmac: introduce rtnl_lock|unlock() on configuring real_num_rx|tx_queues Date: Thu, 17 Sep 2020 13:02:15 +0800 Message-Id: <20200917050215.8725-1-vee.khee.wong@intel.com> X-Mailer: git-send-email 2.17.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Tan, Tee Min" For driver open(), rtnl_lock is acquired by network stack but not in the resume(). Therefore, we introduce lock_acquired boolean to control when to use rtnl_lock|unlock() within stmmac_hw_setup(). Fixes: 686cff3d7022 ("net: stmmac: Fix incorrect location to set real_num_rx|tx_queues") Signed-off-by: Tan, Tee Min --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index df2c74bbfcff..22e6a3defa78 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -2607,7 +2607,8 @@ static void stmmac_safety_feat_configuration(struct stmmac_priv *priv) * 0 on success and an appropriate (-)ve integer as defined in errno.h * file on failure. */ -static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) +static int stmmac_hw_setup(struct net_device *dev, bool init_ptp, + bool lock_acquired) { struct stmmac_priv *priv = netdev_priv(dev); u32 rx_cnt = priv->plat->rx_queues_to_use; @@ -2715,9 +2716,15 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp) } /* Configure real RX and TX queues */ + if (!lock_acquired) + rtnl_lock(); + netif_set_real_num_rx_queues(dev, priv->plat->rx_queues_to_use); netif_set_real_num_tx_queues(dev, priv->plat->tx_queues_to_use); + if (!lock_acquired) + rtnl_unlock(); + /* Start the ball rolling... */ stmmac_start_all_dma(priv); @@ -2804,7 +2811,7 @@ static int stmmac_open(struct net_device *dev) goto init_error; } - ret = stmmac_hw_setup(dev, true); + ret = stmmac_hw_setup(dev, true, true); if (ret < 0) { netdev_err(priv->dev, "%s: Hw setup failed\n", __func__); goto init_error; @@ -5238,7 +5245,7 @@ int stmmac_resume(struct device *dev) stmmac_clear_descriptors(priv); - stmmac_hw_setup(ndev, false); + stmmac_hw_setup(ndev, false, false); stmmac_init_coalesce(priv); stmmac_set_rx_mode(ndev); -- 2.17.0