From: Leon Romanovsky <leonro@nvidia.com>
To: Wong Vee Khee <vee.khee.wong@intel.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>,
Voon Wei Feng <weifeng.voon@intel.com>,
netdev@vger.kernel.org, Tan Tee Min <tee.min.tan@intel.com>,
linux-kernel@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
Seow Chen Yong <chen.yong.seow@intel.com>,
Jose Abreu <joabreu@synopsys.com>,
Vijaya Balan Sadhishkhanna <sadhishkhanna.vijaya.balan@intel.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
Ong Boon Leong <boon.leong.ong@intel.com>,
Giuseppe Cavallaro <peppe.cavallaro@st.com>,
"David S . Miller" <davem@davemloft.net>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next] net: stmmac: introduce rtnl_lock|unlock() on configuring real_num_rx|tx_queues
Date: Thu, 17 Sep 2020 10:06:14 +0300 [thread overview]
Message-ID: <20200917070614.GP486552@unreal> (raw)
In-Reply-To: <20200917050215.8725-1-vee.khee.wong@intel.com>
On Thu, Sep 17, 2020 at 01:02:15PM +0800, Wong Vee Khee wrote:
> From: "Tan, Tee Min" <tee.min.tan@intel.com>
>
> 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().
Doesn't really make sense, if function needs to have lock acquired, the
caller is supposed to take it and function should have proper lockdep
annotation inside and not this conditional lock/unlock.
Thanks
>
> Fixes: 686cff3d7022 ("net: stmmac: Fix incorrect location to set real_num_rx|tx_queues")
>
Extra line.
> Signed-off-by: Tan, Tee Min <tee.min.tan@intel.com>
> ---
> 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
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-09-17 7:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 5:02 [PATCH net-next] net: stmmac: introduce rtnl_lock|unlock() on configuring real_num_rx|tx_queues Wong Vee Khee
2020-09-17 7:06 ` Leon Romanovsky [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200917070614.GP486552@unreal \
--to=leonro@nvidia.com \
--cc=alexandre.torgue@st.com \
--cc=boon.leong.ong@intel.com \
--cc=chen.yong.seow@intel.com \
--cc=davem@davemloft.net \
--cc=joabreu@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=sadhishkhanna.vijaya.balan@intel.com \
--cc=tee.min.tan@intel.com \
--cc=vee.khee.wong@intel.com \
--cc=weifeng.voon@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).