sunvnet: allow admin to set sunvnet MTU
Subsystems (2)
PATCH v2 2/3 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 <[email protected]>
--- drivers/net/ethernet/sun/sunvnet.c | 6 +++++- drivers/net/ethernet/sun/sunvnet.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/sun/sunvnet.c +5 -1
@@ -751,6 +751,10 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)if (unlikely (!port)) goto out_dropped; +if (skb->len > port->vio.rmtu) { + goto out_dropped; + } +spin_lock_irqsave (&port->vio.lock, flags); dr = &port->vio.drings[VIO_DRIVER_TX_RING ];
@@ -972,7 +976,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;
drivers/net/ethernet/sun/sunvnet.h +1 -1
@@ -11,7 +11,7 @@*/ #define VNET_TX_TIMEOUT (5 * HZ) -#define VNET_MAXPACKET 1518ULL/* ETH_FRAMELEN + VLAN_HDR */ +#define VNET_MAXPACKET 65553ULL/* 64K-1 +ETH HDR +VLAN HDR*/ #define VNET_TX_RING_SIZE 512#define VNET_TX_WAKEUP_THRESH (dr) ((dr)->pending / 4)
Signature · 1 line
1.7.1
Quoted 14 lines · David L Stevens
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 <[email protected]>--- drivers/net/ethernet/sun/sunvnet.c | 6 +++++- drivers/net/ethernet/sun/sunvnet.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)drivers/net/ethernet/sun/sunvnet.c +0
-0
drivers/net/ethernet/sun/sunvnet.c static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev) · line 756
Quoted 6 lines
drivers/net/ethernet/sun/sunvnet.c +3
-0@@ -751,6 +751,10 @@ static int vnet_start_xmit(struct sk_buff *skb, struct net_device *dev)if (unlikely (!port)) goto out_dropped; +if (skb->len > port->vio.rmtu) { + goto out_dropped; + }
{} not needed.
[...]
WBR, Sergei