Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Jul 1999 14:30:03 -0700 (PDT)
From:      Craig Leres <leres@ee.lbl.gov>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/12543: [PATCH] cumulative error stats for fxp(4)
Message-ID:  <199907102130.OAA69532@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/12543; it has been noted by GNATS.

From: Craig Leres <leres@ee.lbl.gov>
To: dg@root.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, vern@ee.lbl.gov (Vern Paxson)
Subject: Re: kern/12543: [PATCH] cumulative error stats for fxp(4)
Date: Sat, 10 Jul 1999 14:27:45 PDT

 >    Perhaps it would also be better if the stats were stored as a ISO 8802.3
 > MIB and made available via sysctl like what is done inside the if_ed driver.
 
 Ok, here's a version (diff'ed against 3.2-RELEASE) that does this. It
 also adds a new bpf hook that allows packet capture interfaces to
 report missed packets. If you want to ifdef the stats collection, it's
 ok with me but the expense of adding up a few counters is minor
 compared to fetching the stat struct over the bus (which you have to do
 anyway for collision stats). Plus, this is only done once a second.
 
 One question I had is do you know what the dot3Compliance field means?
 It's not in RFC 1650 but I think it's an indication of what stats are
 collected and I'm not sure just setting it to DOT3COMPLIANCE_COLLS is
 %100 correct.
 
 Please take a look at let me know what you think.
 
 		Craig
 ------
 *** if_fxp.c.virgin	Tue Jul  6 20:34:12 1999
 --- if_fxp.c.new	Sat Jul 10 14:04:17 1999
 ***************
 *** 32,37 ****
 --- 32,41 ----
   
   /*
    * Intel EtherExpress Pro/100B PCI Fast Ethernet driver
 +  * as described on:
 +  *
 +  *	http://developer.intel.com/design/network/mature/82557.htm
 +  *
    */
   
   #include "bpfilter.h"
 ***************
 *** 45,50 ****
 --- 49,55 ----
   
   #include <net/if.h>
   #include <net/if_dl.h>
 + #include <net/if_mib.h>
   #include <net/if_media.h>
   
   #ifdef NS
 ***************
 *** 585,590 ****
 --- 590,600 ----
   	ifp->if_ioctl = fxp_ioctl;
   	ifp->if_start = fxp_start;
   	ifp->if_watchdog = fxp_watchdog;
 + 	ifp->if_linkmib = &sc->mibdata;
 + 	ifp->if_linkmiblen = sizeof(sc->mibdata);
 + 	sc->mibdata.dot3StatsEtherChipSet =
 + 	    DOT3CHIPSET(dot3VendorIntel, dot3ChipSetIntel82557);
 + 	sc->mibdata.dot3Compliance = DOT3COMPLIANCE_COLLS;
   
   	/*
   	 * Attach the interface.
 ***************
 *** 1058,1069 ****
 --- 1068,1083 ----
   					    FXP_RFA_STATUS_IAMATCH) &&
   					    (eh->ether_dhost[0] & 1)
   					    == 0) {
 + #ifde BRIDGE
   dropit:
 + #endif
   					    if (m)
   						m_freem(m);
   					    goto rcvloop;
   					}
 + #ifdef BRIDGE
   getit:
 + #endif
   					m->m_data +=
   					    sizeof(struct ether_header);
   					m->m_len -=
 ***************
 *** 1107,1113 ****
   	struct ifnet *ifp = &sc->sc_if;
   	struct fxp_stats *sp = sc->fxp_stats;
   	struct fxp_cb_tx *txp;
 ! 	int s;
   
   	ifp->if_opackets += sp->tx_good;
   	ifp->if_collisions += sp->tx_total_collisions;
 --- 1121,1128 ----
   	struct ifnet *ifp = &sc->sc_if;
   	struct fxp_stats *sp = sc->fxp_stats;
   	struct fxp_cb_tx *txp;
 ! 	struct ifmib_iso_8802_3 *mib = &sc->mibdata;
 ! 	int s, missed;
   
   	ifp->if_opackets += sp->tx_good;
   	ifp->if_collisions += sp->tx_total_collisions;
 ***************
 *** 1134,1140 ****
 --- 1149,1188 ----
   		if (tx_threshold < 192)
   			tx_threshold += 64;
   	}
 + 
 + 	/* Update RFC1650 totals */
 + 	mib->dot3StatsAlignmentErrors += sp->rx_alignment_errors;
 + 	mib->dot3StatsFCSErrors += sp->rx_crc_errors;
 + 	mib->dot3StatsSingleCollisionFrames += sp->tx_single_collisions;
 + 	mib->dot3StatsCollFrequencies[0] += sp->tx_single_collisions;
 + 	mib->dot3StatsMultipleCollisionFrames += sp->tx_multiple_collisions;
 + 	mib->dot3StatsDeferredTransmissions += sp->tx_deffered;
 + 	mib->dot3StatsLateCollisions += sp->tx_latecols;
 + 	mib->dot3StatsExcessiveCollisions += sp->tx_maxcols;
 + 	mib->dot3StatsCollFrequencies[15] += sp->tx_maxcols;
 + 	mib->dot3StatsInternalMacTransmitErrors += sp->tx_underruns;
 + 	mib->dot3StatsCarrierSenseErrors += sp->tx_lostcrs;
 + 	mib->dot3StatsInternalMacReceiveErrors += sp->rx_overrun_errors;
 + 	missed = sp->rx_overrun_errors + sp->rx_rnr_errors;
 + 	mib->dot3StatsMissedFrames += missed;
 + #ifdef notdef
 + 	mib->dot3StatsFrameTooLongs += ???;
 + 	/* Doesn't apply to non-aui ethernet */
 + 	mib->dot3StatsSQETestErrors += 0;
 + #endif
 + 
 + #ifdef notdef
 + 	/* Things the 82557 tells us about we can't report */
 + 	sp->rx_cdt_errors;	/* collisions during frame reception */
 + 	sp->rx_shortframes;	/* frame shorter than minimum */
 + #endif
 + 
   	s = splimp();
 + #if NBPFILTER > 0
 + 	/* Call bpf_dropcnt() at elevated ipl */
 + 	if (ifp->if_bpf != NULL && missed != 0)
 + 		bpf_dropcnt(ifp, missed);
 + #endif
   	/*
   	 * Release any xmit buffers that have completed DMA. This isn't
   	 * strictly necessary to do here, but it's advantagous for mbufs
 RCS file: RCS/if_fxpvar.h,v
 retrieving revision 1.1
 diff -c -r1.1 if_fxpvar.h
 *** /tmp/,RCSt1D84823	Sat Jul 10 14:08:50 1999
 --- if_fxpvar.h	Wed Jul  7 12:52:32 1999
 ***************
 *** 65,70 ****
 --- 65,71 ----
   	int phy_primary_addr;		/* address of primary PHY */
   	int phy_primary_device;		/* device type of primary PHY */
   	int phy_10Mbps_only;		/* PHY is 10Mbps-only device */
 + 	struct ifmib_iso_8802_3 mibdata; /* stuff for network mgmt */
   };
   
   /* Macros to ease CSR access. */
 *** bpf.c.virgin	Sat Jul 10 14:09:23 1999
 --- bpf.c.new	Sat Jul 10 14:10:44 1999
 ***************
 *** 1107,1112 ****
 --- 1107,1127 ----
   }
   
   /*
 +  * Hook for drivers to report dropped packets
 +  */
 + void
 + bpf_dropcnt(ifp, drop)
 + 	struct ifnet *ifp;
 + 	u_int drop;
 + {
 + 	struct bpf_if *bp = ifp->if_bpf;
 + 	struct bpf_d *d;
 + 
 + 	for (d = bp->bif_dlist; d != NULL; d = d->bd_next)
 + 		d->bd_dcount += drop;
 + }
 + 
 + /*
    * Move the packet data from interface memory (pkt) into the
    * store buffer.  Return 1 if it's time to wakeup a listener (buffer full),
    * otherwise 0.  "copy" is the routine called to do the actual data
 *** bpf.h.virgin	Sat Jul 10 14:12:34 1999
 --- bpf.h.new	Sat Jul 10 14:13:01 1999
 ***************
 *** 230,235 ****
 --- 230,236 ----
   void	 bpfattach __P((struct ifnet *, u_int, u_int));
   void	 bpfilterattach __P((int));
   u_int	 bpf_filter __P((struct bpf_insn *, u_char *, u_int, u_int));
 + void	 bpf_dropcnt __P((struct ifnet *, u_int));
   #endif
   
   /*
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907102130.OAA69532>