aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/lantiq
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2016-10-07 15:02:13 +0100
committerJohn Crispin <john@phrozen.org>2016-10-15 11:36:51 +0200
commit8a2a20e71e2909f84dab47e51dfda9e292a6c1ae (patch)
tree45cdd28e5d2fa0fd93008d0add32f8788618e2db /package/kernel/lantiq
parentcf458de382fc6f6a8715fadb3edf152d0196a26a (diff)
downloadupstream-8a2a20e71e2909f84dab47e51dfda9e292a6c1ae.tar.gz
upstream-8a2a20e71e2909f84dab47e51dfda9e292a6c1ae.tar.bz2
upstream-8a2a20e71e2909f84dab47e51dfda9e292a6c1ae.zip
ltq-ptm: Support 1508-byte MTU for RFC4638
Tested with VDSL on TP-Link WD8970, I see full 1500-byte PPP data frames, which end up being 1526 byte Ethernet frames (including Ethernet+VLAN headers) on the wire. Fixes: FS#210 Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'package/kernel/lantiq')
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c12
-rw-r--r--package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c12
2 files changed, 22 insertions, 2 deletions
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
index dc75b12cca..b096b0a702 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_adsl.c
@@ -128,6 +128,7 @@ static int ptm_stop(struct net_device *);
static unsigned int ptm_poll(int, unsigned int);
static int ptm_napi_poll(struct napi_struct *, int);
static int ptm_hard_start_xmit(struct sk_buff *, struct net_device *);
+static int ptm_change_mtu(struct net_device *, int);
static int ptm_ioctl(struct net_device *, struct ifreq *, int);
static void ptm_tx_timeout(struct net_device *);
@@ -246,7 +247,7 @@ static struct net_device_ops g_ptm_netdev_ops = {
.ndo_start_xmit = ptm_hard_start_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
- .ndo_change_mtu = eth_change_mtu,
+ .ndo_change_mtu = ptm_change_mtu,
.ndo_do_ioctl = ptm_ioctl,
.ndo_tx_timeout = ptm_tx_timeout,
};
@@ -451,6 +452,15 @@ PTM_HARD_START_XMIT_FAIL:
return NETDEV_TX_OK;
}
+static int ptm_change_mtu(struct net_device *dev, int mtu)
+{
+ /* Allow up to 1508 bytes, for RFC4638 */
+ if (mtu < 68 || mtu > ETH_DATA_LEN + 8)
+ return -EINVAL;
+ dev->mtu = mtu;
+ return 0;
+}
+
static int ptm_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
int ndev;
diff --git a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
index 41464e6c27..bc27c270d8 100644
--- a/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
+++ b/package/kernel/lantiq/ltq-ptm/src/ifxmips_ptm_vdsl.c
@@ -74,6 +74,7 @@ static int ptm_stop(struct net_device *);
static unsigned int ptm_poll(int, unsigned int);
static int ptm_napi_poll(struct napi_struct *, int);
static int ptm_hard_start_xmit(struct sk_buff *, struct net_device *);
+static int ptm_change_mtu(struct net_device *, int);
static int ptm_ioctl(struct net_device *, struct ifreq *, int);
static void ptm_tx_timeout(struct net_device *);
@@ -114,7 +115,7 @@ static struct net_device_ops g_ptm_netdev_ops = {
.ndo_start_xmit = ptm_hard_start_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
- .ndo_change_mtu = eth_change_mtu,
+ .ndo_change_mtu = ptm_change_mtu,
.ndo_do_ioctl = ptm_ioctl,
.ndo_tx_timeout = ptm_tx_timeout,
};
@@ -358,6 +359,15 @@ PTM_HARD_START_XMIT_FAIL:
return 0;
}
+static int ptm_change_mtu(struct net_device *dev, int mtu)
+{
+ /* Allow up to 1508 bytes, for RFC4638 */
+ if (mtu < 68 || mtu > ETH_DATA_LEN + 8)
+ return -EINVAL;
+ dev->mtu = mtu;
+ return 0;
+}
+
static int ptm_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
ASSERT(dev == g_net_dev[0], "incorrect device");