[En-Nut-Discussion] Keeping Track of Costs on GRPS/CDMA

Brett Abbott Brett.Abbott at digital-telemetry.com
Thu Jul 29 22:49:13 CEST 2004


Hi

We've added a few minor changes keep track of traffic throughput over 
expensive adaptors.  It allows us to spot when problems start occurring 
that might end up benefiting Vodafone and Telecom in the monetary way 
and prevent costly bugs from ending our business.

Essentially we've added packet and byte counters.  It may be of use to 
others and is simple to implement.  Who knows maybe Oliver might like it 
so much he'll add it to NutOS and I can stop adding it every time I 
upgrade ;)

The changes I made were specifically for PPP but could be adapted for 
all interfaces.  Typically Ethernet traffic is much cheaper than GPRS so 
we didnt bother.

In your application, you need to monitor/report the values regularly or 
alarm on the rate of change.

Please also note that the changes were made to an older rev of NutOS so 
you may need to slightly alter the location of the changes if the new OS 
is slightly different, please accept my apologies for the hassle.

Hope this helps
Brett

-------- Library changes:
include/dev/ppp.h:
add to the end of  struct _PPPDCB {
    /* Packet and Byte Monitoring, excludes ppp headers and escape bytes */
    u_long sent_packets;
    u_long sent_databytes;
    u_long recv_packets;
    u_long recv_databytes;
/* These values set to 0 when structure is alloc'd */

dev/ppp.c:
int PPPPutPacket(NUTDEVICE * dev, NETBUF * nb)
add the counter just prior to the write:
    // Added to count outgoing data
    dcb->sent_packets++;
    dcb->sent_databytes+=sz-nb->nb_dl.sz;

    _write(dcb->dcb_fd, &flag, 1);


net/pppin.c:
void NutPppInput(NUTDEVICE * dev, NETBUF * nb)

add counter after finding the header
    ph = (PPPHDR *) nb->nb_dl.vp;
    nb->nb_nw.vp = ph + 1;
    nb->nb_nw.sz = nb->nb_dl.sz - sizeof(PPPHDR);
    nb->nb_dl.sz = sizeof(PPPHDR);

    // Added to count data from incoming ppp packets
    dcb->recv_packets++;
    dcb->recv_databytes+=nb->nb_nw.sz;



These seem to work well.

Cheers
Brett


-- 
-----------------------------------------------------------------
Brett Abbott, Managing Director, Digital Telemetry Limited
Email: Brett.Abbott at digital-telemetry.com
PO Box 24 036 Manners Street, Wellington, New Zealand
Phone +64 (4) 5666-860  Mobile +64 (21) 656-144
------------------- Commercial in confidence --------------------





More information about the En-Nut-Discussion mailing list