From owner-svn-src-user@FreeBSD.ORG Thu Sep 29 05:16:53 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EBADD106564A; Thu, 29 Sep 2011 05:16:53 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C245C8FC08; Thu, 29 Sep 2011 05:16:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8T5GrKV005779; Thu, 29 Sep 2011 05:16:53 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8T5Gra1005777; Thu, 29 Sep 2011 05:16:53 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109290516.p8T5Gra1005777@svn.freebsd.org> From: Adrian Chadd Date: Thu, 29 Sep 2011 05:16:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225862 - user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416 X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Sep 2011 05:16:54 -0000 Author: adrian Date: Thu Sep 29 05:16:53 2011 New Revision: 225862 URL: http://svn.freebsd.org/changeset/base/225862 Log: General RX interrupt mitigation fixes. * From what I can tell, interrupt mitigation doesn't mitigate RXERR events, only RXOK events. I'm waiting for confirmation from Atheros, but this is what their driver does. * Yes, RXOK is set in AR_ISR even if it is clear in AR_IMR. So make sure HAL_INT_RX isn't set if interrupt mitigation is enabled. * Add/remove comments in order to better document what is going on. Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Thu Sep 29 03:37:42 2011 (r225861) +++ user/adrian/if_ath_tx/sys/dev/ath/ath_hal/ar5416/ar5416_interrupts.c Thu Sep 29 05:16:53 2011 (r225862) @@ -132,17 +132,6 @@ ar5416GetPendingInterrupts(struct ath_ha return AH_FALSE; } - /* - * XXX TODO: see whether the hardware signals AR_ISR_RXOK - * even if RX interrupt mitigation is enabled (but then - * doesn't trigger an interrupt per RX packet) - which means - * we'll be setting HAL_INT_RX even before the RX mitigation - * timers have expired. - * - * XXX TODO: do the same for the TX interrupts and TX interrupt - * mitigation. - */ - *masked = isr & HAL_INT_COMMON; if (isr & (AR_ISR_RXMINTR | AR_ISR_RXINTM)) { @@ -153,9 +142,21 @@ ar5416GetPendingInterrupts(struct ath_ha } /* - * Don't signal this when doing interrupt mitigation + * When doing RX interrupt mitigation, the RXOK bit is set + * in AR_ISR even if the relevant bit in AR_IMR is clear. + * Since this interrupt may be due to another source, don't + * just automatically set HAL_INT_RX if it's set, otherwise + * we could prematurely service the RX queue. + * + * In some cases, the driver can even handle all the RX + * frames just before the mitigation interrupt fires. + * The subsequent RX processing trip will then end up + * processing 0 frames. */ -#ifndef AH_AR5416_INTERRUPT_MITIGATION +#ifdef AH_AR5416_INTERRUPT_MITIGATION + if (isr & AR_ISR_RXERR) + *masked |= HAL_INT_RX; +#else if (isr & (AR_ISR_RXOK | AR_ISR_RXERR)) *masked |= HAL_INT_RX; #endif