All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 2/3] sunvnet: allow admin to set sunvnet MTU
@ 2014-09-12 22:22 David L Stevens
  2014-09-13 20:17 ` Sergei Shtylyov
  0 siblings, 1 reply; 2+ messages in thread
From: David L Stevens @ 2014-09-12 22:22 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

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>
---
 drivers/net/ethernet/sun/sunvnet.c |    6 +++++-
 drivers/net/ethernet/sun/sunvnet.h |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index a6418bb..b557ec4 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -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;
diff --git a/drivers/net/ethernet/sun/sunvnet.h b/drivers/net/ethernet/sun/sunvnet.h
index 243ae69..fcf0129 100644
--- a/drivers/net/ethernet/sun/sunvnet.h
+++ b/drivers/net/ethernet/sun/sunvnet.h
@@ -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)
 -- 1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next 2/3] sunvnet: allow admin to set sunvnet MTU
  2014-09-12 22:22 [PATCH net-next 2/3] sunvnet: allow admin to set sunvnet MTU David L Stevens
@ 2014-09-13 20:17 ` Sergei Shtylyov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Shtylyov @ 2014-09-13 20:17 UTC (permalink / raw)
  To: David L Stevens, David Miller; +Cc: netdev

Hello.

On 9/13/2014 1:22 AM, David L Stevens wrote:

> 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>
> ---
>   drivers/net/ethernet/sun/sunvnet.c |    6 +++++-
>   drivers/net/ethernet/sun/sunvnet.h |    2 +-
>   2 files changed, 6 insertions(+), 2 deletions(-)

> diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
> index a6418bb..b557ec4 100644
> --- a/drivers/net/ethernet/sun/sunvnet.c
> +++ b/drivers/net/ethernet/sun/sunvnet.c
> @@ -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) {

    The patch seems somehow spoiled -- there should be no space before +.

> +		goto out_dropped;
> +	}
> +
>   	spin_lock_irqsave(&port->vio.lock, flags);
>    	dr = &port->vio.drings[VIO_DRIVER_TX_RING];

WBR, Sergei

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-13 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-12 22:22 [PATCH net-next 2/3] sunvnet: allow admin to set sunvnet MTU David L Stevens
2014-09-13 20:17 ` Sergei Shtylyov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.