adjust the condition for reusing checksum context, wm_tx_offload() can

be used even for multiqueue case

enable only when the chip supports exactly one queue (same as FreeBSD) -
anything multiqueue-capable later than 82574 should work, but I don't
have the hw to test
This commit is contained in:
jdolecek 2020-04-09 06:55:51 +00:00
parent 6c8cdb0f7f
commit d13990138f
1 changed files with 31 additions and 27 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wm.c,v 1.673 2020/04/08 21:57:24 jdolecek Exp $ */ /* $NetBSD: if_wm.c,v 1.674 2020/04/09 06:55:51 jdolecek Exp $ */
/* /*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@ -82,7 +82,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.673 2020/04/08 21:57:24 jdolecek Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.674 2020/04/09 06:55:51 jdolecek Exp $");
#ifdef _KERNEL_OPT #ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h" #include "opt_net_mpsafe.h"
@ -7558,33 +7558,37 @@ wm_tx_offload(struct wm_softc *sc, struct wm_txqueue *txq,
* contexts on this hardware platform and must generate a new * contexts on this hardware platform and must generate a new
* context every time. 82574L hardware spec, section 7.2.6, * context every time. 82574L hardware spec, section 7.2.6,
* second note. * second note.
* */
* Setting up new checksum offload context for every if (sc->sc_nqueues < 2) {
* frames takes a lot of processing time for hardware. /*
* This also reduces performance a lot for small sized *
* frames so avoid it if driver can use previously * Setting up new checksum offload context for every
* configured checksum offload context. * frames takes a lot of processing time for hardware.
* For TSO, in theory we can use the same TSO context if and only if * This also reduces performance a lot for small sized
* frame is the same type(IP/TCP) and the same MSS. However * frames so avoid it if driver can use previously
* checking whether a frame has the same IP/TCP structure is * configured checksum offload context.
* hard thing so just ignore that and always restablish a * For TSO, in theory we can use the same TSO context only if
* new TSO context. * frame is the same type(IP/TCP) and the same MSS. However
*/ * checking whether a frame has the same IP/TCP structure is
KASSERT(!wm_is_using_multiqueue(sc)); * hard thing so just ignore that and always restablish a
if ((m0->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6)) == 0) { * new TSO context.
if (txq->txq_last_hw_cmd == cmd && */
txq->txq_last_hw_fields == fields && if ((m0->m_pkthdr.csum_flags & (M_CSUM_TSOv4 | M_CSUM_TSOv6))
txq->txq_last_hw_ipcs == (ipcs & 0xffff) && == 0) {
txq->txq_last_hw_tucs == (tucs & 0xffff)) { if (txq->txq_last_hw_cmd == cmd &&
WM_Q_EVCNT_INCR(txq, skipcontext); txq->txq_last_hw_fields == fields &&
return; txq->txq_last_hw_ipcs == (ipcs & 0xffff) &&
txq->txq_last_hw_tucs == (tucs & 0xffff)) {
WM_Q_EVCNT_INCR(txq, skipcontext);
return;
}
} }
}
txq->txq_last_hw_cmd = cmd; txq->txq_last_hw_cmd = cmd;
txq->txq_last_hw_fields = fields; txq->txq_last_hw_fields = fields;
txq->txq_last_hw_ipcs = (ipcs & 0xffff); txq->txq_last_hw_ipcs = (ipcs & 0xffff);
txq->txq_last_hw_tucs = (tucs & 0xffff); txq->txq_last_hw_tucs = (tucs & 0xffff);
}
/* Fill in the context descriptor. */ /* Fill in the context descriptor. */
t = (struct livengood_tcpip_ctxdesc *) t = (struct livengood_tcpip_ctxdesc *)