From nobody Fri Jul 30 19:35:47 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 6FE1012D8757 for ; Fri, 30 Jul 2021 19:35:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GbyLC2b6cz3hvk for ; Fri, 30 Jul 2021 19:35:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 40A282C5F for ; Fri, 30 Jul 2021 19:35:47 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 16UJZlhD046332 for ; Fri, 30 Jul 2021 19:35:47 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 16UJZlxq046331 for bugs@FreeBSD.org; Fri, 30 Jul 2021 19:35:47 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 257511] iflib: enabling promisc under netmap causes lockup when interface is down Date: Fri, 30 Jul 2021 19:35:47 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 12.2-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: brian90013@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D257511 Bug ID: 257511 Summary: iflib: enabling promisc under netmap causes lockup when interface is down Product: Base System Version: 12.2-STABLE Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: brian90013@gmail.com Created attachment 226806 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D226806&action= =3Dedit Test program demonstrating issue Hello, I am using the igb driver to collect packets promiscuously. Since I am using netmap, I placed the ioctl(SIOCSIFFLAGS) call to enable promisc after netmap configuration. That way I avoid sending a flood of packets up the network s= tack if there are packets flowing in on start up. However, I have noticed if I follow these steps, but have not also marked the interface as up, the driver will lock up when I try to receive packets. In my testing, killing the proc= ess does not solve the problem - I end up rebooting to restore functionality. I have observed this with multiple iflib drivers - igb, ixgbe, ixl, and ice - leading me to strongly believe it is a problem in iflib. Other drivers I ha= ve tested don't allow netmap configuration for an interface that isn't up. The test program I attached shows my procedure. By running './promisc netmap:igb0', the program opens the port in netmap, then sets the promisc b= it, then tries to read a packet. If the interface is up, everything works and it prints 'success'. If the interface is not up, the program will hang. I often don't assign an address to a port that is being used by netmap for promiscu= ous mode so this problem gets me. Looking at the iflib.c code, function iflib_if_ioctl(), the SIOCSIFFLAGS ca= se checks if the interface is up, then if running, and finally checks the bits= . If the interface is down as in my example, then it checks for running - which I believe is true since netmap has been initialized. In that conditional, the function calls iflib_stop() which has the following comment in it: /* * Stop any pending txsync/rxsync and prevent new ones * form starting. Processes blocked in poll() will get * POLLERR. */ netmap_disable_all_rings(ctx->ifc_ifp); The ioctl() call returns 0 in this case so there's no sign that netmap has = been disabled. However, when the poll() call then tries to rxsync() it hangs. I can avoid problems by making sure the interface is always up before start= ing my program. However, I'd prefer iflib not hang should an interface be down. --=20 You are receiving this mail because: You are the assignee for the bug.=