From: Sepherosa Ziehau Date: Sat, 20 Sep 2008 10:53:16 +0000 (+0000) Subject: - Add KTR of ethernet operations X-Git-Url: https://gitweb.dragonflybsd.org/~lentferj/dragonfly.git/commitdiff_plain/f3e0b5f0df98c76446e71ed114439f2ad9399169 - Add KTR of ethernet operations - Measure the cost of ether_input_chain - Measure the cost of ether_input_dispatch --- diff --git a/sys/conf/options b/sys/conf/options index dca3184c24..0de1e7f238 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/conf/options,v 1.191.2.53 2003/06/04 17:56:58 sam Exp $ -# $DragonFly: src/sys/conf/options,v 1.95 2008/09/17 08:51:28 sephe Exp $ +# $DragonFly: src/sys/conf/options,v 1.96 2008/09/20 10:53:16 sephe Exp $ # # On the handling of kernel options # @@ -602,6 +602,7 @@ KTR_POLLING opt_ktr.h KTR_IFQ opt_ktr.h KTR_IF_START opt_ktr.h KTR_HAMMER opt_ktr.h +KTR_ETHERNET opt_ktr.h # bce driver BCE_DEBUG opt_bce.h diff --git a/sys/config/LINT b/sys/config/LINT index c16c82671b..1d5f9fd6bb 100644 --- a/sys/config/LINT +++ b/sys/config/LINT @@ -3,7 +3,7 @@ # as much of the source tree as it can. # # $FreeBSD: src/sys/i386/conf/LINT,v 1.749.2.144 2003/06/04 17:56:59 sam Exp $ -# $DragonFly: src/sys/config/LINT,v 1.174 2008/09/17 08:51:28 sephe Exp $ +# $DragonFly: src/sys/config/LINT,v 1.175 2008/09/20 10:53:16 sephe Exp $ # # See the kernconf(5) manual page for more information on the format of # this file. @@ -2740,7 +2740,9 @@ options WI_SYMBOL_FIRMWARE options XBONEHACK options KTR +#options KTR_ETHERNET #options KTR_GIANT_CONTENTION +#options KTR_HAMMER #options KTR_IF_BGE #options KTR_IF_EM #options KTR_IF_START diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index b655cfdfd7..3e97f897a9 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -32,7 +32,7 @@ * * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/net/if_ethersubr.c,v 1.70.2.33 2003/04/28 15:45:53 archie Exp $ - * $DragonFly: src/sys/net/if_ethersubr.c,v 1.89 2008/09/17 08:51:29 sephe Exp $ + * $DragonFly: src/sys/net/if_ethersubr.c,v 1.90 2008/09/20 10:53:16 sephe Exp $ */ #include "opt_atalk.h" @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -165,6 +166,18 @@ SYSCTL_UINT(_net_link_ether, OID_AUTO, prepend_hdr, CTLFLAG_RW, ðer_prepend_hdr, 0, "# of ether header restoration which prepends mbuf"); +#define ETHER_KTR_STR "ifp=%p" +#define ETHER_KTR_ARG_SIZE (sizeof(void *)) +#ifndef KTR_ETHERNET +#define KTR_ETHERNET KTR_ALL +#endif +KTR_INFO_MASTER(ether); +KTR_INFO(KTR_ETHERNET, ether, chain_beg, 0, ETHER_KTR_STR, ETHER_KTR_ARG_SIZE); +KTR_INFO(KTR_ETHERNET, ether, chain_end, 1, ETHER_KTR_STR, ETHER_KTR_ARG_SIZE); +KTR_INFO(KTR_ETHERNET, ether, disp_beg, 2, ETHER_KTR_STR, ETHER_KTR_ARG_SIZE); +KTR_INFO(KTR_ETHERNET, ether, disp_end, 3, ETHER_KTR_STR, ETHER_KTR_ARG_SIZE); +#define logether(name, arg) KTR_LOG(ether_ ## name, arg) + /* * Ethernet output routine. * Encapsulate a packet of type family for the local net. @@ -982,6 +995,7 @@ ether_input_dispatch(struct mbuf_chain *chain) #ifdef SMP int i; + logether(disp_beg, NULL); for (i = 0; i < ncpus; ++i) { if (chain[i].mc_head != NULL) { lwkt_send_ipiq(globaldata_find(i), @@ -989,9 +1003,11 @@ ether_input_dispatch(struct mbuf_chain *chain) } } #else + logether(disp_beg, NULL); if (chain->mc_head != NULL) ether_input_ipifunc(chain->mc_head); #endif + logether(disp_end, NULL); } void @@ -1361,6 +1377,8 @@ ether_input_chain(struct ifnet *ifp, struct mbuf *m, struct mbuf_chain *chain) m->m_pkthdr.rcvif = ifp; + logether(chain_beg, ifp); + if (ETHER_IS_MULTICAST(eh->ether_dhost)) { if (bcmp(ifp->if_broadcastaddr, eh->ether_dhost, ifp->if_addrlen) == 0) @@ -1379,6 +1397,8 @@ ether_input_chain(struct ifnet *ifp, struct mbuf *m, struct mbuf_chain *chain) * Interface marked for monitoring; discard packet. */ m_freem(m); + + logether(chain_end, ifp); return; } @@ -1531,4 +1551,5 @@ ether_input_chain(struct ifnet *ifp, struct mbuf *m, struct mbuf_chain *chain) } else { lwkt_sendmsg(port, &m->m_hdr.mh_netmsg.nm_netmsg.nm_lmsg); } + logether(chain_end, ifp); }