On Tue, Aug 27, 2024 at 01:26:37PM -0700, Jakub Kicinski wrote: > 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. Thanks Jakub for the suggestion. I have changed the implementation in the V3. I have added a new txq and rxq structure attribute to check that per queue napi is initialized. The use of a local flag like validate_state will not be possible with current design of txq destroy function, as it uses the hole vport and loops for all the queues for that port. - Souradeep > -- > pw-bot: cr