From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pz0-f43.google.com (mail-pz0-f43.google.com [209.85.210.43]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by huchra.bufferbloat.net (Postfix) with ESMTPS id AA2422020B8 for ; Fri, 22 Jun 2012 12:12:30 -0700 (PDT) Received: by dajz8 with SMTP id z8so4347959daj.16 for ; Fri, 22 Jun 2012 12:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=GikQ0vS9Iq1DjjOu83g40y/aiN3eyEg2psYgqn7QLPo=; b=rm8ZHSNPp+zRN033sOEXeAywBUqLhETuNmSnvsKt4grDCuwsL9oZ9b2KYLZkWVpXdR xqnRHdwcGRapTpnNBs5/jYZfdZzGg6fbQZNH6BXe8YCJP/bC/Ztiaio5BMrcIgbEd5uw d753A0iBVaCjKOsjp3/yzd9ohWRnQf1SQMLA4WCiZnHtMdEOe0VQYaYuN59vszxIxXu4 YZL6UaUX64I0u+TZBHB1oTVCsbYhAbqHXOeTZa3kOAFQ3Byfj8QUQ80INKZPC5AmfHLW 0OjBi/uSjwpYgHhoktDQeTx66J8fAVs7HoMHgkTRJA3xqLVlc3BWBBrJj+FkaUz3KcTR EhRg== MIME-Version: 1.0 Received: by 10.68.217.100 with SMTP id ox4mr12885037pbc.87.1340392349382; Fri, 22 Jun 2012 12:12:29 -0700 (PDT) Received: by 10.143.148.14 with HTTP; Fri, 22 Jun 2012 12:12:29 -0700 (PDT) In-Reply-To: References: Date: Fri, 22 Jun 2012 20:12:29 +0100 Message-ID: From: Robert Bradley To: cerowrt-devel@lists.bufferbloat.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Cerowrt-devel] Fwd: [PATCH] ag71xx: Added support for baby-jumbo packets. X-BeenThere: cerowrt-devel@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development issues regarding the cerowrt test router project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jun 2012 19:12:31 -0000 For those of you not following the openwrt-devel mailing list, this is an updated version of the baby-jumbo patch I posted previously in response to Alexander's post. This version is slightly less conservative about extended frame lengths (up to 1518 octets), but removes the awkward magic constant. The maximum MTU is now calculated by subtracting header lengths from AG71XX_TX_MTU_LEN. I also use this to calculate the maximum received packet size. Defining AG71XX_MAX_DATA_LEN as 1500 (or ETH_DATA_LEN) restores the original behaviour. ---------- Forwarded message ---------- From: Robert Bradley Date: 22 June 2012 13:50 Subject: [PATCH] ag71xx: Added support for baby-jumbo packets. To: openwrt-devel@lists.openwrt.org RFC 4638 support means that a full 1500-octet frame can be transmitted through a PPPoE tunnel. =C2=A0For this to work, the network card must suppo= rt baby-jumbo frames of 1508 octets plus headers. =C2=A0This patch enables the= use of MTUs up to 1518 octets (derived from the existing AG71XX_TX_MTU_LEN value by subtracting header sizes). The default MTU size is unchanged; if large frames are desired, ifconfig must be used to set the new MTU. Signed-off-by: Robert Bradley --- =C2=A0.../files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h | 17 +++++++++= +++++++- =C2=A0.../drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c =C2=A0| 18 ++++= +++++++++++++- =C2=A02 files changed, 33 insertions(+), 2 deletions(-) diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/= ag71xx.h b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.h index b9d95ad..7f77a59 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.= h +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx.= h @@ -51,8 +51,23 @@ =C2=A0#define AG71XX_INT_INIT =C2=A0 =C2=A0 =C2=A0 =C2=A0(AG71XX_INT_ERR | = AG71XX_INT_POLL) =C2=A0#define AG71XX_TX_MTU_LEN =C2=A0 =C2=A0 =C2=A01540 +/* + * AG71XX_MAX_DATA_LEN equals the maximum possible MTU that a frame of len= gth + * AG71XX_TX_MTU_LEN can have. =C2=A0This may be larger than ETH_DATA_LEN!= =C2=A0This + * define is necessary for baby jumbo packet support (as per RFC 4638). + * + * Redefining this as ETH_DATA_LEN restores the 1500-octet MTU limit. + */ +#define AG71XX_MAX_DATA_LEN =C2=A0 =C2=A0\ + =C2=A0 =C2=A0 =C2=A0 (AG71XX_TX_MTU_LEN - (ETH_FCS_LEN + VLAN_HLEN + ETH_= HLEN)) +/* + * Define AG71XX_RX_PKT_SIZE using AG71XX_MAX_DATA_LEN + ETH_HLEN rather t= han + * ETH_FRAME_LEN so that baby jumbo frames can be used safely. =C2=A0This = definition + * means that setting AG71XX_MAX_DATA_LEN to ETH_DATA_LEN restores the old + * values, which are safe for standard frames. + */ =C2=A0#define AG71XX_RX_PKT_SIZE =C2=A0 =C2=A0 \ - =C2=A0 =C2=A0 =C2=A0 (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN) + =C2=A0 =C2=A0 =C2=A0 (AG71XX_MAX_DATA_LEN + ETH_HLEN + ETH_FCS_LEN + VLAN= _HLEN) =C2=A0#define AG71XX_RX_BUF_SIZE (AG71XX_RX_PKT_SIZE + NET_SKB_PAD + NET_IP= _ALIGN) =C2=A0#define AG71XX_TX_RING_SIZE_DEFAULT =C2=A0 =C2=A064 diff --git a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/= ag71xx_main.c b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main= .c index fb99d27..d3e850b 100644 --- a/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_= main.c +++ b/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_= main.c @@ -1042,13 +1042,29 @@ static void ag71xx_netpoll(struct net_device *dev) =C2=A0} =C2=A0#endif +/* + * ag71xx_change_mtu: set interface MTU. + * A modified eth_change_mtu, changing the upper limit from ETH_DATA_LEN t= o + * AG71XX_MAX_DATA_LEN. =C2=A0This means that baby jumbo packets may be us= ed by + * PPPoE users, assuming that AG71XX_MAX_DATA_LEN > ETH_DATA_LEN. + * + * Returns 0 on success, -EINVAL otherwise. + */ +static int ag71xx_change_mtu(struct net_device *dev, int new_mtu) +{ + =C2=A0 =C2=A0 =C2=A0 if (new_mtu < 68 || new_mtu > AG71XX_MAX_DATA_LEN) + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 return -EINVAL; + =C2=A0 =C2=A0 =C2=A0 dev->mtu =3D new_mtu; + =C2=A0 =C2=A0 =C2=A0 return 0; +} + =C2=A0static const struct net_device_ops ag71xx_netdev_ops =3D { =C2=A0 =C2=A0 =C2=A0 =C2=A0.ndo_open =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D ag71xx_open, =C2=A0 =C2=A0 =C2=A0 =C2=A0.ndo_stop =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =3D ag71xx_stop, =C2=A0 =C2=A0 =C2=A0 =C2=A0.ndo_start_xmit =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D = ag71xx_hard_start_xmit, =C2=A0 =C2=A0 =C2=A0 =C2=A0.ndo_do_ioctl =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =3D ag71xx_do_ioctl, =C2=A0 =C2=A0 =C2=A0 =C2=A0.ndo_tx_timeout =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D = ag71xx_tx_timeout, - =C2=A0 =C2=A0 =C2=A0 .ndo_change_mtu =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D eth_= change_mtu, + =C2=A0 =C2=A0 =C2=A0 .ndo_change_mtu =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D ag71= xx_change_mtu, =C2=A0 =C2=A0 =C2=A0 =C2=A0.ndo_set_mac_address =C2=A0 =C2=A0=3D eth_mac_ad= dr, =C2=A0 =C2=A0 =C2=A0 =C2=A0.ndo_validate_addr =C2=A0 =C2=A0 =C2=A0=3D eth_v= alidate_addr, =C2=A0#ifdef CONFIG_NET_POLL_CONTROLLER -- Robert Bradley --=20 Robert Bradley