lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOoeyxVK=iBmj3BDX=D8a9=GFBkE158jbq3Rnq-RuoA5HxMi7g@mail.gmail.com>
Date: Thu, 16 Jan 2025 14:34:40 +0800
From: Ming Yu <a0282524688@...il.com>
To: Vincent Mailhol <mailhol.vincent@...adoo.fr>
Cc: linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org, 
	linux-i2c@...r.kernel.org, linux-can@...r.kernel.org, netdev@...r.kernel.org, 
	linux-watchdog@...r.kernel.org, linux-hwmon@...r.kernel.org, 
	linux-rtc@...r.kernel.org, linux-usb@...r.kernel.org, tmyu0@...oton.com, 
	lee@...nel.org, linus.walleij@...aro.org, brgl@...ev.pl, 
	andi.shyti@...nel.org, mkl@...gutronix.de, andrew+netdev@...n.ch, 
	davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, 
	wim@...ux-watchdog.org, linux@...ck-us.net, jdelvare@...e.com, 
	alexandre.belloni@...tlin.com
Subject: Re: [PATCH v5 4/7] can: Add Nuvoton NCT6694 CAN support

Hi Vincent,

I will remove priv->tx_skb in the next patch, but it seems that
can_flush_echo_skb() has not been EXPORT_SYMBOL_GPL().

I would like to know if nct6694_can_clean() requires modification.

Vincent Mailhol <mailhol.vincent@...adoo.fr> 於 2025年1月16日 週四 上午12:45寫道:
> > +static void nct6694_can_clean(struct net_device *ndev)
> > +{
> > +     struct nct6694_can_priv *priv = netdev_priv(ndev);
> > +
> > +     if (priv->tx_skb || netif_queue_stopped(ndev))
> > +             ndev->stats.tx_errors++;
> > +     dev_kfree_skb(priv->tx_skb);
>
> Use:
>
>         can_flush_echo_skb(ndev);
>
> (related to the following comments).
>
> > +     priv->tx_skb = NULL;
> > +}
>
> (...)
>
> > +static void nct6694_can_tx_work(struct work_struct *work)
> > +{
> > +     struct nct6694_can_priv *priv = container_of(work,
> > +                                                  struct nct6694_can_priv,
> > +                                                  tx_work);
> > +     struct net_device *ndev = priv->ndev;
> > +
> > +     guard(mutex)(&priv->lock);
> > +
> > +     if (priv->tx_skb) {
> > +             if (priv->can.state == CAN_STATE_BUS_OFF) {
>
> Just stop the queue when the can bus is off so that you do not have do
> check the bus status each time a frame is sent.
>
> > +                     nct6694_can_clean(ndev);
> > +             } else {
> > +                     nct6694_can_tx(ndev);
> > +                     can_put_echo_skb(priv->tx_skb, ndev, 0, 0);
> > +                     priv->tx_skb = NULL;
> > +             }
> > +     }
> > +}
> > +
> > +static netdev_tx_t nct6694_can_start_xmit(struct sk_buff *skb,
> > +                                       struct net_device *ndev)
> > +{
> > +     struct nct6694_can_priv *priv = netdev_priv(ndev);
> > +
> > +     if (can_dev_dropped_skb(ndev, skb))
> > +             return NETDEV_TX_OK;
> > +
> > +     if (priv->tx_skb) {
> > +             netdev_err(ndev, "hard_xmit called while tx busy\n");
> > +             return NETDEV_TX_BUSY;
> > +     }
> > +
> > +     netif_stop_queue(ndev);
> > +     priv->tx_skb = skb;
>
> Here, you can directly do:
>
>         can_put_echo_skb(skb, ndev, 0, 0);
>
> The skb remains accessible under priv->can.echo_skb[0]. With this, you
> can remove the priv->tx_skb field.
>
> > +     queue_work(priv->wq, &priv->tx_work);
> > +
> > +     return NETDEV_TX_OK;
> > +}
>

Thanks,
Ming

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ