Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/cxgbe/t4_main.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
| #include <sys/socket.h> | #include <sys/socket.h> | ||||
| #include <sys/sockio.h> | #include <sys/sockio.h> | ||||
| #include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
| #include <net/ethernet.h> | #include <net/ethernet.h> | ||||
| #include <net/if.h> | #include <net/if.h> | ||||
| #include <net/if_types.h> | #include <net/if_types.h> | ||||
| #include <net/if_dl.h> | #include <net/if_dl.h> | ||||
| #include <net/if_vlan_var.h> | #include <net/if_vlan_var.h> | ||||
| #ifdef RSS | |||||
| #include <net/rss_config.h> | #include <net/rss_config.h> | ||||
| #endif | |||||
| #include <netinet/in.h> | #include <netinet/in.h> | ||||
| #include <netinet/ip.h> | #include <netinet/ip.h> | ||||
| #ifdef KERN_TLS | #ifdef KERN_TLS | ||||
| #include <netinet/tcp_seq.h> | #include <netinet/tcp_seq.h> | ||||
| #endif | #endif | ||||
| #if defined(__i386__) || defined(__amd64__) | #if defined(__i386__) || defined(__amd64__) | ||||
| #include <machine/md_var.h> | #include <machine/md_var.h> | ||||
| #include <machine/cputypes.h> | #include <machine/cputypes.h> | ||||
| ▲ Show 20 Lines • Show All 6,959 Lines • ▼ Show 20 Lines | #endif | ||||
| MPASS(irq == &sc->irq[sc->intr_count]); | MPASS(irq == &sc->irq[sc->intr_count]); | ||||
| return (0); | return (0); | ||||
| } | } | ||||
| static void | static void | ||||
| write_global_rss_key(struct adapter *sc) | write_global_rss_key(struct adapter *sc) | ||||
| { | { | ||||
| #ifdef RSS | |||||
| int i; | int i; | ||||
| uint32_t raw_rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; | uint32_t raw_rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; | ||||
| uint32_t rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; | uint32_t rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; | ||||
| CTASSERT(RSS_KEYSIZE == 40); | CTASSERT(RSS_KEYSIZE == 40); | ||||
| rss_getkey((void *)&raw_rss_key[0]); | rss_getkey((void *)&raw_rss_key[0]); | ||||
| for (i = 0; i < nitems(rss_key); i++) { | for (i = 0; i < nitems(rss_key); i++) { | ||||
| rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); | rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); | ||||
| } | } | ||||
| t4_write_rss_key(sc, &rss_key[0], -1, 1); | t4_write_rss_key(sc, &rss_key[0], -1, 1); | ||||
| #endif | |||||
| } | } | ||||
| /* | /* | ||||
| * Idempotent. | * Idempotent. | ||||
| */ | */ | ||||
| static int | static int | ||||
| adapter_full_init(struct adapter *sc) | adapter_full_init(struct adapter *sc) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | if (sc->tq[i] == NULL) | ||||
| continue; | continue; | ||||
| taskqueue_free(sc->tq[i]); | taskqueue_free(sc->tq[i]); | ||||
| sc->tq[i] = NULL; | sc->tq[i] = NULL; | ||||
| } | } | ||||
| sc->flags &= ~FULL_INIT_DONE; | sc->flags &= ~FULL_INIT_DONE; | ||||
| } | } | ||||
| #ifdef RSS | |||||
| #define SUPPORTED_RSS_HASHTYPES (RSS_HASHTYPE_RSS_IPV4 | \ | #define SUPPORTED_RSS_HASHTYPES (RSS_HASHTYPE_RSS_IPV4 | \ | ||||
| RSS_HASHTYPE_RSS_TCP_IPV4 | RSS_HASHTYPE_RSS_IPV6 | \ | RSS_HASHTYPE_RSS_TCP_IPV4 | RSS_HASHTYPE_RSS_IPV6 | \ | ||||
| RSS_HASHTYPE_RSS_TCP_IPV6 | RSS_HASHTYPE_RSS_UDP_IPV4 | \ | RSS_HASHTYPE_RSS_TCP_IPV6 | RSS_HASHTYPE_RSS_UDP_IPV4 | \ | ||||
| RSS_HASHTYPE_RSS_UDP_IPV6) | RSS_HASHTYPE_RSS_UDP_IPV6) | ||||
| /* Translates kernel hash types to hardware. */ | /* Translates kernel hash types to hardware. */ | ||||
| static int | static int | ||||
| hashconfig_to_hashen(int hashconfig) | hashconfig_to_hashen(int hashconfig) | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN) | ||||
| hashconfig |= RSS_HASHTYPE_RSS_TCP_IPV6; | hashconfig |= RSS_HASHTYPE_RSS_TCP_IPV6; | ||||
| if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN) | if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN) | ||||
| hashconfig |= RSS_HASHTYPE_RSS_IPV4; | hashconfig |= RSS_HASHTYPE_RSS_IPV4; | ||||
| if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN) | if (hashen & F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN) | ||||
| hashconfig |= RSS_HASHTYPE_RSS_IPV6; | hashconfig |= RSS_HASHTYPE_RSS_IPV6; | ||||
| return (hashconfig); | return (hashconfig); | ||||
| } | } | ||||
| #endif | |||||
| /* | /* | ||||
| * Idempotent. | * Idempotent. | ||||
| */ | */ | ||||
| static int | static int | ||||
| vi_full_init(struct vi_info *vi) | vi_full_init(struct vi_info *vi) | ||||
| { | { | ||||
| struct adapter *sc = vi->adapter; | struct adapter *sc = vi->adapter; | ||||
| struct sge_rxq *rxq; | struct sge_rxq *rxq; | ||||
| int rc, i, j; | int rc, i, j; | ||||
| int hashconfig = rss_gethashconfig(); | |||||
| #ifdef RSS | #ifdef RSS | ||||
| int nbuckets = rss_getnumbuckets(); | int nbuckets = rss_getnumbuckets(); | ||||
| int hashconfig = rss_gethashconfig(); | |||||
| int extra; | int extra; | ||||
| #endif | #endif | ||||
| ASSERT_SYNCHRONIZED_OP(sc); | ASSERT_SYNCHRONIZED_OP(sc); | ||||
| /* | /* | ||||
| * Allocate tx/rx/fl queues for this VI. | * Allocate tx/rx/fl queues for this VI. | ||||
| */ | */ | ||||
| Show All 39 Lines | #endif | ||||
| rc = -t4_config_rss_range(sc, sc->mbox, vi->viid, 0, vi->rss_size, | rc = -t4_config_rss_range(sc, sc->mbox, vi->viid, 0, vi->rss_size, | ||||
| vi->rss, vi->rss_size); | vi->rss, vi->rss_size); | ||||
| if (rc != 0) { | if (rc != 0) { | ||||
| CH_ERR(vi, "rss_config failed: %d\n", rc); | CH_ERR(vi, "rss_config failed: %d\n", rc); | ||||
| return (rc); | return (rc); | ||||
| } | } | ||||
| #ifdef RSS | |||||
| vi->hashen = hashconfig_to_hashen(hashconfig); | vi->hashen = hashconfig_to_hashen(hashconfig); | ||||
| #ifdef RSS | |||||
| /* | /* | ||||
| * We may have had to enable some hashes even though the global config | * We may have had to enable some hashes even though the global config | ||||
| * wants them disabled. This is a potential problem that must be | * wants them disabled. This is a potential problem that must be | ||||
| * reported to the user. | * reported to the user. | ||||
| */ | */ | ||||
| extra = hashen_to_hashconfig(vi->hashen) ^ hashconfig; | extra = hashen_to_hashconfig(vi->hashen) ^ hashconfig; | ||||
| /* | /* | ||||
| Show All 17 Lines | #ifdef RSS | ||||
| if (extra & RSS_HASHTYPE_RSS_IPV6) | if (extra & RSS_HASHTYPE_RSS_IPV6) | ||||
| CH_ALERT(vi, "IPv6 2-tuple hashing forced on.\n"); | CH_ALERT(vi, "IPv6 2-tuple hashing forced on.\n"); | ||||
| if (extra & RSS_HASHTYPE_RSS_TCP_IPV6) | if (extra & RSS_HASHTYPE_RSS_TCP_IPV6) | ||||
| CH_ALERT(vi, "TCP/IPv6 4-tuple hashing forced on.\n"); | CH_ALERT(vi, "TCP/IPv6 4-tuple hashing forced on.\n"); | ||||
| if (extra & RSS_HASHTYPE_RSS_UDP_IPV4) | if (extra & RSS_HASHTYPE_RSS_UDP_IPV4) | ||||
| CH_ALERT(vi, "UDP/IPv4 4-tuple hashing forced on.\n"); | CH_ALERT(vi, "UDP/IPv4 4-tuple hashing forced on.\n"); | ||||
| if (extra & RSS_HASHTYPE_RSS_UDP_IPV6) | if (extra & RSS_HASHTYPE_RSS_UDP_IPV6) | ||||
| CH_ALERT(vi, "UDP/IPv6 4-tuple hashing forced on.\n"); | CH_ALERT(vi, "UDP/IPv6 4-tuple hashing forced on.\n"); | ||||
| #else | |||||
| vi->hashen = F_FW_RSS_VI_CONFIG_CMD_IP6FOURTUPEN | | |||||
| F_FW_RSS_VI_CONFIG_CMD_IP6TWOTUPEN | | |||||
| F_FW_RSS_VI_CONFIG_CMD_IP4FOURTUPEN | | |||||
| F_FW_RSS_VI_CONFIG_CMD_IP4TWOTUPEN | F_FW_RSS_VI_CONFIG_CMD_UDPEN; | |||||
| #endif | #endif | ||||
| rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, vi->rss[0], | rc = -t4_config_vi_rss(sc, sc->mbox, vi->viid, vi->hashen, vi->rss[0], | ||||
| 0, 0); | 0, 0); | ||||
| if (rc != 0) { | if (rc != 0) { | ||||
| CH_ERR(vi, "rss hash/defaultq config failed: %d\n", rc); | CH_ERR(vi, "rss hash/defaultq config failed: %d\n", rc); | ||||
| return (rc); | return (rc); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 7,026 Lines • Show Last 20 Lines | |||||