shithub: riscv

Download patch

ref: 382abccf277ff1323b0f2d2aecdad9a74175ad09
parent: ce07c1d6e70948f731ea02c6c523ea4c1e0ae977
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Sep 17 10:06:03 EDT 2016

nusb/ether: multicast and promisc support for rtl8150 (url)

--- a/sys/src/cmd/nusb/ether/url.c
+++ b/sys/src/cmd/nusb/ether/url.c
@@ -300,6 +300,37 @@
 	freeb(b);
 }
 
+static int
+urlpromiscuous(Dev *d, int on)
+{
+	int r;
+
+	r = csr16r(d, Rcr);
+	if(on)
+		r |= Aam|Aap;
+	else {
+		r &= ~Aap;
+		if(nmulti == 0)
+			r &= ~Aam;
+	}
+	return csr16w(d, Rcr, r);
+}
+
+static int
+urlmulticast(Dev *d, uchar*, int)
+{
+	int r;
+
+	r = csr16r(d, Rcr);
+	if(nmulti)
+		r |= Aam;
+	else {
+		if(nprom == 0)
+			r &= ~Aam;
+	}
+	return csr16w(d, Rcr, r);
+}
+
 int
 urlinit(Dev *d)
 {
@@ -325,5 +356,8 @@
 
 	epreceive = urlreceive;
 	eptransmit = urltransmit;
+	eppromiscuous = urlpromiscuous;
+	epmulticast = urlmulticast;
+
 	return 0;
 }