From: Gerhard Engleder <gerhard@engleder-embedded.com>
To: Shradha Gupta <shradhagupta@linux.microsoft.com>,
linux-hyperv@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org
Cc: "K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Long Li <longli@microsoft.com>, Simon Horman <horms@kernel.org>,
Konstantin Taranov <kotaranov@microsoft.com>,
Souradeep Chakrabarti <schakrabarti@linux.microsoft.com>,
Erick Archer <erick.archer@outlook.com>,
Pavan Chebbi <pavan.chebbi@broadcom.com>,
Ahmed Zaki <ahmed.zaki@intel.com>,
Colin Ian King <colin.i.king@gmail.com>,
Shradha Gupta <shradhagupta@microsoft.com>
Subject: Re: [PATCH net-next] net: mana: Improve mana_set_channels() for low mem conditions
Date: Thu, 29 Aug 2024 21:54:18 +0200 [thread overview]
Message-ID: <d73d45af-e76e-4e87-8df1-0ed71e823abc@engleder-embedded.com> (raw)
In-Reply-To: <1724941006-2500-1-git-send-email-shradhagupta@linux.microsoft.com>
On 29.08.24 16:16, Shradha Gupta wrote:
> The mana_set_channels() function requires detaching the mana
> driver and reattaching it with changed channel values.
> During this operation if the system is low on memory, the reattach
> might fail, causing the network device being down.
> To avoid this we pre-allocate buffers at the beginning of set operation,
> to prevent complete network loss
>
> Signed-off-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
> ---
> .../ethernet/microsoft/mana/mana_ethtool.c | 28 +++++++++++--------
> 1 file changed, 16 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
> index d6a35fbda447..5077493fdfde 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_ethtool.c
> @@ -345,27 +345,31 @@ static int mana_set_channels(struct net_device *ndev,
> struct mana_port_context *apc = netdev_priv(ndev);
> unsigned int new_count = channels->combined_count;
> unsigned int old_count = apc->num_queues;
> - int err, err2;
> + int err;
> +
> + apc->num_queues = new_count;
> + err = mana_pre_alloc_rxbufs(apc, ndev->mtu);
> + apc->num_queues = old_count;
Are you sure that temporary changing num_queues has no side effects on
other num_queues users like mana_chn_setxdp()?
Gerhard
next prev parent reply other threads:[~2024-08-29 21:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 14:16 [PATCH net-next] net: mana: Improve mana_set_channels() for low mem conditions Shradha Gupta
2024-08-29 19:54 ` Gerhard Engleder [this message]
2024-08-29 21:00 ` Haiyang Zhang
2024-08-30 5:13 ` Shradha Gupta
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=d73d45af-e76e-4e87-8df1-0ed71e823abc@engleder-embedded.com \
--to=gerhard@engleder-embedded.com \
--cc=ahmed.zaki@intel.com \
--cc=colin.i.king@gmail.com \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=erick.archer@outlook.com \
--cc=haiyangz@microsoft.com \
--cc=horms@kernel.org \
--cc=kotaranov@microsoft.com \
--cc=kuba@kernel.org \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=schakrabarti@linux.microsoft.com \
--cc=shradhagupta@linux.microsoft.com \
--cc=shradhagupta@microsoft.com \
--cc=wei.liu@kernel.org \
/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