Two fixes:
makerom checksum check calculation was a no-op nb8390.c had a bug which caused packet_len to be incorrect for packets which wrapped in the buffer. Submitted by: Linux developers (I lost the email with their names)
This commit is contained in:
parent
e831f30876
commit
204c7704d9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=20334
@ -36,9 +36,9 @@ main(argc,argv)
|
||||
for (i=0,sum=0; i<ROMSIZE; i++)
|
||||
sum += rom[i];
|
||||
rom[5] = -sum;
|
||||
for (i=0,sum=0; i<ROMSIZE; i++);
|
||||
for (i=0,sum=0; i<ROMSIZE; i++)
|
||||
sum += rom[i];
|
||||
if (sum)
|
||||
if (sum & 0x00FF)
|
||||
printf("checksum fails.\n");
|
||||
if (lseek(fd, (off_t)0, SEEK_SET) < 0) {
|
||||
perror("unable to seek");
|
||||
|
@ -489,7 +489,7 @@ eth_poll()
|
||||
int ret = 0;
|
||||
unsigned short type = 0;
|
||||
unsigned char bound,curr,rstat;
|
||||
unsigned short len;
|
||||
unsigned short len, copylen;
|
||||
unsigned short pktoff;
|
||||
unsigned char *p;
|
||||
struct ringbuffer pkthdr;
|
||||
@ -528,7 +528,7 @@ eth_poll()
|
||||
bound = pkthdr.bound; /* New bound ptr */
|
||||
if ( (pkthdr.status & D8390_RSTAT_PRX) && (len > 14) && (len < 1518)) {
|
||||
p = packet;
|
||||
packetlen = len;
|
||||
packetlen = copylen = len;
|
||||
len = (eth_memsize << 8) - pktoff;
|
||||
if (packetlen > len) { /* We have a wrap-around */
|
||||
if (eth_flags & FLAG_PIO)
|
||||
@ -537,12 +537,12 @@ eth_poll()
|
||||
bcopy(eth_rmem + pktoff, p, len);
|
||||
pktoff = (eth_tx_start + D8390_TXBUF_SIZE) << 8;
|
||||
p += len;
|
||||
packetlen -= len;
|
||||
copylen -= len;
|
||||
}
|
||||
if (eth_flags & FLAG_PIO)
|
||||
eth_pio_read(pktoff, p, packetlen);
|
||||
eth_pio_read(pktoff, p, copylen);
|
||||
else
|
||||
bcopy(eth_rmem + pktoff, p, packetlen);
|
||||
bcopy(eth_rmem + pktoff, p, copylen);
|
||||
|
||||
type = (packet[12]<<8) | packet[13];
|
||||
ret = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user