From: Sepherosa Ziehau Date: Wed, 1 Aug 2012 09:09:58 +0000 (+0800) Subject: emx: Add EMX_TSO_DEBUG X-Git-Tag: v3.2.0~484 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/0c0e1638b808d58479e41e5cd14e1354db2154b5 emx: Add EMX_TSO_DEBUG It is used to measure TSO context reuse rate. Setting up TX context interferes TX data fetching pipelining, thus reduces performance, so TX context setting up should be avoided as much as possible. According to limited measurement: - 1 one direction TX stream, reuse rate is ~40% - 16 one direction TX streams, reuse rate is ~20% - 16 bi-direction streams (total 32), reuse rate is ~10% --- diff --git a/sys/conf/options b/sys/conf/options index 5c0a22e..052eb09 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -625,6 +625,7 @@ ED_NO_MIIBUS opt_ed.h # emx driver EMX_RSS_DEBUG opt_emx.h +EMX_TSO_DEBUG opt_emx.h # jme driver JME_RSS_DEBUG opt_jme.h diff --git a/sys/config/LINT b/sys/config/LINT index d661e04..5851173 100644 --- a/sys/config/LINT +++ b/sys/config/LINT @@ -2497,6 +2497,7 @@ options DEBUG_INTERRUPTS options BCE_DEBUG options BNX_TSO_DEBUG options EMX_RSS_DEBUG +options EMX_TSO_DEBUG options JME_RSS_DEBUG options IGB_RSS_DEBUG options IGB_MSIX_DEBUG diff --git a/sys/config/LINT64 b/sys/config/LINT64 index e24a3dc..a5068fd 100644 --- a/sys/config/LINT64 +++ b/sys/config/LINT64 @@ -2260,6 +2260,7 @@ options DEBUG_INTERRUPTS options BCE_DEBUG options BNX_TSO_DEBUG options EMX_RSS_DEBUG +options EMX_TSO_DEBUG options JME_RSS_DEBUG options IGB_RSS_DEBUG options IGB_MSIX_DEBUG diff --git a/sys/dev/netif/emx/if_emx.c b/sys/dev/netif/emx/if_emx.c index be6eca1..31d907c 100644 --- a/sys/dev/netif/emx/if_emx.c +++ b/sys/dev/netif/emx/if_emx.c @@ -3229,6 +3229,9 @@ emx_print_debug_info(struct emx_softc *sc) sc->dropped_pkts); device_printf(dev, "Driver tx dma failure in encap = %ld\n", sc->no_tx_dma_setup); + + device_printf(dev, "TSO segments %lu\n", sc->tso_segments); + device_printf(dev, "TSO ctx reused %lu\n", sc->tso_ctx_reused); } static void @@ -3795,6 +3798,10 @@ emx_tso_setup(struct emx_softc *sc, struct mbuf *mp, int mss, pktlen, curr_txd; struct ip *ip; +#ifdef EMX_TSO_DEBUG + sc->tso_segments++; +#endif + iphlen = mp->m_pkthdr.csum_iphlen; thoff = mp->m_pkthdr.csum_thlen; hoff = mp->m_pkthdr.csum_lhlen; @@ -3812,6 +3819,9 @@ emx_tso_setup(struct emx_softc *sc, struct mbuf *mp, sc->csum_pktlen == pktlen) { *txd_upper = sc->csum_txd_upper; *txd_lower = sc->csum_txd_lower; +#ifdef EMX_TSO_DEBUG + sc->tso_ctx_reused++; +#endif return 0; } hlen = hoff + iphlen + thoff; diff --git a/sys/dev/netif/emx/if_emx.h b/sys/dev/netif/emx/if_emx.h index 5ac32d9..acd377c 100644 --- a/sys/dev/netif/emx/if_emx.h +++ b/sys/dev/netif/emx/if_emx.h @@ -365,6 +365,8 @@ struct emx_softc { unsigned long rx_irq; unsigned long tx_irq; unsigned long link_irq; + unsigned long tso_segments; + unsigned long tso_ctx_reused; /* sysctl tree glue */ struct sysctl_ctx_list sysctl_ctx;