From owner-freebsd-bugs@freebsd.org Tue Jan 23 18:14:44 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F153EBDF9A for ; Tue, 23 Jan 2018 18:14:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40DDE63AF3 for ; Tue, 23 Jan 2018 18:14:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 1D8AA6F90 for ; Tue, 23 Jan 2018 18:14:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w0NIEh5G059741 for ; Tue, 23 Jan 2018 18:14:43 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w0NIEhYA059732 for freebsd-bugs@FreeBSD.org; Tue, 23 Jan 2018 18:14:43 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: freebsd-bugs@FreeBSD.org Subject: [Bug 225408] re_rxeof erroneously returns EAGAIN, resulting in unnecessary processing Date: Tue, 23 Jan 2018 18:14:44 +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: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: aaron.styx@baesystems.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-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 MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Jan 2018 18:14:44 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D225408 Bug ID: 225408 Summary: re_rxeof erroneously returns EAGAIN, resulting in unnecessary processing Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: aaron.styx@baesystems.com Created attachment 190006 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D190006&action= =3Dedit if (maxpkt =3D=3D 0) return EAGAIN; In trying to diagnose a separate issue, I discovered that the interrupt processing of re_int_task was leaving interrupts disabled far more often th= an seemed appropriate. The return value from re_rxeof was returning EAGAIN when handling stray packets on the network, and returning 0 when under heavy tra= ffic load. If my understanding of the re_rxeof function is correct, it is supposed to process at most 16 packets before returning. The variable maxpkt starts at = 16 and is decremented each time a packet is processed. If maxpkt gets to zero,= the routine returns and *should* tell the caller whether or not there is more d= ata to process. However, the check of 'if (maxpkt) return EAGAIN;' will return EAGAIN when the loop has cleared the entire receive ring before processing = 16 packets; i.e.: when it's done processing everything available. I believe it should be returning EAGAIN only when it has processed 16 packets and there = is still more to do.=20 The attached patch changes the check to return EAGAIN when maxpkt reaches 0= . If there were exactly 16 packets to process, this could mean it would also erroneously return EAGAIN, so there may be a better way to check if the rin= g is empty.=20 The driver still works as is, but it does spend more time processing than is necessary when there is really nothing to do. Under load it may not enqueue= the processing task when it should, but further interrupts should generally keep things moving. --=20 You are receiving this mail because: You are the assignee for the bug.=