9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: jmk@plan9.bell-labs.com
To: 9fans@cse.psu.edu
Subject: Re: [9fans] ether8139.c fix
Date: Thu,  7 Mar 2002 12:59:28 -0500	[thread overview]
Message-ID: <d8d618efa2331a72ab5d975fcb42789d@plan9.bell-labs.com> (raw)

OK. I think we all got confused about this. Turns out I thought
the fix posted by geoff@collyer.net was referring to the 2nd memmove in
the receive code, where the real problem lay and which I had already
fixed some time before. My apologies for not taking time to verify
the fix was what I thought it was.

Anyway, in conjunction with Presotto I've tested the following which
completely replaces the code in rtl8139receive() for handling an OK packet:


		/*
		 * Receive Completed OK.
		 * Very simplistic; there are ways this could be done
		 * without copying, but the juice probably isn't worth
		 * the squeeze.
		 * The packet length includes a 4 byte CRC on the end.
		 */
		capr = (capr+4) % ctlr->rblen;
		p = ctlr->rbstart+capr;
		capr = (capr+length) % ctlr->rblen;

		if((bp = iallocb(length)) != nil){
			if(p+length >= ctlr->rbstart+ctlr->rblen){
				l = ctlr->rbstart+ctlr->rblen - p;
				memmove(bp->wp, p, l);
				bp->wp += l;
				length -= l;
				p = ctlr->rbstart;
			}
			if(length > 0){
				memmove(bp->wp, p, length);
				bp->wp += length;
			}
			bp->wp -= 4;
			etheriq(edev, bp, 1);
		}

		capr = ROUNDUP(capr, 4);
		csr16w(ctlr, Capr, capr-16);


             reply	other threads:[~2002-03-07 17:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-07 17:59 jmk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-03-07 14:08 presotto
2002-03-07 15:01 ` Boyd Roberts
2002-03-07  4:07 jmk
2002-03-07  4:07 Plan9
2002-03-07  3:14 geoff
2002-03-07  4:52 ` Jason Gurtz
2002-03-05 15:26 jmk
2002-03-04  0:00 geoff
2002-03-05  9:40 ` Don

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=d8d618efa2331a72ab5d975fcb42789d@plan9.bell-labs.com \
    --to=jmk@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /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 NNTP newsgroup(s).