Index: sys/dev/vmware/vmxnet3/if_vmx.c =================================================================== --- sys/dev/vmware/vmxnet3/if_vmx.c +++ sys/dev/vmware/vmxnet3/if_vmx.c @@ -23,6 +23,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_rss.h" + #include #include #include @@ -46,6 +48,9 @@ #include #include #include +#ifdef RSS +#include +#endif #include #include @@ -1125,6 +1130,7 @@ static void vmxnet3_reinit_rss_shared_data(struct vmxnet3_softc *sc) { +#ifndef RSS /* * Use the same key as the Linux driver until FreeBSD can do * RSS (presumably Toeplitz) in software. @@ -1136,26 +1142,40 @@ 0xd8, 0x56, 0xa3, 0x18, 0x9b, 0x0a, 0xee, 0xf3, 0x96, 0xa6, 0x9f, 0x8f, 0x9e, 0x8c, 0x90, 0xc9, }; - +#endif struct vmxnet3_driver_shared *ds; if_softc_ctx_t scctx; struct vmxnet3_rss_shared *rss; +#ifdef RSS + uint8_t rss_algo; +#endif int i; - + ds = sc->vmx_ds; scctx = sc->vmx_scctx; rss = sc->vmx_rss; - rss->hash_type = UPT1_RSS_HASH_TYPE_IPV4 | UPT1_RSS_HASH_TYPE_TCP_IPV4 | UPT1_RSS_HASH_TYPE_IPV6 | UPT1_RSS_HASH_TYPE_TCP_IPV6; - rss->hash_func = UPT1_RSS_HASH_FUNC_TOEPLITZ; rss->hash_key_size = UPT1_RSS_MAX_KEY_SIZE; rss->ind_table_size = UPT1_RSS_MAX_IND_TABLE_SIZE; +#ifdef RSS + rss_algo = rss_gethashalgo(); + if (rss_algo == RSS_HASH_TOEPLITZ) + rss->hash_func = UPT1_RSS_HASH_FUNC_TOEPLITZ; + else + rss->hash_func = UPT1_RSS_HASH_FUNC_NONE; /* XXX */ + rss_getkey(rss->hash_key); + for (i = 0; i < UPT1_RSS_MAX_IND_TABLE_SIZE; i++) { + rss->ind_table[i] = rss_get_indirection_to_bucket(i) % + scctx->isc_nrxqsets; + } +#else + rss->hash_func = UPT1_RSS_HASH_FUNC_TOEPLITZ; memcpy(rss->hash_key, rss_key, UPT1_RSS_MAX_KEY_SIZE); - for (i = 0; i < UPT1_RSS_MAX_IND_TABLE_SIZE; i++) rss->ind_table[i] = i % scctx->isc_nrxqsets; +#endif } static void