Re: [PATCH v7 4/7] can: Add Nuvoton NCT6694 CANFD support
From: Marc Kleine-Budde
Date: Fri Feb 07 2025 - 10:52:42 EST
On 08.02.2025 00:00:43, Vincent Mailhol wrote:
> On 07/02/2025 at 21:15, Marc Kleine-Budde wrote:
> > On 07.02.2025 15:44:59, Ming Yu wrote:
>
> (...)
>
> >> +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;
> >> +
> >> + netif_stop_queue(ndev);
> >> + can_put_echo_skb(skb, ndev, 0, 0);
> >> + queue_work(priv->wq, &priv->tx_work);
>
> What is the reason to use a work queue here? xmit() is not a hard IRQ.
> Also, the other USB CAN devices just directly send the USB message in
> their xmit() without the need to rely on such worker.
>
> Sorry if this was discussed in the past, I can not remember if this
> question has already been raised.
AFAICS xmit uses nct6694_write_msg(), which uses several usb_bulk_msg(),
that can only be used from task context.
You can build a chain of usb_fill_bulk_urb(), usb_submit_urb(),
callbacks instead, but that's hard to read compared to blocking
usb_bulk_msg()s.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung Nürnberg | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Attachment:
signature.asc
Description: PGP signature