Re: [PATCH 1/4] net: wan: Add support for QMC HDLC

From: Herve Codina
Date: Wed Jan 24 2024 - 09:52:29 EST


Hi Vadim,

On Wed, 24 Jan 2024 10:03:45 +0000
Vadim Fedorenko <vadim.fedorenko@xxxxxxxxx> wrote:

[...]

> > +static void qmc_hcld_recv_complete(void *context, size_t length, unsigned int flags)
> > +{
> > + struct qmc_hdlc_desc *desc = context;
> > + struct net_device *netdev = desc->netdev;
> > + struct qmc_hdlc *qmc_hdlc = netdev_to_qmc_hdlc(desc->netdev);
>
> a line above desc->netdev was stored in netdev. better to reuse it and
> make declaration part consistent with qmc_hcld_xmit_complete

Yes.
Will updated in the next iteration.

[...]

> > +static netdev_tx_t qmc_hdlc_xmit(struct sk_buff *skb, struct net_device *netdev)
> > +{
> > + struct qmc_hdlc *qmc_hdlc = netdev_to_qmc_hdlc(netdev);
> > + struct qmc_hdlc_desc *desc;
> > + unsigned long flags;
> > + int ret;
> > +
> > + spin_lock_irqsave(&qmc_hdlc->tx_lock, flags);
> > + desc = &qmc_hdlc->tx_descs[qmc_hdlc->tx_out];
> > + if (desc->skb) {
> > + /* Should never happen.
> > + * Previous xmit should have already stopped the queue.
> > + */
>
> according to the comment it's better to make if(unlikely(desc->skb)) or
> even WARN_ONCE()
>

Indeed. I will use WARN_ONCE() in the next iteration.

Thanks for your review,
Hervé