Re: [PATCH] mctp i2c: Requeue the packet when arbitration is lost

From: Quan Nguyen
Date: Fri Dec 01 2023 - 06:47:50 EST




On 01/12/2023 15:38, Jeremy Kerr wrote:
Hi Quan,

As per [1], __i2c_transfer() will retry for adap->retries times
consecutively (without any wait) within the amount of time specified
by adap->timeout.

So as per my observation, once it loses the arbitration, the next
retry is most likely still lost as another controller who win the
arbitration may still be using the bus.

In general (and specifically with your hardware setup), the controller
should be waiting for a bus-idle state before attempting the
retransmission. You may well hit another arbitration loss after that,
but it won't be from the same bus activity.


Yes, that is the correct behaviour and I think that is why __i2c_transfer() return -EAGAIN when arbitration loss.

One example I could find in kernel tree is here [a], and, it seems not to totally rely on the retry mechanism implemented in i2c core.

[a] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/video/fbdev/omap2/omapfb/displays/connector-dvi.c#n157

Anyway, it's been great to discuss on this topic. To answer your questions I did have to dig around and have learn a lot. :-)

My sincere thanks to you,
- Quan