From owner-svn-src-user@FreeBSD.ORG Wed Jan 25 15:58:12 2012 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 50C95106566C; Wed, 25 Jan 2012 15:58:12 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 25C188FC12; Wed, 25 Jan 2012 15:58:12 +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 q0PFwCxc031398; Wed, 25 Jan 2012 15:58:12 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0PFwCTk031396; Wed, 25 Jan 2012 15:58:12 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <201201251558.q0PFwCTk031396@svn.freebsd.org> From: Luigi Rizzo Date: Wed, 25 Jan 2012 15:58:12 +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: r230542 - user/luigi/netmap/sys/dev/ixgbe 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: Wed, 25 Jan 2012 15:58:12 -0000 Author: luigi Date: Wed Jan 25 15:58:11 2012 New Revision: 230542 URL: http://svn.freebsd.org/changeset/base/230542 Log: explain how interrupt mitigation is implemented in netmap Modified: user/luigi/netmap/sys/dev/ixgbe/ixgbe.c Modified: user/luigi/netmap/sys/dev/ixgbe/ixgbe.c ============================================================================== --- user/luigi/netmap/sys/dev/ixgbe/ixgbe.c Wed Jan 25 14:50:12 2012 (r230541) +++ user/luigi/netmap/sys/dev/ixgbe/ixgbe.c Wed Jan 25 15:58:11 2012 (r230542) @@ -3386,6 +3386,7 @@ ixgbe_txeof(struct tx_ring *txr) if (ifp->if_capenable & IFCAP_NETMAP) { struct netmap_adapter *na = NA(ifp); struct netmap_kring *kring = &na->tx_rings[txr->me]; + tx_desc = (struct ixgbe_legacy_tx_desc *)txr->tx_base; bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map, @@ -3395,6 +3396,15 @@ ixgbe_txeof(struct tx_ring *txr) * of the client thread. Interrupt handlers only wake up * clients, which may be sleeping on individual rings * or on a global resource for all rings. + * To implement tx interrupt mitigation, we wake up the client + * thread roughly every half ring, even if the NIC interrupts + * more frequently. This is implemented as follows: + * - ixgbe_txsync() sets kring->nr_kflags with the index of + * the slot that should wake up the thread (nkr_num_slots + * means the user thread should not be woken up); + * - the driver ignores tx interrupts unless netmap_mitigate=0 + * or the slot has the DD bit set. + * * When the driver has separate locks, we need to * release and re-acquire txlock to avoid deadlocks. * XXX see if we can find a better way. @@ -3402,7 +3412,7 @@ ixgbe_txeof(struct tx_ring *txr) if (!netmap_mitigate || (kring->nr_kflags < kring->nkr_num_slots && tx_desc[kring->nr_kflags].upper.fields.status & IXGBE_TXD_STAT_DD)) { - kring->nr_kflags = kring->nkr_num_slots; // invalidate + kring->nr_kflags = kring->nkr_num_slots; selwakeuppri(&na->tx_rings[txr->me].si, PI_NET); IXGBE_TX_UNLOCK(txr); IXGBE_CORE_LOCK(adapter); @@ -4306,8 +4316,10 @@ ixgbe_rxeof(struct ix_queue *que, int co #ifdef DEV_NETMAP if (ifp->if_capenable & IFCAP_NETMAP) { /* - * Same as the txeof routine, only wakeup clients - * and make sure there are no deadlocks. + * Same as the txeof routine: only wakeup clients on intr. + * NKR_PENDINTR in nr_kflags is used to implement interrupt + * mitigation (ixgbe_rxsync() will not look for new packets + * unless NKR_PENDINTR is set). */ struct netmap_adapter *na = NA(ifp);