[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220818130814.z7b4rvmld6wvk4fg@pengutronix.de>
Date: Thu, 18 Aug 2022 15:08:14 +0200
From: Marc Kleine-Budde <mkl@...gutronix.de>
To: Dario Binacchi <dario.binacchi@...rulasolutions.com>
Cc: linux-kernel@...r.kernel.org,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Amarula patchwork <linux-amarula@...rulasolutions.com>,
michael@...rulasolutions.com, Dario Binacchi <dariobin@...ero.it>,
linux-can@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [RFC PATCH 4/4] can: bxcan: add support for ST bxCAN controller
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 |
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists