[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240827132637.31b7eb36@kernel.org>
Date: Tue, 27 Aug 2024 13:26:37 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Souradeep Chakrabarti <schakrabarti@...ux.microsoft.com>
Cc: kys@...rosoft.com, haiyangz@...rosoft.com, wei.liu@...nel.org,
decui@...rosoft.com, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, longli@...rosoft.com, yury.norov@...il.com,
leon@...nel.org, cai.huoqing@...ux.dev, ssengar@...ux.microsoft.com,
vkuznets@...hat.com, tglx@...utronix.de, linux-hyperv@...r.kernel.org,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-rdma@...r.kernel.org, schakrabarti@...rosoft.com
Subject: Re: [PATCH V2 net] net: mana: Fix error handling in
mana_create_txq/rxq's NAPI cleanup
On Fri, 23 Aug 2024 02:44:29 -0700 Souradeep Chakrabarti wrote:
> @@ -2023,14 +2024,17 @@ static void mana_destroy_rxq(struct mana_port_context *apc,
>
> napi = &rxq->rx_cq.napi;
>
> - if (validate_state)
> - napi_synchronize(napi);
> + if (napi->dev == apc->ndev) {
>
> - napi_disable(napi);
> + if (validate_state)
> + napi_synchronize(napi);
>
> - xdp_rxq_info_unreg(&rxq->xdp_rxq);
> + napi_disable(napi);
>
> - netif_napi_del(napi);
> + netif_napi_del(napi);
> + }
> +
> + xdp_rxq_info_unreg(&rxq->xdp_rxq);
Please don't use internal core state as a crutch for your cleanup.
IDK what "validate_state" stands for, but it gives you all the info you
need on Rx. On Rx NAPI registration happens as the last stage of rxq
activation, once nothing can fail. And the "cleanup" path calls destroy
with validate_state=false. The only other caller passes true.
So you can rewrite this as:
if (validate_state) { /* rename it maybe? */
napi_disable(napi);
...
}
xdp_rxq_info_unreg(&rxq->xdp_rxq);
You can take similar approach with Tx. Pass a bool which tells the
destroy function whether NAPI has been registered.
--
pw-bot: cr
Powered by blists - more mailing lists