Re: [RFC PATCH 4/4] can: bxcan: add support for ST bxCAN controller
From: Marc Kleine-Budde
Date: Thu Aug 18 2022 - 09:08:31 EST
On 18.08.2022 12:30:31, Marc Kleine-Budde wrote:
> One step at a time, let's look at the TX path:
>
> On 17.08.2022 16:35:29, Dario Binacchi wrote:
> > +static netdev_tx_t bxcan_start_xmit(struct sk_buff *skb,
> > + struct net_device *ndev)
> > +{
> > + struct bxcan_priv *priv = netdev_priv(ndev);
> > + struct can_frame *cf = (struct can_frame *)skb->data;
> > + struct bxcan_regs *regs = priv->regs;
> > + struct bxcan_mb *mb_regs;
>
> __iomem?
>
> > + unsigned int mb_id;
> > + u32 id, tsr;
> > + int i, j;
> > +
> > + if (can_dropped_invalid_skb(ndev, skb))
> > + return NETDEV_TX_OK;
> > +
> > + tsr = readl(®s->tsr);
> > + mb_id = ffs((tsr & BXCAN_TSR_TME) >> BXCAN_TSR_TME_SHIFT);
>
> We want to send the CAN frames in the exact order they are pushed into
> the driver, so don't pick the first free mailbox you find. How a
are
> priorities for the TX mailboxes handled?
>
> Is the mailbox with the lowest number send first? Is there a priority
> field in the mailbox?
I just had a look into the data sheet and it says that the TX mailboxes
are handled in transmit request order. This is good.
[...]
> The mcp251xfd has a proper hardware FIFO ring buffer for TX, the bxcan
> probably doesn't. The get_tx_free() check is a bit different. Look at
> c_can_get_tx_free() in:
This means you can use the simpler get_tx_free from the mcp251xfd driver.
>
> | https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=28e86e9ab522e65b08545e5008d0f1ac5b19dad1
>
> This patch is a good example for the relevant changes.
This patch is non the less a good example for the TX path.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Attachment:
signature.asc
Description: PGP signature