On 29/04/2021 15:49, Ignat Korchagin wrote: > On Thu, Apr 29, 2021 at 3:22 PM Edward Cree <ecree.xilinx@xxxxxxxxx> wrote: >> >> On 27/04/2021 22:09, Ignat Korchagin wrote: >>> + if (xdp_queue_number) >> Wait, why is this guard condition needed? >> What happens if we had nonzero efx->xdp_tx_queue_count initially, but we end up >> with no TXQs available for XDP at all (so xdp_queue_number == 0)? >> >> -ed > > My thoughts were: efx->xdp_tx_queue_count is originally used to > allocate efx->xdp_tx_queues. > So, if xdp_queue_number ends up being 0, we should keep > efx->xdp_tx_queue_count positive not > to forget to release efx->xdp_tx_queues (because most checks are > efx->xdp_tx_queue_count && efx->xdp_tx_queues). Well, we allocated it in this function, so could we not just free it (and NULL it) if we get here with xdp_queue_number == 0? Assuming it even makes sense for those checks to be that conjunction, and not just efx->xdp_tx_queues. > I'm not familiar enough with SFC internals to definitely say if it is > even possible to have > xdp_queue_number == 0 while having efx->xdp_tx_queue_count > 0 If it's possible for us to get xdp_queue_number != efx->xdp_tx_queue_count at all (which I can't remember exactly how it happens, but I think it's a case of not getting as many VIs back from firmware as we wanted, which happens after the initial determination of numbers of queues & channels), then it's possible that our number of available TXQs is reduced far enough that we don't have any left for XDP. At least, I think so; this part of the driver confuses me too :S -ed