[U-Boot] Fw: Changing the App to fix a driver problem?

Jon Nettleton jon at solid-run.com
Sun Jun 3 10:41:52 UTC 2018


On Wed, May 30, 2018 at 7:13 PM, Duncan Hare <dh at synoia.com> wrote:
>
>
> Subject: Re: [U-Boot] [PATCH 2/2] net: ping,arp: Fix cache alignment
>     issues
> Message-ID: <099414db-a264-a3ac-8aae-fb8aa0d969ee at denx.de>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> On 28.05.2018 08:33, Baruch Siach wrote:
>> From: Jon Nettleton <jon at solid-run.com>
>>
>> Both ping_receive and arp_receive would transmit a received packet
>> back out using its original point.  This causes problems with
>> certain network cards that add a custom header to the packet.
>> Specifically the mvneta driver for the Armada series boards has
>> a 2 byte Marvell header that is bypassed and passed along to
>> the system, but that 2 byte offset now causes a misalignment if
>> it is attempted to be sent back out.
>>
>> Rather than changing the driver to memcpy all the received packets
>> to cache aligned buffers we instead change the two offending
>> network commands to copy the packet into a cache aligned net_tx_packet
>> before sending it back out.
>>
>> This fixes occasional messages like:
>>
>>    CACHE: Misaligned operation at range [3fc01082, 3fc010c2]
>>
> ___________________________________________________________________
>
> This is not a good idea. I believe it should be implemented in the driver.
> Putting it in in the app code leads to confusion
> as to its purpose.
>

This is merely aligning these two commands to work the same way that
all the other net commands work.  All of bootp.c, cdp.c, rarp.c, and
lastly net.c use the global net_tx_packet, which is cache aligned, to
pass a packet into the network driver stack.  The patch is
standardizing all of the net commands to behave the same way, along
the way it fixes a problem that could exist with many drivers.  Why
debug this possible problem in every driver when it can be fixed in a
common codeplace.  This is most likely the reason that all the other
libraries are written in this manner.  I think it is more confusing
for every network driver developer to possibly have to debug this
issue because the behaviour is inconsistent between different network
utilities.

-Jon


More information about the U-Boot mailing list