public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] SNMP shows zero tx packets?
@ 2001-01-03 13:15 Grant Edwards
  2001-01-04  0:15 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Grant Edwards @ 2001-01-03 13:15 UTC (permalink / raw)
  To: ecos-discuss

I implimented the statistics ioctl() in my Ethernet driver and
I've got the SNMP daemon running -- since I don't have stdio, I
had to change 'printf(stderr,' 'to diag_printf(' in the log
routine, but other than that it worked right out of the box., 

All seems well except for two thing

 1) the tx packet count is always zero.  I get what looks like
    reasonable numbers for rx packets and rx bytes and also for
    tx bytes, but tx packets is always 0.

    I checked my ether_drv_stats struct I'm returning, and it
    has non-zero numbers filled in for tx_count, tx_complete,
    tx_good, but SNMP reports:

interfaces.ifTable.ifEntry.ifOutOctets.1 = Counter: 0
interfaces.ifTable.ifEntry.ifOutOctets.2 = Counter: 19405      <== right
interfaces.ifTable.ifEntry.ifOutUcastPkts.1 = Counter: 0
interfaces.ifTable.ifEntry.ifOutUcastPkts.2 = Counter: 0       <== wrong
interfaces.ifTable.ifEntry.ifOutNUcastPkts.1 = Counter: 0
interfaces.ifTable.ifEntry.ifOutNUcastPkts.2 = Counter: 0
interfaces.ifTable.ifEntry.ifOutDiscards.1 = Counter: 0
interfaces.ifTable.ifEntry.ifOutDiscards.2 = Counter: 0
interfaces.ifTable.ifEntry.ifOutErrors.1 = Counter: 0
interfaces.ifTable.ifEntry.ifOutErrors.2 = Counter: 0
interfaces.ifTable.ifEntry.ifOutQLen.1 = Gauge: 0
interfaces.ifTable.ifEntry.ifOutQLen.2 = Gauge: 4

    Anybody else notice something like this?  (I'm using a CVS
    snapshot from a few weeks back).

2)  I've also noticed that the system uptime is always zero...

Everything else (UDP,TCP,IP) looks like it's working!!

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] SNMP shows zero tx packets?
  2001-01-03 13:15 [ECOS] SNMP shows zero tx packets? Grant Edwards
@ 2001-01-04  0:15 ` Andrew Lunn
  2001-01-04  0:33   ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2001-01-04  0:15 UTC (permalink / raw)
  To: Grant Edwards; +Cc: ecos-discuss

On Wed, Jan 03, 2001 at 03:19:46PM -0600, Grant Edwards wrote:
> All seems well except for two thing
> 
>  1) the tx packet count is always zero.  I get what looks like
>     reasonable numbers for rx packets and rx bytes and also for
>     tx bytes, but tx packets is always 0.

You need to look in packages/net/snmp/agent/mibgroups/mibII/inferfaces.c

The offending bit of code is 

    case IFOUTUCASTPKTS:
        long_ret = ifp->if_opackets - ifp->if_omcasts;
        return (unsigned char *) &long_ret;
 
This is returning the number of multicast packets output!
It should return if_opackets.

> 2)  I've also noticed that the system uptime is always zero...

Sorry, i cannot help here. I reimplemented the system group so that i
could get/set values from flash etc. Look in the same directory as the
interfaces.c.

        Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] SNMP shows zero tx packets?
  2001-01-04  0:15 ` Andrew Lunn
@ 2001-01-04  0:33   ` Andrew Lunn
  2001-01-04  5:28     ` Gary Thomas
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2001-01-04  0:33 UTC (permalink / raw)
  To: Grant Edwards, ecos-discuss

On Thu, Jan 04, 2001 at 09:14:50AM +0100, Andrew Lunn wrote:
> You need to look in packages/net/snmp/agent/mibgroups/mibII/inferfaces.c
> 
> The offending bit of code is 
> 
>     case IFOUTUCASTPKTS:
>         long_ret = ifp->if_opackets - ifp->if_omcasts;
>         return (unsigned char *) &long_ret;
>  
> This is returning the number of multicast packets output!
> It should return if_opackets.

Duh, i should not better than to reply before drinking the mornings
first cup of coffee. That line is correct.

Thats seems to be missing is code to increment if_opackets. I cannot
find that anyway. Realy you need to go back to the OpenBSD sources and
find out where it increments the counter. I suspect its either in the
device driver itself, or the generic ethernet layer between the driver
and the stack.

        Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] SNMP shows zero tx packets?
  2001-01-04  0:33   ` Andrew Lunn
@ 2001-01-04  5:28     ` Gary Thomas
  2001-01-04  8:22       ` Grant Edwards
  0 siblings, 1 reply; 5+ messages in thread
From: Gary Thomas @ 2001-01-04  5:28 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: ecos-discuss, Grant Edwards

On 04-Jan-2001 Andrew Lunn wrote:
> On Thu, Jan 04, 2001 at 09:14:50AM +0100, Andrew Lunn wrote:
>> You need to look in packages/net/snmp/agent/mibgroups/mibII/inferfaces.c
>> 
>> The offending bit of code is 
>> 
>>     case IFOUTUCASTPKTS:
>>         long_ret = ifp->if_opackets - ifp->if_omcasts;
>>         return (unsigned char *) &long_ret;
>>  
>> This is returning the number of multicast packets output!
>> It should return if_opackets.
> 
> Duh, i should not better than to reply before drinking the mornings
> first cup of coffee. That line is correct.
> 
> Thats seems to be missing is code to increment if_opackets. I cannot
> find that anyway. Realy you need to go back to the OpenBSD sources and
> find out where it increments the counter. I suspect its either in the
> device driver itself, or the generic ethernet layer between the driver
> and the stack.

Correct you are.  This is something I missed when abstracting the device
drivers [eCos drivers know nothing of the OpenBSD stack environment].

This patch oughta do the trick:
Index: io/eth/current/src/net/eth_drv.c
===================================================================
RCS file: /home/cvs/ecc/ecc/io/eth/current/src/net/eth_drv.c,v
retrieving revision 1.10
diff -u -5 -p -r1.10 eth_drv.c
--- io/eth/current/src/net/eth_drv.c    2000/12/11 16:41:27     1.10
+++ io/eth/current/src/net/eth_drv.c    2001/01/04 13:26:14
@@ -554,11 +554,13 @@ static struct mbuf *mbuf_key;
 static void
 eth_drv_tx_done(struct eth_drv_sc *sc, CYG_ADDRESS key, int status)
 {
     struct ifnet *ifp = &sc->sc_arpcom.ac_if;
     struct mbuf *m0 = (struct mbuf *)key;
+
     // Check for errors here (via 'status')
+    ifp->if_opackets++;
     // Done with packet
     mbuf_key = m0;
     m_freem(m0);
     // Start another if possible
     eth_drv_send(ifp);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] SNMP shows zero tx packets?
  2001-01-04  5:28     ` Gary Thomas
@ 2001-01-04  8:22       ` Grant Edwards
  0 siblings, 0 replies; 5+ messages in thread
From: Grant Edwards @ 2001-01-04  8:22 UTC (permalink / raw)
  To: Gary Thomas; +Cc: Andrew Lunn, ecos-discuss

On Thu, Jan 04, 2001 at 06:28:28AM -0700, Gary Thomas wrote:

> > Thats seems to be missing is code to increment if_opackets. I
> > cannot find that anyway. Realy you need to go back to the
> > OpenBSD sources and find out where it increments the counter. I
> > suspect its either in the device driver itself, or the generic
> > ethernet layer between the driver and the stack.
> 
> Correct you are.  This is something I missed when abstracting
> the device drivers [eCos drivers know nothing of the OpenBSD
> stack environment].
> 
> This patch oughta do the trick:

That it did!

Oh, the system uptime is (and was) working:

     system.sysUpTime.0 = Timeticks: (20700) 0:03:27

I was looking at the wrong value before:

     system.sysORTable.sysOREntry.sysORUpTime.1 = Timeticks: (0) 0:00:00

Not sure what that second one is. The sysORTable object doesn't
seem to be in my copy of RFC1213, but snmpwalk knows about it
so it must be something semi-official.  ;)

-- 
Grant Edwards
grante@visi.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-01-04  8:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-03 13:15 [ECOS] SNMP shows zero tx packets? Grant Edwards
2001-01-04  0:15 ` Andrew Lunn
2001-01-04  0:33   ` Andrew Lunn
2001-01-04  5:28     ` Gary Thomas
2001-01-04  8:22       ` Grant Edwards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).