From 9389fe19d45e77003cc88f25a4890dde38d8718a Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 9 Sep 2010 09:27:40 -0700 Subject: [PATCH] network - Make toeplitz the default --- sys/conf/options | 3 +- sys/config/LINT | 4 --- sys/dev/netif/emx/if_emx.c | 2 -- sys/dev/netif/jme/if_jme.c | 7 ++--- sys/net/toeplitz.c | 4 --- sys/net/toeplitz2.h | 4 --- sys/netinet/ip_demux.c | 59 ++++++-------------------------------- 7 files changed, 13 insertions(+), 70 deletions(-) diff --git a/sys/conf/options b/sys/conf/options index 34248909a2..a214a05229 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -658,8 +658,7 @@ SYSLINK opt_syslink.h # DSCHED stuff DSCHED_FQ opt_dsched.h -# Receive Side Scaling -RSS opt_rss.h +# Receive Side Scaling (now basecode) RSS_DEBUG opt_rss.h # Enable watchdogs diff --git a/sys/config/LINT b/sys/config/LINT index fe244b7f76..0664204a87 100644 --- a/sys/config/LINT +++ b/sys/config/LINT @@ -2913,10 +2913,6 @@ options SCTP_MAP_LOGGING # DSCHED stuff options DSCHED_FQ -# Receive Side Scaling -options RSS -options RSS_DEBUG - # WATCHDOG options WATCHDOG_ENABLE # Enable watchdog support framework options WDOG_DISABLE_ON_PANIC # Automatically disable watchdogs on panic diff --git a/sys/dev/netif/emx/if_emx.c b/sys/dev/netif/emx/if_emx.c index 51fc3f34c4..cfba53f26a 100644 --- a/sys/dev/netif/emx/if_emx.c +++ b/sys/dev/netif/emx/if_emx.c @@ -514,12 +514,10 @@ emx_attach(device_t dev) /* This controls when hardware reports transmit completion status. */ sc->hw.mac.report_tx_early = 1; -#ifdef RSS /* Calculate # of RX rings */ if (ncpus > 1) sc->rx_ring_cnt = EMX_NRX_RING; else -#endif sc->rx_ring_cnt = 1; sc->rx_ring_inuse = sc->rx_ring_cnt; diff --git a/sys/dev/netif/jme/if_jme.c b/sys/dev/netif/jme/if_jme.c index b6a90b66a4..7cc5d2ae6c 100644 --- a/sys/dev/netif/jme/if_jme.c +++ b/sys/dev/netif/jme/if_jme.c @@ -620,7 +620,9 @@ jme_attach(device_t dev) if (sc->jme_tx_desc_cnt > JME_NDESC_MAX) sc->jme_tx_desc_cnt = JME_NDESC_MAX; -#ifdef RSS + /* + * Calculate rx rings based on ncpus2 + */ sc->jme_rx_ring_cnt = jme_rx_ring_count; if (sc->jme_rx_ring_cnt <= 0) sc->jme_rx_ring_cnt = JME_NRXRING_1; @@ -631,9 +633,6 @@ jme_attach(device_t dev) sc->jme_rx_ring_cnt = JME_NRXRING_4; else if (sc->jme_rx_ring_cnt >= JME_NRXRING_2) sc->jme_rx_ring_cnt = JME_NRXRING_2; -#else - sc->jme_rx_ring_cnt = JME_NRXRING_MIN; -#endif sc->jme_rx_ring_inuse = sc->jme_rx_ring_cnt; sc->jme_dev = dev; diff --git a/sys/net/toeplitz.c b/sys/net/toeplitz.c index d330ab6c42..889df2f16b 100644 --- a/sys/net/toeplitz.c +++ b/sys/net/toeplitz.c @@ -70,8 +70,6 @@ static uint32_t toeplitz_keyseeds[TOEPLITZ_KEYSEED_CNT] = { TOEPLITZ_KEYSEED0, TOEPLITZ_KEYSEED1 }; -#ifdef RSS - uint32_t toeplitz_cache[TOEPLITZ_KEYSEED_CNT][256]; TUNABLE_INT("net.toeplitz.keyseed0", &toeplitz_keyseeds[0]); @@ -183,8 +181,6 @@ toeplitz_init(void *dummy __unused) } SYSINIT(toeplitz, SI_SUB_PRE_DRIVERS, SI_ORDER_FIRST, toeplitz_init, NULL); -#endif /* RSS */ - void toeplitz_get_key(uint8_t *key, int keylen) { diff --git a/sys/net/toeplitz2.h b/sys/net/toeplitz2.h index fb8d317582..3f53c1fda6 100644 --- a/sys/net/toeplitz2.h +++ b/sys/net/toeplitz2.h @@ -45,8 +45,6 @@ #define TOEPLITZ_KEYSEED_CNT 2 -#ifdef RSS - extern uint32_t toeplitz_cache[TOEPLITZ_KEYSEED_CNT][256]; static __inline uint32_t @@ -90,8 +88,6 @@ toeplitz_rawhash_addr(in_addr_t _faddr, in_addr_t _laddr) return _res; } -#endif /* RSS */ - static __inline int toeplitz_hash(uint32_t _rawhash) { diff --git a/sys/netinet/ip_demux.c b/sys/netinet/ip_demux.c index 5a0d164bb3..faf2cc9064 100644 --- a/sys/netinet/ip_demux.c +++ b/sys/netinet/ip_demux.c @@ -47,9 +47,7 @@ #include #include -#ifdef RSS #include -#endif #include #include @@ -69,48 +67,19 @@ extern int udp_mpsafe_thread; static struct thread tcp_thread[MAXCPU]; static struct thread udp_thread[MAXCPU]; -#ifndef RSS - -static __inline int -INP_MPORT_HASH(in_addr_t faddr, in_addr_t laddr, - in_port_t fport, in_port_t lport) -{ - /* - * Use low order bytes. - */ - -#if (BYTE_ORDER == LITTLE_ENDIAN) - KASSERT(ncpus2 < 256, ("need different hash function")); /* XXX JH */ - return (((faddr >> 24) ^ (fport >> 8) ^ (laddr >> 24) ^ (lport >> 8)) & - ncpus2_mask); -#else - return ((faddr ^ fport ^ laddr ^ lport) & ncpus2_mask); -#endif -} - -#endif /* !RSS */ - static __inline int INP_MPORT_HASH_UDP(in_addr_t faddr, in_addr_t laddr, in_port_t fport, in_port_t lport) { -#ifndef RSS - return INP_MPORT_HASH(faddr, laddr, fport, lport); -#else return toeplitz_hash(toeplitz_rawhash_addr(faddr, laddr)); -#endif } static __inline int INP_MPORT_HASH_TCP(in_addr_t faddr, in_addr_t laddr, in_port_t fport, in_port_t lport) { -#ifndef RSS - return INP_MPORT_HASH(faddr, laddr, fport, lport); -#else return toeplitz_hash( toeplitz_rawhash_addrport(faddr, laddr, fport, lport)); -#endif } /* @@ -304,25 +273,20 @@ ip_mport(struct mbuf **mptr, int dir) case IPPROTO_TCP: th = (struct tcphdr *)((caddr_t)ip + iphlen); thoff = th->th_off << 2; - cpu = INP_MPORT_HASH_TCP(ip->ip_src.s_addr, ip->ip_dst.s_addr, - th->th_sport, th->th_dport); + cpu = INP_MPORT_HASH_TCP(ip->ip_src.s_addr, + ip->ip_dst.s_addr, + th->th_sport, + th->th_dport); port = &tcp_thread[cpu].td_msgport; break; case IPPROTO_UDP: uh = (struct udphdr *)((caddr_t)ip + iphlen); -#ifndef RSS - if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) || - (dir == IP_MPORT_IN && - in_broadcast(ip->ip_dst, m->m_pkthdr.rcvif))) { - cpu = 0; - } else -#endif - { - cpu = INP_MPORT_HASH_UDP(ip->ip_src.s_addr, - ip->ip_dst.s_addr, uh->uh_sport, uh->uh_dport); - } + cpu = INP_MPORT_HASH_UDP(ip->ip_src.s_addr, + ip->ip_dst.s_addr, + uh->uh_sport, + uh->uh_dport); port = &udp_thread[cpu].td_msgport; break; @@ -538,12 +502,7 @@ tcp_addrcpu(in_addr_t faddr, in_port_t fport, in_addr_t laddr, in_port_t lport) int udp_addrcpu(in_addr_t faddr, in_port_t fport, in_addr_t laddr, in_port_t lport) { -#ifndef RSS - if (IN_MULTICAST(ntohl(laddr))) - return (0); - else -#endif - return (INP_MPORT_HASH_UDP(faddr, laddr, fport, lport)); + return (INP_MPORT_HASH_UDP(faddr, laddr, fport, lport)); } /* -- 2.41.0