diff options
author | David L Stevens <david.stevens@oracle.com> | 2014-09-30 01:48:18 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-30 23:10:39 +0200 |
commit | 42db672dca5b74f9c85c318b74b3b298e86cbe8e (patch) | |
tree | 01d6e63b6aca18dd889f0a3e6030028ad9ff019b /drivers/net/ethernet/sun/sunvnet.c | |
parent | sunvnet: make transmit path zero-copy in the kernel (diff) | |
download | linux-42db672dca5b74f9c85c318b74b3b298e86cbe8e.tar.xz linux-42db672dca5b74f9c85c318b74b3b298e86cbe8e.zip |
sunvnet: allow admin to set sunvnet MTU
This patch allows an admin to set the MTU on a sunvnet device to arbitrary
values between the minimum (68) and maximum (65535) IPv4 packet sizes.
Signed-off-by: David L Stevens <david.stevens@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sun/sunvnet.c')
-rw-r--r-- | drivers/net/ethernet/sun/sunvnet.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c index 8f5f4e3291a4..39804715bf22 100644 --- a/drivers/net/ethernet/sun/sunvnet.c +++ b/drivers/net/ethernet/sun/sunvnet.c @@ -913,6 +913,9 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev) if (unlikely(!skb)) goto out_dropped; + if (skb->len > port->rmtu) + goto out_dropped; + spin_lock_irqsave(&port->vio.lock, flags); dr = &port->vio.drings[VIO_DRIVER_TX_RING]; @@ -944,7 +947,7 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev) skb = NULL; err = ldc_map_single(port->vio.lp, start, nlen, - port->tx_bufs[txi].cookies, 2, + port->tx_bufs[txi].cookies, VNET_MAXCOOKIES, (LDC_MAP_SHADOW | LDC_MAP_DIRECT | LDC_MAP_RW)); if (err < 0) { netdev_info(dev, "tx buffer map error %d\n", err); @@ -1182,7 +1185,7 @@ static void vnet_set_rx_mode(struct net_device *dev) static int vnet_change_mtu(struct net_device *dev, int new_mtu) { - if (new_mtu != ETH_DATA_LEN) + if (new_mtu < 68 || new_mtu > 65535) return -EINVAL; dev->mtu = new_mtu; |