This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug fix in cl_8900a ethernet driver


>> Laurent Gonzalez wrote:
>> hi folks,
>>
>> the file attached contains a patch to fix this bug.
>>
>>
>> In cs8900a_send, the cast from data to sdata is not safe. If data is not
>> aligned on a short boundary (even address), the 16bit read with the
>> pointer sdata, may return an unpredictible value or raise an alignement
>> error (depending the hardware).
>> The bug will happen if the variable odd_byte becomes true, and the next
>> packet has an aligned value for data. the first byte is joined with
>> saved_data, and the pointer data becomes odd.
>>
>Thanks for spotting this. This indeed looks like a problem, although
>I'm slightly concerned that the patch is endian-specific.... but
>looking at the driver, it looks to be endian-specific in its treatment
>of odd_byte too. Nevertheless, I thought I may as well fix it just in
>case since even if the CS8900 is only ever used with ARMs which it may
>be, ARMs have been known to be big-endian.


Jonathan, just FYI

It can be (and is) used with big endian targets as well ! Wuerz sells a
CS8900a based ethernet card for their ec555 board. Have a look at
http://www.wuerz-elektronik.com/Modules/MPC555/10_base_ETHERNET/10_base_ethernet.html

The patch on
http://sources.redhat.com/ml/ecos-patches/2003-03/msg00013.html
tries to make the driver independent of endianness and has been tested
with this particular ethernet card.

Bob




>However it's somewhat sub-optimal to _always_ resort to byte fiddling.
>Most times the amount of data to be spent will be large enough that
>optimising the aligned case is worth it. So I've created the attached
>patch. Since I don't have cs8900 hardware, please let me know if it
>works for you and I'll check it in!
>
>
>Jifl
-- 
----------------------------------------------------------------------
ir. Bob Koninckx
Katholieke Universiteit Leuven       
Division Production Engineering,                   tel.  +32 16 322535
Machine Design and Automation                      fax.  +32 16 322987
Celestijnenlaan 300B                  bob dot koninckx at mech dot kuleuven dot ac dot be
B-3001 Leuven Belgium               http://www.mech.kuleuven.ac.be/pma
----------------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]