From: David Miller <davem@davemloft.net>
To: vee.khee.wong@intel.com
Cc: peppe.cavallaro@st.com, alexandre.torgue@st.com,
joabreu@synopsys.com, kuba@kernel.org, mcoquelin.stm32@gmail.com,
linux@armlinux.org.uk, netdev@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, boon.leong.ong@intel.com,
weifeng.voon@intel.com, yoong.siang.song@intel.com,
sadhishkhanna.vijaya.balan@intel.com, chen.yong.seow@intel.com
Subject: Re: [PATCH net-next] net: stmmac: Add support to Ethtool get/set ring parameters
Date: Wed, 16 Sep 2020 15:25:50 -0700 (PDT) [thread overview]
Message-ID: <20200916.152550.1833517348137875378.davem@davemloft.net> (raw)
In-Reply-To: <20200916074020.25491-1-vee.khee.wong@intel.com>
From: Wong Vee Khee <vee.khee.wong@intel.com>
Date: Wed, 16 Sep 2020 15:40:20 +0800
> +int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size)
> +{
> + struct stmmac_priv *priv = netdev_priv(dev);
> + int ret = 0;
> +
> + if (netif_running(dev))
> + stmmac_release(dev);
...
> + if (netif_running(dev))
> + ret = stmmac_open(dev);
> +
I've applied this patch but this approach is so fragile, but everyone
does it initially because it is so easy.
The problem here is that for so many reasons the stmmac_open() can
fail, and instead of just the ringparam() operation failing, the
interface becomes down and unusable.
Can you please eventually implement this properly? Allocate the new
ring resources, and only commit the new configuration if it is
guaranteed to succeed. Otherwise, backout the ringparam change
and keep the old configuration.
This way the device stays up regardless of whether the resources
(memory, DMA mappings, etc.) can be allocated fully.
Right now, if you do a ringparam under hard memory pressure, this will
take the inteface down as stmmac_open() fails.
prev parent reply other threads:[~2020-09-16 22:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 7:40 Wong Vee Khee
2020-09-16 22:25 ` David Miller [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=20200916.152550.1833517348137875378.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=alexandre.torgue@st.com \
--cc=boon.leong.ong@intel.com \
--cc=chen.yong.seow@intel.com \
--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=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=peppe.cavallaro@st.com \
--cc=sadhishkhanna.vijaya.balan@intel.com \
--cc=vee.khee.wong@intel.com \
--cc=weifeng.voon@intel.com \
--cc=yoong.siang.song@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
all inboxes | Powered by JetHome®