From owner-svn-src-all@freebsd.org Thu Feb 25 14:23:03 2016 Return-Path: Delivered-To: svn-src-all@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 AC4FAAAFEDF; Thu, 25 Feb 2016 14:23:03 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67BDC178A; Thu, 25 Feb 2016 14:23:03 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1PEN2ZE063400; Thu, 25 Feb 2016 14:23:02 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1PEN2Fg063397; Thu, 25 Feb 2016 14:23:02 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201602251423.u1PEN2Fg063397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Thu, 25 Feb 2016 14:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296035 - head/sys/dev/vnic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2016 14:23:03 -0000 Author: zbb Date: Thu Feb 25 14:23:02 2016 New Revision: 296035 URL: https://svnweb.freebsd.org/changeset/base/296035 Log: Improve VNIC performance on Tx path by immediate packet transmission Don't postpone Tx if the Tx lock can be acquired now. This gives 3x better performance on egress. Reviewed by: wma Obtained from: Semihalf Sponsored by: Cavium Differential Revision: https://reviews.freebsd.org/D5325 Modified: head/sys/dev/vnic/nicvf_main.c head/sys/dev/vnic/nicvf_queues.c head/sys/dev/vnic/nicvf_queues.h Modified: head/sys/dev/vnic/nicvf_main.c ============================================================================== --- head/sys/dev/vnic/nicvf_main.c Thu Feb 25 14:21:04 2016 (r296034) +++ head/sys/dev/vnic/nicvf_main.c Thu Feb 25 14:23:02 2016 (r296035) @@ -663,11 +663,18 @@ nicvf_if_transmit(struct ifnet *ifp, str mbuf = mtmp; } } + + if (NICVF_TX_TRYLOCK(sq) != 0) { + err = nicvf_tx_mbuf_locked(sq, mbuf); + NICVF_TX_UNLOCK(sq); + return (err); + } else { err = drbr_enqueue(ifp, sq->br, mbuf); if (err != 0) return (err); - taskqueue_enqueue(sq->snd_taskq, &sq->snd_task); + taskqueue_enqueue(sq->snd_taskq, &sq->snd_task); + } return (0); } Modified: head/sys/dev/vnic/nicvf_queues.c ============================================================================== --- head/sys/dev/vnic/nicvf_queues.c Thu Feb 25 14:21:04 2016 (r296034) +++ head/sys/dev/vnic/nicvf_queues.c Thu Feb 25 14:23:02 2016 (r296035) @@ -98,7 +98,6 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_NICVF); static void nicvf_free_snd_queue(struct nicvf *, struct snd_queue *); -static int nicvf_tx_mbuf_locked(struct snd_queue *, struct mbuf *); static struct mbuf * nicvf_get_rcv_mbuf(struct nicvf *, struct cqe_rx_t *); static void nicvf_sq_disable(struct nicvf *, int); static void nicvf_sq_enable(struct nicvf *, struct snd_queue *, int); @@ -1856,7 +1855,7 @@ static inline void nicvf_sq_add_gather_s } /* Put an mbuf to a SQ for packet transfer. */ -static int +int nicvf_tx_mbuf_locked(struct snd_queue *sq, struct mbuf *mbuf) { bus_dma_segment_t segs[256]; Modified: head/sys/dev/vnic/nicvf_queues.h ============================================================================== --- head/sys/dev/vnic/nicvf_queues.h Thu Feb 25 14:21:04 2016 (r296034) +++ head/sys/dev/vnic/nicvf_queues.h Thu Feb 25 14:23:02 2016 (r296035) @@ -385,6 +385,8 @@ void nicvf_disable_intr(struct nicvf *, void nicvf_clear_intr(struct nicvf *, int, int); int nicvf_is_intr_enabled(struct nicvf *, int, int); +int nicvf_tx_mbuf_locked(struct snd_queue *, struct mbuf *); + /* Register access APIs */ void nicvf_reg_write(struct nicvf *, uint64_t, uint64_t); uint64_t nicvf_reg_read(struct nicvf *, uint64_t);