linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Cc: linux-kernel@vger.kernel.org,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Amarula patchwork <linux-amarula@amarulasolutions.com>,
	michael@amarulasolutions.com, Dario Binacchi <dariobin@libero.it>,
	linux-can@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [RFC PATCH 4/4] can: bxcan: add support for ST bxCAN controller
Date: Thu, 18 Aug 2022 15:08:14 +0200	[thread overview]
Message-ID: <20220818130814.z7b4rvmld6wvk4fg@pengutronix.de> (raw)
In-Reply-To: <20220818103031.m7bl6gbzcc76etig@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 2010 bytes --]

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(&regs->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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-08-18 13:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 14:35 [RFC PATCH 0/4] can: bxcan: add support for ST bxCAN controller Dario Binacchi
2022-08-17 14:35 ` [RFC PATCH 1/4] dt-bindings: net: can: add STM32 bxcan DT bindings Dario Binacchi
2022-08-18  8:22   ` Krzysztof Kozlowski
2022-08-20  8:08     ` Dario Binacchi
2022-08-22 17:39       ` Krzysztof Kozlowski
2022-08-26  7:20         ` Dario Binacchi
2022-08-17 14:35 ` [RFC PATCH 2/4] ARM: dts: stm32: add CAN support on stm32f429 Dario Binacchi
2022-08-17 14:35 ` [RFC PATCH 3/4] ARM: dts: stm32: add pin map for CAN controller on stm32f4 Dario Binacchi
2022-08-18  8:22   ` Krzysztof Kozlowski
2022-08-17 14:35 ` [RFC PATCH 4/4] can: bxcan: add support for ST bxCAN controller Dario Binacchi
2022-08-18 10:30   ` Marc Kleine-Budde
2022-08-18 13:08     ` Marc Kleine-Budde [this message]
2022-08-17 21:16 ` [RFC PATCH 0/4] " Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220818130814.z7b4rvmld6wvk4fg@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=alexandre.torgue@foss.st.com \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=dariobin@libero.it \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael@amarulasolutions.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).