9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] [patch] ethervirtio - fix multicast without a cmd queue
@ 2023-12-17 17:26 Arne Meyer
  2023-12-17 21:08 ` cinap_lenrek
  0 siblings, 1 reply; 5+ messages in thread
From: Arne Meyer @ 2023-12-17 17:26 UTC (permalink / raw)
  To: 9front

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

Hello,

this fixes multicast on hypervisors without a command queue for the ethernet interface, like OpenBSD.
Right now the driver does not install a multicast function when no command queue is available. This breaks multicast because the network stack errors out in netif.c:netmulti. To fix this, move the check for the queue to the multicast and promiscuous functions and install those functions unconditionally.

Greetings,
Arne

[-- Attachment #2: ethervirtio.patch --]
[-- Type: application/octet-stream, Size: 2088 bytes --]

diff 9d09242bee8489b6cdee246489063488bb52b1fb uncommitted
--- a/sys/src/9/pc/ethervirtio.c
+++ b/sys/src/9/pc/ethervirtio.c
@@ -479,8 +479,12 @@
 promiscuous(void *arg, int on)
 {
 	Ether *edev = arg;
+	Ctlr *ctlr = edev->ctlr;
 	uchar b[1];
 
+	if((ctlr->feat & (Fctrlvq|Fctrlrx)) != (Fctrlvq|Fctrlrx))
+		return;
+
 	b[0] = on != 0;
 	vctlcmd(edev, CtrlRx, CmdPromisc, b, sizeof(b));
 }
@@ -489,8 +493,12 @@
 multicast(void *arg, uchar*, int)
 {
 	Ether *edev = arg;
+	Ctlr *ctlr = edev->ctlr;
 	uchar b[1];
 
+	if((ctlr->feat & (Fctrlvq|Fctrlrx)) != (Fctrlvq|Fctrlrx))
+		return;
+
 	b[0] = edev->nmaddr > 0;
 	vctlcmd(edev, CtrlRx, CmdAllmulti, b, sizeof(b));
 }
@@ -671,11 +679,8 @@
 	edev->attach = attach;
 	edev->shutdown = shutdown;
 	edev->ifstat = ifstat;
-
-	if((ctlr->feat & (Fctrlvq|Fctrlrx)) == (Fctrlvq|Fctrlrx)){
-		edev->multicast = multicast;
-		edev->promiscuous = promiscuous;
-	}
+	edev->multicast = multicast;
+	edev->promiscuous = promiscuous;
 
 	pcisetbme(ctlr->pcidev);
 	intrenable(edev->irq, interrupt, edev, edev->tbdf, edev->name);
--- a/sys/src/9/port/ethervirtio10.c
+++ b/sys/src/9/port/ethervirtio10.c
@@ -528,8 +528,12 @@
 promiscuous(void *arg, int on)
 {
 	Ether *edev = arg;
+	Ctlr *ctlr = edev->ctlr;
 	uchar b[1];
 
+	if((ctlr->feat[0] & (Fctrlvq|Fctrlrx)) != (Fctrlvq|Fctrlrx))
+		return;
+
 	b[0] = on != 0;
 	vctlcmd(edev, CtrlRx, CmdPromisc, b, sizeof(b));
 }
@@ -538,8 +542,12 @@
 multicast(void *arg, uchar*, int)
 {
 	Ether *edev = arg;
+	Ctlr *ctlr = edev->ctlr;
 	uchar b[1];
 
+    if((ctlr->feat[0] & (Fctrlvq|Fctrlrx)) != (Fctrlvq|Fctrlrx))
+		return;
+
 	b[0] = edev->nmaddr > 0;
 	vctlcmd(edev, CtrlRx, CmdAllmulti, b, sizeof(b));
 }
@@ -774,11 +782,9 @@
 	edev->attach = attach;
 	edev->shutdown = shutdown;
 	edev->ifstat = ifstat;
+	edev->multicast = multicast;
+	edev->promiscuous = promiscuous;
 
-	if((ctlr->feat[0] & (Fctrlvq|Fctrlrx)) == (Fctrlvq|Fctrlrx)){
-		edev->multicast = multicast;
-		edev->promiscuous = promiscuous;
-	}
 
 	pcisetbme(ctlr->pcidev);
 	intrenable(edev->irq, interrupt, edev, edev->tbdf, edev->name);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-19 19:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-17 17:26 [9front] [patch] ethervirtio - fix multicast without a cmd queue Arne Meyer
2023-12-17 21:08 ` cinap_lenrek
2023-12-18  7:29   ` Arne Meyer
2023-12-19 17:38     ` cinap_lenrek
2023-12-19 19:41     ` cinap_lenrek

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