Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/sfxge/sfxge_rx.c
Show All 28 Lines | |||||
* The views and conclusions contained in the software and documentation are | * The views and conclusions contained in the software and documentation are | ||||
* those of the authors and should not be interpreted as representing official | * those of the authors and should not be interpreted as representing official | ||||
* policies, either expressed or implied, of the FreeBSD Project. | * policies, either expressed or implied, of the FreeBSD Project. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_rss.h" | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/syslog.h> | #include <sys/syslog.h> | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/syslog.h> | #include <sys/syslog.h> | ||||
#include <net/ethernet.h> | #include <net/ethernet.h> | ||||
#include <net/if.h> | #include <net/if.h> | ||||
#include <net/if_vlan_var.h> | #include <net/if_vlan_var.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/ip.h> | #include <netinet/ip.h> | ||||
#include <netinet/ip6.h> | #include <netinet/ip6.h> | ||||
#include <netinet/tcp.h> | #include <netinet/tcp.h> | ||||
#include <machine/in_cksum.h> | #include <machine/in_cksum.h> | ||||
#ifdef RSS | |||||
#include <net/rss_config.h> | |||||
#endif | |||||
#include "common/efx.h" | #include "common/efx.h" | ||||
#include "sfxge.h" | #include "sfxge.h" | ||||
#include "sfxge_rx.h" | #include "sfxge_rx.h" | ||||
#define RX_REFILL_THRESHOLD(_entries) (EFX_RXQ_LIMIT(_entries) * 9 / 10) | #define RX_REFILL_THRESHOLD(_entries) (EFX_RXQ_LIMIT(_entries) * 9 / 10) | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | |||||
void | void | ||||
sfxge_rx_qflush_failed(struct sfxge_rxq *rxq) | sfxge_rx_qflush_failed(struct sfxge_rxq *rxq) | ||||
{ | { | ||||
rxq->flush_state = SFXGE_FLUSH_FAILED; | rxq->flush_state = SFXGE_FLUSH_FAILED; | ||||
} | } | ||||
#ifdef RSS | |||||
static uint8_t toep_key[RSS_KEYSIZE]; | |||||
#else | |||||
static uint8_t toep_key[] = { | static uint8_t toep_key[] = { | ||||
0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, | 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, | ||||
0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, | 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, | ||||
0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, | 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, | ||||
0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, | 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, | ||||
0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa | 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa | ||||
}; | }; | ||||
#endif | |||||
static void | static void | ||||
sfxge_rx_post_refill(void *arg) | sfxge_rx_post_refill(void *arg) | ||||
{ | { | ||||
struct sfxge_rxq *rxq = arg; | struct sfxge_rxq *rxq = arg; | ||||
struct sfxge_softc *sc; | struct sfxge_softc *sc; | ||||
unsigned int index; | unsigned int index; | ||||
struct sfxge_evq *evq; | struct sfxge_evq *evq; | ||||
▲ Show 20 Lines • Show All 944 Lines • ▼ Show 20 Lines | for (index = 0; index < SFXGE_RX_SCALE_MAX; index++) | ||||
sc->rx_indir_table[index] = index % sc->rxq_count; | sc->rx_indir_table[index] = index % sc->rxq_count; | ||||
if ((rc = efx_rx_scale_tbl_set(sc->enp, sc->rx_indir_table, | if ((rc = efx_rx_scale_tbl_set(sc->enp, sc->rx_indir_table, | ||||
SFXGE_RX_SCALE_MAX)) != 0) | SFXGE_RX_SCALE_MAX)) != 0) | ||||
goto fail; | goto fail; | ||||
(void)efx_rx_scale_mode_set(sc->enp, EFX_RX_HASHALG_TOEPLITZ, | (void)efx_rx_scale_mode_set(sc->enp, EFX_RX_HASHALG_TOEPLITZ, | ||||
(1 << EFX_RX_HASH_IPV4) | (1 << EFX_RX_HASH_TCPIPV4) | | (1 << EFX_RX_HASH_IPV4) | (1 << EFX_RX_HASH_TCPIPV4) | | ||||
(1 << EFX_RX_HASH_IPV6) | (1 << EFX_RX_HASH_TCPIPV6), B_TRUE); | (1 << EFX_RX_HASH_IPV6) | (1 << EFX_RX_HASH_TCPIPV6), B_TRUE); | ||||
#ifdef RSS | |||||
rss_getkey(toep_key); | |||||
#endif | |||||
if ((rc = efx_rx_scale_key_set(sc->enp, toep_key, | if ((rc = efx_rx_scale_key_set(sc->enp, toep_key, | ||||
sizeof(toep_key))) != 0) | sizeof(toep_key))) != 0) | ||||
goto fail; | goto fail; | ||||
/* Start the receive queue(s). */ | /* Start the receive queue(s). */ | ||||
for (index = 0; index < sc->rxq_count; index++) { | for (index = 0; index < sc->rxq_count; index++) { | ||||
if ((rc = sfxge_rx_qstart(sc, index)) != 0) | if ((rc = sfxge_rx_qstart(sc, index)) != 0) | ||||
goto fail2; | goto fail2; | ||||
▲ Show 20 Lines • Show All 265 Lines • Show Last 20 Lines |