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

Quan Nguyen quan at os.amperecomputing.com
Thu Nov 30 19:39:45 AEDT 2023



On 30/11/2023 15:03, Jeremy Kerr wrote:
> Hi Quan,
> 
>> If arbitration is lost, __i2c_transfer() returns -EAGAIN and the
>> packet should be resent.
>>
>> Requeue the packet and increase collisions count on this case.
> 
> Are you sure you want to re-queue the packet here? The i2c core would
> have already retried on arbitration loss:
> 
>    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/i2c/i2c-core-base.c#n2223
> 
> With this change, we would be disregarding the limits in adap->retries
> and/or adap->timeout.
> 

Yes, the __i2c_transfer() does try its best to send the packet but if it 
still fail with -EAGAIN, that means it still unable to win the arbitration.

Without this patch we usually see the error below. The consequence is it 
stop and need the PLDM layer to retry when timed out, which takes time.

"[   61.616210] i2c i2c-3: __i2c_transfer failed -11"

With this commit, we all see the packets go through peacefully just by 
requeueing the packets at MCTP layer and eliminated the need to retry in 
PLDM layer which would need more time.

The result in our test is as below (Note: would needs some addition 
debug print code). I also think it is worth noting that in our setup 
there are multiple Masters.

[73183.511487] i2c i2c-3: Arbitration loss, re-queue the packet
[73192.550519] i2c i2c-3: __i2c_transfer failed -11
[73192.555734] i2c i2c-3: Arbitration loss, re-queue the packet
[73207.250036] i2c i2c-3: __i2c_transfer failed -11
[73207.255247] i2c i2c-3: Arbitration loss, re-queue the packet
[73429.499875] i2c i2c-3: __i2c_transfer failed -11
[73429.505116] i2c i2c-3: Arbitration loss, re-queue the packet
[73504.672065] i2c i2c-3: __i2c_transfer failed -11
[73504.677317] i2c i2c-3: Arbitration loss, re-queue the packet
[73540.762984] i2c i2c-3: __i2c_transfer failed -11
[73540.768242] i2c i2c-3: Arbitration loss, re-queue the packet
[73631.040049] i2c i2c-3: __i2c_transfer failed -11
[73631.045333] i2c i2c-3: Arbitration loss, re-queue the packet
[73648.538967] i2c i2c-3: __i2c_transfer failed -11

Thanks,
- Quan


More information about the openbmc mailing list