diff options
author | Zbigniew Bodek <zbb@FreeBSD.org> | 2016-02-25 14:23:02 +0000 |
---|---|---|
committer | Zbigniew Bodek <zbb@FreeBSD.org> | 2016-02-25 14:23:02 +0000 |
commit | 332c869727e0c7132da51adf8be70c19b156a41e (patch) | |
tree | cf628d208590ac11478febe7b504d42cb67b0465 /sys/dev/vnic | |
parent | 6dc234599fe8d1602ad92b38910453547ae8aee7 (diff) | |
download | src-332c869727e0c7132da51adf8be70c19b156a41e.tar.gz src-332c869727e0c7132da51adf8be70c19b156a41e.zip |
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
Notes
Notes:
svn path=/head/; revision=296035
Diffstat (limited to 'sys/dev/vnic')
-rw-r--r-- | sys/dev/vnic/nicvf_main.c | 9 | ||||
-rw-r--r-- | sys/dev/vnic/nicvf_queues.c | 3 | ||||
-rw-r--r-- | sys/dev/vnic/nicvf_queues.h | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/vnic/nicvf_main.c b/sys/dev/vnic/nicvf_main.c index a0315700f312..eeca94ff7aeb 100644 --- a/sys/dev/vnic/nicvf_main.c +++ b/sys/dev/vnic/nicvf_main.c @@ -663,11 +663,18 @@ nicvf_if_transmit(struct ifnet *ifp, struct mbuf *mbuf) 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); } diff --git a/sys/dev/vnic/nicvf_queues.c b/sys/dev/vnic/nicvf_queues.c index cd9f7336eb84..a2dd78c45768 100644 --- a/sys/dev/vnic/nicvf_queues.c +++ b/sys/dev/vnic/nicvf_queues.c @@ -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_subdesc(struct snd_queue *sq, int qentry, } /* 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]; diff --git a/sys/dev/vnic/nicvf_queues.h b/sys/dev/vnic/nicvf_queues.h index 436bb71d3cb9..010dc2ef2470 100644 --- a/sys/dev/vnic/nicvf_queues.h +++ b/sys/dev/vnic/nicvf_queues.h @@ -385,6 +385,8 @@ void nicvf_disable_intr(struct nicvf *, int, int); 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); |