bge & vlan stranges

John Polstra jdp at polstra.com
Fri Aug 1 10:45:23 PDT 2003


In article <20030801173748.04C7343F85 at mx1.FreeBSD.org>,
Peter Edwards <pmedwards at eircom.net> wrote:
> John Polstra <jdp at polstra.com> wrote:
> > Peter Edwards  <pmedwards at eircom.net> wrote:
> > > >         CSR_WRITE_4(sc, BGE_RX_MTU, ifp->if_mtu +
> > > >             ETHER_HDR_LEN + ETHER_CRC_LEN + ETHER_VLAN_ENCAP_LEN);
> 
> > Good guess, but the approved way of doing it is to add this code
> > near the point where IFCAP_VLAN_MTU is set:
> > 
> >     ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header);
> >
> > See "sys/dev/fxp/if_fxp.c" for an example that works.
> 
> Sorry for being obtuse, but just to clarify:

No, you are right.  I didn't read the posting carefully enough.
Sorry!

> fxp just seems to have an "allow long frames" flag, rather than a "max
> frame size"
> register in the hardware, so you never seem to have to tell the hardware the max
> size of a frame it needs to accept. I assume you mean, that after
> setting if_hdrlen,
> you still need to write to the PCI register, like this:
> 		CSR_WRITE_4(sc, BGE_RX_MTU,
> 			ifp->if_mtu + ifp->if_hdrlen + ETHER_CRC_LEN);

Yes, you probably do have to do that.  I think you also have to set
if_data.ifi_hdrlen as I said, or the MTU as understood by the rest of
the system will come out 4 bytes too short.  But I'm just speaking
from memory without any actual experiments to back up what I'm saying.
:-}

Thanks for the correction!

John
-- 
  John Polstra
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Two buttocks cannot avoid friction."                     -- Malawi saying


More information about the freebsd-current mailing list