target/ath25: ar231x ethernet driver: enable baby jumbo frames
authoracoul <alex@ozo.com>
Fri, 30 Oct 2015 17:36:31 +0000 (19:36 +0200)
committeracoul <alex@ozo.com>
Thu, 31 Mar 2016 05:28:36 +0000 (08:28 +0300)
target/linux/ath25/patches-4.1/302-eth_baby_jumbo_frames.patch [new file with mode: 0644]

diff --git a/target/linux/ath25/patches-4.1/302-eth_baby_jumbo_frames.patch b/target/linux/ath25/patches-4.1/302-eth_baby_jumbo_frames.patch
new file mode 100644 (file)
index 0000000..6ce6a69
--- /dev/null
@@ -0,0 +1,62 @@
+--- a/drivers/net/ethernet/atheros/ar231x/ar231x.h
++++ b/drivers/net/ethernet/atheros/ar231x/ar231x.h
+@@ -4,6 +4,7 @@
+  * Copyright (C) 2004 by Sameer Dekate <sdekate@arubanetworks.com>
+  * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org>
+  * Copyright (C) 2006-2009 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Alexandros C. Couloumbis <alex@ozo.com>
+  *
+  * Thanks to Atheros for providing hardware and documentation
+  * enabling me to write this driver.
+--- a/drivers/net/ethernet/atheros/ar231x/ar231x.c
++++ b/drivers/net/ethernet/atheros/ar231x/ar231x.c
+@@ -4,6 +4,7 @@
+  * Copyright (C) 2004 by Sameer Dekate <sdekate@arubanetworks.com>
+  * Copyright (C) 2006 Imre Kaloz <kaloz@openwrt.org>
+  * Copyright (C) 2006-2009 Felix Fietkau <nbd@openwrt.org>
++ * Copyright (C) 2015 Alexandros C. Couloumbis <alex@ozo.com>
+  *
+  * Thanks to Atheros for providing hardware and documentation
+  * enabling me to write this driver.
+@@ -152,13 +153,31 @@ ar231x_netpoll(struct net_device *dev)
+ }
+ #endif
++/*
++ * Enable baby jumbo packet support (as per RFC 4638).
++ *
++ * ath25_change_mtu: set interface MTU.
++ * A modified eth_change_mtu, changing the upper limit from ETH_DATA_LEN to
++ * AR2313_MTU.  This means that baby jumbo packets may be used by
++ * PPPoE users, assuming that AR2313_MTU > ETH_DATA_LEN.
++ *
++ * Returns 0 on success, -EINVAL otherwise.
++ */
++static int ath25_change_mtu(struct net_device *dev, int new_mtu)
++{
++      if (new_mtu < 68 || new_mtu > AR2313_MTU)
++                      return -EINVAL;
++      dev->mtu = new_mtu;
++      return 0;
++}
++
+ static const struct net_device_ops ar231x_ops = {
+       .ndo_open               = ar231x_open,
+       .ndo_stop               = ar231x_close,
+       .ndo_start_xmit         = ar231x_start_xmit,
+       .ndo_set_rx_mode        = ar231x_multicast_list,
+       .ndo_do_ioctl           = ar231x_ioctl,
+-      .ndo_change_mtu         = eth_change_mtu,
++      .ndo_change_mtu         = ath25_change_mtu,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_tx_timeout         = ar231x_tx_timeout,
+@@ -955,7 +974,7 @@ static int ar231x_open(struct net_device
+       mdelay(10);
+-      dev->mtu = 1500;
++      dev->mtu = ETH_DATA_LEN;
+       netif_start_queue(dev);
+       sp->eth_regs->mac_control |= MAC_CONTROL_RE;