9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [PATCH] nusb/ether: Don't pass ethernet fcs to the network stack for smsc and lan78xx
@ 2024-06-05 16:52 Arne Meyer
  0 siblings, 0 replies; only message in thread
From: Arne Meyer @ 2024-06-05 16:52 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 201 bytes --]

tested on a rpi3 for smsc. the lan78xx is basically the same and openbsd's mue(4) also strips the fcs.
So this should be fine.

I did this patch with git/export, hope I did it correct.

Greetings,
Arne

[-- Attachment #2: nusbether.diff --]
[-- Type: application/octet-stream, Size: 919 bytes --]

From: Arne Meyer <meyer.arne83@netcologne.de>
Date: Wed, 05 Jun 2024 09:22:31 +0000
Subject: [PATCH] nusb/ether: Don't pass ethernet fcs to the network stack for smsc and lan78xx

---
diff 828c577e03e15f59a69bff965893e3a670a8f10f 585b55096bcf7e1e6dbb1152a41daec714fee522
--- a/sys/src/cmd/nusb/ether/lan78xx.c
+++ b/sys/src/cmd/nusb/ether/lan78xx.c
@@ -252,10 +252,11 @@
 			break;
 		if((hd & Rxerror) == 0){
 			if(n == BLEN(b)){
+				b->wr -= 4;
 				etheriq(b);
 				return 0;
 			}
-			etheriq(copyblock(b, n));
+			etheriq(copyblock(b, n - 4));
 		}
 		b->rp = (uchar*)(((uintptr)b->rp + n + 3)&~3);
 	}
--- a/sys/src/cmd/nusb/ether/smsc.c
+++ b/sys/src/cmd/nusb/ether/smsc.c
@@ -228,10 +228,11 @@
 			break;
 		if((hd & Rxerror) == 0){
 			if(n == BLEN(b)){
+				b->wp -= 4;
 				etheriq(b);
 				return 0;
 			}
-			etheriq(copyblock(b, n));
+			etheriq(copyblock(b, n - 4));
 		}
 		b->rp += (n + 3) & ~3;
 	}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-06-05 16:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05 16:52 [9front] [PATCH] nusb/ether: Don't pass ethernet fcs to the network stack for smsc and lan78xx Arne Meyer

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).