Date: Wed, 31 Jan 2007 06:18:16 GMT From: "Christian S.J. Peron" <csjp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 113748 for review Message-ID: <200701310618.l0V6IGUi023201@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=113748 Change 113748 by csjp@csjp_rnd01 on 2007/01/31 06:17:29 - Add counters for matching packets written to bpf - Add some additional counters for zero copy to assist with debugging Affected files ... .. //depot/projects/zcopybpf/src/sys/net/bpf.c#6 edit .. //depot/projects/zcopybpf/src/sys/net/bpfdesc.h#5 edit Differences ... ==== //depot/projects/zcopybpf/src/sys/net/bpf.c#6 (text+ko) ==== @@ -171,6 +171,7 @@ #ifdef BPF_ZEROCOPY case BPF_BUFMODE_ZBUF: + d->bd_zcopy++; return (bpf_zerocopy_append_bytes(d, buf, offset, src, len)); #endif @@ -190,6 +191,7 @@ #ifdef BPF_ZEROCOPY case BPF_BUFMODE_ZBUF: + d->bd_zcopy++; return (bpf_zerocopy_append_mbuf(d, buf, offset, src, len)); #endif @@ -795,23 +797,32 @@ int error; struct sockaddr dst; - if (d->bd_bif == NULL) + d->bd_wcount++; + if (d->bd_bif == NULL) { + d->bd_wdcount++; return (ENXIO); + } ifp = d->bd_bif->bif_ifp; - if ((ifp->if_flags & IFF_UP) == 0) + if ((ifp->if_flags & IFF_UP) == 0) { + d->bd_wdcount++; return (ENETDOWN); + } - if (uio->uio_resid == 0) + if (uio->uio_resid == 0) { + d->bd_wdcount++; return (0); + } bzero(&dst, sizeof(dst)); error = bpf_movein(uio, (int)d->bd_bif->bif_dlt, ifp->if_mtu, &m, &dst, d->bd_wfilter); - if (error) + if (error) { + d->bd_wdcount++; return (error); - + } + d->bd_wfcount++; if (d->bd_hdrcmplt) dst.sa_family = pseudo_AF_HDRCMPLT; @@ -822,6 +833,8 @@ #endif NET_LOCK_GIANT(); error = (*ifp->if_output)(ifp, m, &dst, NULL); + if (error) + d->bd_wdcount++; NET_UNLOCK_GIANT(); /* * The driver frees the mbuf. @@ -848,6 +861,10 @@ d->bd_rcount = 0; d->bd_dcount = 0; d->bd_fcount = 0; + d->bd_wcount = 0; + d->bd_wfcount = 0; + d->bd_wdcount = 0; + d->bd_zcopy = 0; } /* @@ -1921,6 +1938,10 @@ strlcpy(d->bd_ifname, bd->bd_bif->bif_ifp->if_xname, IFNAMSIZ); d->bd_locked = bd->bd_locked; + d->bd_wcount = bd->bd_wcount; + d->bd_wdcount = bd->bd_wdcount; + d->bd_wfcount = bd->bd_wfcount; + d->bd_zcopy = bd->bd_zcopy; } static int ==== //depot/projects/zcopybpf/src/sys/net/bpfdesc.h#5 (text+ko) ==== @@ -94,6 +94,10 @@ pid_t bd_pid; /* PID which created descriptor */ int bd_locked; /* true if descriptor is locked */ u_int bd_bufmode; /* Current buffer mode. */ + u_long bd_wcount; /* number of packets written */ + u_long bd_wfcount; /* number of packets that matched write filter */ + u_long bd_wdcount; /* number of packets dropped during a write */ + u_long bd_zcopy; /* number of zero copy operations */ }; /* Values for bd_state */ @@ -127,6 +131,10 @@ pid_t bd_pid; char bd_ifname[IFNAMSIZ]; int bd_locked; + u_long bd_wcount; + u_long bd_wfcount; + u_long bd_wdcount; + u_long bd_zcopy; }; #define BPFIF_LOCK(bif) mtx_lock(&(bif)->bif_mtx)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200701310618.l0V6IGUi023201>