Messages in this thread | | | Date | Mon, 9 Oct 2023 16:26:32 +0200 | From | Herve Codina <> | Subject | Re: [PATCH v7 10/30] net: wan: Add support for QMC HDLC |
| |
Hi Jakub,
On Fri, 6 Oct 2023 14:47:02 -0700 Jakub Kicinski <kuba@kernel.org> wrote:
> On Thu, 28 Sep 2023 09:06:28 +0200 Herve Codina wrote: > > +static int qmc_hdlc_close(struct net_device *netdev) > > +{ > > + struct qmc_hdlc *qmc_hdlc = netdev_to_qmc_hdlc(netdev); > > + struct qmc_hdlc_desc *desc; > > + int i; > > + > > + netif_stop_queue(netdev); > > + > > + qmc_chan_stop(qmc_hdlc->qmc_chan, QMC_CHAN_ALL); > > + qmc_chan_reset(qmc_hdlc->qmc_chan, QMC_CHAN_ALL); > > stopping the queue looks a bit racy, a completion may come in > and restart the queue
Indeed, qmc_hdlc_xmit_complete() completion can restart the queue.
I will call netif_stop_queue() after calling qmc_chan_stop/reset(). This is the simple way to fix that without adding an internal flag.
Thanks for pointing that.
Best regards, Hervé
> > > + for (i = 0; i < ARRAY_SIZE(qmc_hdlc->tx_descs); i++) { > > + desc = &qmc_hdlc->tx_descs[i]; > > + if (!desc->skb) > > + continue; > > + dma_unmap_single(qmc_hdlc->dev, desc->dma_addr, desc->dma_size, > > + DMA_TO_DEVICE); > > + kfree_skb(desc->skb); > > + desc->skb = NULL; > > + } > > + > > + for (i = 0; i < ARRAY_SIZE(qmc_hdlc->rx_descs); i++) { > > + desc = &qmc_hdlc->rx_descs[i]; > > + if (!desc->skb) > > + continue; > > + dma_unmap_single(qmc_hdlc->dev, desc->dma_addr, desc->dma_size, > > + DMA_FROM_DEVICE); > > + kfree_skb(desc->skb); > > + desc->skb = NULL; > > + } > > + > > + hdlc_close(netdev);
| |