diff options
author | arybchik <arybchik@FreeBSD.org> | 2016-06-06 09:08:16 +0000 |
---|---|---|
committer | arybchik <arybchik@FreeBSD.org> | 2016-06-06 09:08:16 +0000 |
commit | c7e6cfafbb0e0bafd5c1703177b33bee5bae6d1e (patch) | |
tree | 70db6a6584d3f6e4ec83b520a0f503147f42da86 | |
parent | 25efd1b73b87ead630cb68976b29c8ed13f872c6 (diff) | |
download | FreeBSD-src-c7e6cfafbb0e0bafd5c1703177b33bee5bae6d1e.zip FreeBSD-src-c7e6cfafbb0e0bafd5c1703177b33bee5bae6d1e.tar.gz |
sfxge(4): pick an RSS bucket for the packet enqueued and select TXQ accordingly
Submitted by: Ivan Malov <Ivan.Malov at oktetlabs.ru>
Reviewed by: gnn
Sponsored by: Solarflare Communications, Inc.
Differential Revision: https://reviews.freebsd.org/D6723
-rw-r--r-- | sys/dev/sfxge/sfxge_tx.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/dev/sfxge/sfxge_tx.c b/sys/dev/sfxge/sfxge_tx.c index 19fb8cc..08fc885 100644 --- a/sys/dev/sfxge/sfxge_tx.c +++ b/sys/dev/sfxge/sfxge_tx.c @@ -49,6 +49,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_rss.h" + #include <sys/param.h> #include <sys/malloc.h> #include <sys/mbuf.h> @@ -68,6 +70,10 @@ __FBSDID("$FreeBSD$"); #include <netinet/ip6.h> #include <netinet/tcp.h> +#ifdef RSS +#include <net/rss_config.h> +#endif + #include "common/efx.h" #include "sfxge.h" @@ -818,12 +824,24 @@ sfxge_if_transmit(struct ifnet *ifp, struct mbuf *m) (CSUM_DELAY_DATA | CSUM_TCP_IPV6 | CSUM_UDP_IPV6 | CSUM_TSO)) { int index = 0; +#ifdef RSS + uint32_t bucket_id; + + /* + * Select a TX queue which matches the corresponding + * RX queue for the hash in order to assign both + * TX and RX parts of the flow to the same CPU + */ + if (rss_m2bucket(m, &bucket_id) == 0) + index = bucket_id % (sc->txq_count - (SFXGE_TXQ_NTYPES - 1)); +#else /* check if flowid is set */ if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { uint32_t hash = m->m_pkthdr.flowid; index = sc->rx_indir_table[hash % SFXGE_RX_SCALE_MAX]; } +#endif #if SFXGE_TX_PARSE_EARLY if (m->m_pkthdr.csum_flags & CSUM_TSO) sfxge_parse_tx_packet(m); |