Subject: Re: VLAN and the "real" interface vs accounting
To: None <dyoung@pobox.com>
From: William Waites <ww@styx.org>
List: tech-net
Date: 08/25/2002 20:38:24
> Should  you increase  the bytes-output  statistic before  vlan calls
> if_start, by  analogy to ether_output?   That is should you  add the
> line I mark to this code fragment from vlan_start?

                IFQ_ENQUEUE(&p->if_snd, m, &pktattr, error);
                if (error) {
                        /* mbuf is already freed */
                        ifp->if_oerrors++;
                        continue;
                }

>               ifp->if_obytes += m->m_pkthdr.len;
                ifp->if_opackets++;
                if ((p->if_flags & IFF_OACTIVE) == 0)
                        (*p->if_start)(p);

While  this does  increase  the  output bytes  statistic  on the  vlan
interface, it would result  in incorrect counters since ifp->if_obytes
gets increased  in if_ethersubr.c near  hte end of  ether_output(). As
the original  post said,  the statistics appear  correct for  the vlan
interface.

Doing 

        p->if_obytes += m->m_pkthdr.len;

at that same spot should do the trick IIUC.

Why  it  is,   though, that  if_obytes  is  increased   in  one  place
(ether_output()) and  if_opackets in another (the  device driver), I'm
not sure...

-w