From: Andrew Lunn <andrew@lunn.ch>
To: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Uwe Kindler <ukindler@htwm.de>, ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Re: EDOSK-2674 ethernet drivers -TCP problem
Date: Fri, 05 Dec 2003 08:54:00 -0000 [thread overview]
Message-ID: <20031205085413.GG2527@lunn.ch> (raw)
In-Reply-To: <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
next prev parent reply other threads:[~2003-12-05 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-19 14:06 [ECOS] " Uwe Kindler
2003-11-29 13:48 ` [ECOS] " Yoshinori Sato
2003-12-05 8:54 ` Andrew Lunn [this message]
2003-12-05 10:24 ` [ECOS] Re: STL support under eCos, what does it take? Giovanni Perbellini
2003-12-05 14:52 ` [ECOS] Re: EDOSK-2674 ethernet drivers -TCP problem Uwe Kindler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031205085413.GG2527@lunn.ch \
--to=andrew@lunn.ch \
--cc=ecos-discuss@sources.redhat.com \
--cc=ukindler@htwm.de \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).