Subject: Re: Allowing large PPPoE frames
To: Quentin Garnier <netbsd@quatriemek.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-net
Date: 08/04/2003 22:41:52
On Mon, Aug 04, 2003 at 10:30:09PM +0200, Quentin Garnier wrote:
> Le Mon, 4 Aug 2003 12:51:42 +0200
> Manuel Bouyer a ecrit :
> > > > > But anyway, we don't have to check if the NIC can receive the
> > > > > frame at that time, because obviously it could.
> > > >
> > > > ec_capenable ETHERCAP_VLAN_MTU is there to have the driver allow the
> > > > nic to receive such frames.
> > >
> > > I'll do that then.
> >
> > Thanks.
>
> I tested this with sip(4). I added the necessary bit to tlp(4), but I
> didn't have the time to test it yet. I'll have a closer look at all the
> other cards I have here (ne, rtk, ep, iy). None of them declare the
> ETHERCAP_VLAN_MTU. My guess is that there is no documentation and/or no
> way to disallow or permit reception of large frames.
ne use the dp8390.c code, which declares it.
For rtk, I guess nobody looked at it yet.
> Index: sys/net/if_ether.h
> ===================================================================
> RCS file: /cvsroot/src/sys/net/if_ether.h,v
> retrieving revision 1.33
> diff -u -r1.33 if_ether.h
> --- sys/net/if_ether.h 2003/06/26 08:22:06 1.33
> +++ sys/net/if_ether.h 2003/08/04 15:37:44
> @@ -60,6 +60,9 @@
> * Some Ethernet extensions.
> */
> #define ETHER_VLAN_ENCAP_LEN 4 /* length of 802.1Q VLAN encapsulation */
> +#ifdef PPPOE_ACCEPT_LARGE_FRAMES
> +#define ETHER_PPPOE_ENCAP_LEN 8
> +#endif
>
> /*
> * Ethernet address - 6 octets
> @@ -90,10 +93,18 @@
> * Compute the maximum frame size based on ethertype (i.e. possible
> * encapsulation) and whether or not an FCS is present.
> */
> +#ifdef PPPOE_ACCEPT_LARGE_FRAMES
> #define ETHER_MAX_FRAME(ifp, etype, hasfcs) \
> ((ifp)->if_mtu + ETHER_HDR_LEN + \
> ((hasfcs) ? ETHER_CRC_LEN : 0) + \
> + (((etype) == ETHERTYPE_VLAN) ? ETHER_VLAN_ENCAP_LEN : 0) + \
> + (((etype) == ETHERTYPE_PPPOE) ? ETHER_PPPOE_ENCAP_LEN : 0))
> +#else
> +#define ETHER_MAX_FRAME(ifp, etype, hasfcs) \
> + ((ifp)->if_mtu + ETHER_HDR_LEN + \
> + ((hasfcs) ? ETHER_CRC_LEN : 0) + \
> (((etype) == ETHERTYPE_VLAN) ? ETHER_VLAN_ENCAP_LEN : 0))
> +#endif
>
> /*
> * Ethernet CRC32 polynomials (big- and little-endian verions).
> @@ -170,6 +181,9 @@
> #define ETHERCAP_VLAN_MTU 0x00000001 /* VLAN-compatible MTU */
> #define ETHERCAP_VLAN_HWTAGGING 0x00000002 /* hardware VLAN tag support */
> #define ETHERCAP_JUMBO_MTU 0x00000004 /* 9000 byte MTU supported */
> +#ifdef PPPOE_ACCEPT_LARGE_FRAMES
> +#define ETHERCAP_PPPOE_MTU 0x00000008 /* 1508 byte MTU supported */
> +#endif
>
> #ifdef _KERNEL
> extern u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN];
> Index: sys/net/if_pppoe.c
> ===================================================================
> RCS file: /cvsroot/src/sys/net/if_pppoe.c,v
> retrieving revision 1.44
> diff -u -r1.44 if_pppoe.c
> --- sys/net/if_pppoe.c 2003/06/27 16:24:32 1.44
> +++ sys/net/if_pppoe.c 2003/08/04 15:37:45
> @@ -830,6 +830,14 @@
> sc->sc_eth_if = ifunit(parms->eth_ifname);
> if (sc->sc_eth_if == NULL)
> return ENXIO;
> +#ifdef PPPOE_ACCEPT_LARGE_FRAMES
> + if (sc->sc_eth_if->if_type == IFT_ETHER) {
> + /* It shouldn't be anything else anyway */
> + struct ethercom *ec = (struct ethercom *)sc->sc_eth_if;
> + if ((ec->ec_capabilities & ETHERCAP_PPPOE_MTU))
> + ec->ec_capenable |= ETHERCAP_PPPOE_MTU;
> + }
> +#endif
If you enable ETHERCAP_PPPOE_MTU, then you probably want to change the MTU
of pppoe from 1492 to 1500.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 24 ans d'experience feront toujours la difference
--