This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Re: EDOSK-2674 ethernet drivers -TCP problem
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Yoshinori Sato <ysato at users dot sourceforge dot jp>
- Cc: Uwe Kindler <ukindler at htwm dot de>, ecos-discuss at sources dot redhat dot com
- Date: Fri, 5 Dec 2003 09:54:13 +0100
- Subject: Re: [ECOS] Re: EDOSK-2674 ethernet drivers -TCP problem
- References: <49977.141.55.192.70.1069250772.squirrel@www.htwm.de> <m2llpzffqs.wl%ysato@users.sourceforge.jp>
Hi Yoshinori
> @@ -803,7 +803,7 @@
>
> CYG_ASSERT(0 == (len & 1) || (i == (sg_len-1)), "odd length");
> CYG_ASSERT( sdata, "No sg data pointer here" );
> - while(len >= sizeof(*sdata)) {
> + while(len > 0) {
> put_data(sc, *sdata++);
> len -= sizeof(*sdata);
> }
I don't know this chip at all, im just reading the code and deciding
if to commit your patch. sizeof(*sdata) is 2. The original code will
exist the loop when len == 0 or 1 and in these cases *sdata points to
the end of the packet, or the last byte. Your change means it will
exit when len == 0 or -1 and in these cases, *sdata points to the end
of the packet, or one byte after the end of the packet.
So when len is odd, the original code *sdate points to the last byte
and your code *sdata points to some junk after the end of the packet.
The code that follows is:
control = 0;
if ( 1 & plen ) {
// Need to set ODD flag and insert the data
unsigned char onebyte = *(unsigned char*)sdata;
control = onebyte;
control |= LAN91CXX_CONTROLBYTE_ODD;
}
ie if we have an odd length packet, get the last byte at *sdata and
put it into a control word.
It looks to me your change causes random junk to be in the control
word.
Am i reading this wrong?
Thanks
Andrew
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss